📄 safe.c
字号:
osd0_state = 1;
//#endif
}
#endif
}
#ifdef COLORFUL_SCREENSAVER
const UINT32 col_tbl[ ]={PAL4_YELLOW, PAL4_BLUE, PAL4_PURPEL1,PAL4_ORAGNGE,PAL4_GREEN1, PAL4_WHITE, PAL4_RED, PAL4_YELLOW, PAL4_ORAGNGE, PAL4_GREEN2, PAL4_PINK, PAL4_PURPEL2};
#else
const UINT32 col_tbl[5]={PAL4_ORIGIN,PAL4_WHITE,PAL4_LGREEN,PAL4_PURPEL,PAL4_BLUE};
#endif//COLORFUL_SCREENSAVER
void ChangeColorTable()
{
#ifdef COLORFUL_SCREENSAVER
nSaverColor = nSaverColor +2;
if (nSaverColor >= 12)
nSaverColor = 0;
SetOsdCol(0, 0, 3, col_tbl[nSaverColor]);
SetOsdCol(0, 0, 2, col_tbl[nSaverColor+1]);
#else
nSaverColor++;
if (nSaverColor >= 5)
nSaverColor = 0;
#ifdef BBK_DVD//zhaoyanhua add 03-10-28 13:43
SetOsdCol(0, 0, 3, col_tbl[nSaverColor]);
SetOsdCol(0, 0, 1, 0x000000ff);
#else
SetOsdCol(0, 0, 3, col_tbl[nSaverColor]);
#endif
#endif
}
#ifdef COLORFUL_SCREENSAVER
/*********************************
*Colorful ScreenSaver
*Added by xulf and zhaoyanhua 0721
**********************************/
void ColorDisplay(void)
{
if (p_scan == 0)
{
//display DVD color
ChangeColorValue(0, 30, 0, 21, 3, 2, 0);
//renew the color of the edge of disk(top right corner)
ChangeColorValue( 24, 28, 0, 15, 2, 3, 1);
//renew the color of the edge of disk(left corner)
ChangeColorValue(11, 14, 14, 16, 2, 3, 0);
ChangeColorValue(10, 13, 16, 22, 2, 3, 0);
//renew the color of the edge of disk(in the middle of DVD)
ChangeColorValue(20, 22, 5, 9, 2, 3, -1);
ChangeColorValue(17, 18, 9, 11, 2, 3, 0);
//display two dot color
ChangeColorValue(25, 38, 41, 55, 3, 2, 0);
}
else
{
//display DVD color
ChangeColorValue(0, 30, 0, 42, 3, 2, 0);
//renew the color of the edge of disk(top right corner)
ChangeColorValue( 25, 29, 5, 20, 2, 3, 1);
//renew the color of the edge of disk(left corner)
ChangeColorValue(11, 14, 28, 32, 2, 3, 0);
ChangeColorValue(10, 13, 32, 44, 2, 3, 0);
//renew the color of the edge of disk(in the middle of DVD)
ChangeColorValue(20, 22, 10, 14, 2, 3, 0);
ChangeColorValue(17, 20, 12, 19, 2, 3, 0);
//display two dot color
ChangeColorValue(25, 38, 81, 110, 3, 2, 0);
}
}
/******************************************
*This is for the 4-color bitmap.
*modify the part of bitmap data in order to change
*original color to another color.
*
*INPUT:
* SrcColIndex : 0-3, original color
DstColIndex : 0-3, changed color
step : line offset
*creat: xulf and zhaoyanhua 2003/07/31
*******************************************/
void ChangeColorValue(UINT16 xStart, UINT16 xEnd, UINT16 yStart, UINT16 yEnd, UINT8 SrcColIndex, UINT8 DstColIndex, INT16 step)
{
BYTE *pTopLine, *pBtmLine;
UINT32 nStartLoc, xPos=0, yPos=0;
UINT16 j, k, m;
UINT16 nRegionWidth = region[0].osd_w * 4;
UINT16 nSaverWidth, nSaverHigh;
UINT16 nSpace;
INT16 i=0;
nStartLoc = (yPos * nRegionWidth / 8) + (xPos / 4);
nSaverWidth = OSD_SAVER_W;
nSaverHigh = OSD_SAVER_H;
nSpace = nSaverWidth/4 ;
nSaverHigh /= 2;
m = DstColIndex-SrcColIndex;
if (yEnd>region[0].osd_h/2) yEnd=region[0].osd_h/2; //potatooo, 20030827
for(j=yStart;j<yEnd;j++)
{
for (k =xStart; k <xEnd; k++)
{
pTopLine = (BYTE *)(((BYTE *)get_osdbuf_baseptr()) + (region[0].osd_header[0] + OSD_DATA_OFFSET(region[0].osd_format)) * 32+j*nRegionWidth / 4+i);
pBtmLine = (BYTE *)(((BYTE *)get_osdbuf_baseptr()) + (region[0].osd_header[1] + OSD_DATA_OFFSET(region[0].osd_format)) * 32+j*nRegionWidth / 4+i);
if((pTopLine[k + nStartLoc]&0x03) == SrcColIndex)
pTopLine[k + nStartLoc]+=m;
if((pTopLine[k + nStartLoc]&0x0c ) == (SrcColIndex<<2))
pTopLine[k + nStartLoc]+=m*4;
if((pTopLine[k + nStartLoc]&0x30) == (SrcColIndex<<4))
pTopLine[k + nStartLoc]+=m*16;
if((pTopLine[k + nStartLoc]&0xc0) == (SrcColIndex<<6))
pTopLine[k + nStartLoc]+=m*64;
if(p_scan==0)
{
if((pBtmLine[k + nStartLoc]&0x03) == SrcColIndex)
pBtmLine[k + nStartLoc]+=m;
if((pBtmLine[k + nStartLoc]&0x0c ) == (SrcColIndex<<2))
pBtmLine[k + nStartLoc]+=m*4;
if((pBtmLine[k + nStartLoc]&0x30) == (SrcColIndex<<4))
pBtmLine[k+ nStartLoc]+=m*16;
if((pBtmLine[k + nStartLoc]&0xc0) == (SrcColIndex<<6))
pBtmLine[k + nStartLoc]+=m*64;
}
}
i = i+step;
}
}
#else
void ColorDisplay(void)
{}
#endif
void DrawOsdScreenSaver(UINT32 xPos, UINT32 yPos)
{
BYTE *pTopLine, *pBtmLine;
UINT32 nStartLoc;
UINT16 i, j, k;
UINT16 nSaverWidth, nSaverHigh;
UINT16 nRegionWidth = region[0].osd_w * 4; // pixel
UINT16 nSpace;
osd_tog_region(0, OSD_ON);
//initialize buffer start
pTopLine = (BYTE *)(((BYTE *)get_osdbuf_baseptr()) + (region[0].osd_header[0] + OSD_DATA_OFFSET(region[0].osd_format)) * 32);
pBtmLine = (BYTE *)(((BYTE *)get_osdbuf_baseptr()) + (region[0].osd_header[1] + OSD_DATA_OFFSET(region[0].osd_format)) * 32);
nStartLoc = (yPos * nRegionWidth / 8) + (xPos / 4);
// printf("get_osdbuf_baseptr = %x\n", get_osdbuf_baseptr());
//get saver information
nSaverWidth = OSD_SAVER_W; // in pixel
nSaverHigh = OSD_SAVER_H; // interlace mode
nSpace = nSaverWidth / 4; // in byte
if (p_scan == 0)
nSaverHigh /= 2;
for (j = 0; j < nSaverHigh; j++)
{
for (i = 0; i < nSpace; i++)
{
if (i % 2 == 0)
pTopLine[i + nStartLoc] = Pattern_Saver[(gpImgAddr[i / 2] >> 4)];
else
pTopLine[i + nStartLoc] = Pattern_Saver[(gpImgAddr[i / 2] & 0x0f)];
}
pTopLine += nRegionWidth / 4;
if (p_scan == 0)
{
if (nSpace % 2 == 1)
{
k = 1;
pBtmLine[nStartLoc] = Pattern_Saver[(gpImgAddr[nSpace / 2] & 0x0f)];
gpImgAddr += (nSaverWidth / 8 + 1);
}
else
{
k = 0;
gpImgAddr += (nSaverWidth / 8);
}
for (i = k; i < nSpace; i++)
{
if ((i - k) % 2 == 0)
pBtmLine[i + nStartLoc] = Pattern_Saver[(gpImgAddr[(i - k) / 2] >> 4)];
else
pBtmLine[i + nStartLoc] = Pattern_Saver[(gpImgAddr[(i - k) / 2] & 0x0f)];
}
pBtmLine += nRegionWidth / 4;
}
gpImgAddr += (nSaverWidth / 8);
}
timeout_osd[0] = 0;
}
void safe_srn_cooking2()
{
if(safe_state==SAFE_INIT)
{
InitOsdScreenSaver();
safe_state = SAFE_DISPLAYING;
}
/*
// move to DoSyncJob()
else if(safe_state == SAFE_DISPLAYING)
{
DisplayScreenSaver();
}
*/
}
void safe_srn_on(void)
{
if (safeForceEnter==1)
{
//force to enter screen saver
safeForceEnter = 2;
safe_on = 1;
safeMode = 1; //only support type-1
safe_state = SAFE_INIT;
}else if (!safe_on)
{ //system is active
unsigned diff,rtc;
rtc = get_rtc_val();
diff=rtc-save_srn_start_t;
safeMode = setup_GetSSaveType(); //Get screen type
#ifdef QSI_SETUP_MENU//liweihua for SQI setup menu 2004-6-15
extern UINT16 safe_wait_time;
if (diff > safe_wait_time)
#else
#ifdef EASTWIN
if ((diff > SAFE_WAIT_TIME)&&(!bIS_LOWBAT)) // Kevin Sep 10,04
#else
if (diff > SAFE_WAIT_TIME)
#endif
#endif
{
save_srn_start_t = rtc;
#ifdef SDRAM_16Mb_Mode // 2004/08/26 yltseng
#ifndef SUPPORT_OTHER_FILES_SSCREEN //Jack added 04/11/16
if(safeMode) //linrc add for if screen save is OFF and is stop, no OSD display affter
{ // savf wait time is arrive.....2005-1-19 17:21
regs0->osd_base_addr=JPEG_YA;
}
#endif
#endif
if ( (full_scrn&SETUP) || (full_scrn&CUSTM) )
{
setup_save_exit();
}
#ifdef NEWSTYLE_WINDOW // alan, 2003/8/11 09:11PM
if (full_scrn&MESSAGE) // alan, 2003/8/11 09:11PM
{
exit_browse_func();
}
#endif
//safeMode = setup_GetSSaveType(); //Get screen type
//printf("safeMode=%d\n", safeMode);
if (safeMode>0)
{
safeMode = 1; //only support type-1
safe_on = 1;
safe_state = SAFE_INIT;
old_t_disp = t_disp;
if (t_disp>0) DispFadeOut();
if (full_scrn)
full_scrn=0;
}
}
}
else
{
if(safeMode==1) safe_srn_cooking2();
else safe_on = 1;
}
}
//force to enter screen saver
void safe_srn_forceON(void)
{
//printf("safe_srn_forceON\n");
safeForceEnter=1;
}
void safe_srn_forceOFF(void)
{
#if (defined(DVB_SETUP)&&!defined(SUPPORT_DVD_OSD)&&defined(OSD_SCREEN_SAVER)) //xsyan add
DISABLE_OSD();
#endif
//printf("safe_srn_forceOFF\n");
safeForceEnter=0;
}
void safe_srn_off(void)
{
#if (defined(DVB_SETUP)&&!defined(SUPPORT_DVD_OSD)&&defined(OSD_SCREEN_SAVER)) //xsyan add
DISABLE_OSD();
#endif
if (safeForceEnter==2) return;
if (safe_on==1)
{
safe_on=0;
safe_state = SAFE_INIT;
#ifdef OSD_SCREEN_SAVER
ExitOsdScreenSaver();
#ifdef SDRAM_16Mb_Mode // 2004/11/26 lyc when safe_srn_on function regs0->osd_base_addr = JPEG_YA
regs0->osd_base_addr = regs0->osdya; //now addr reset;
#endif
#else
ShowTitle();
sys_cmd=0;//2-8-21 21:54
#endif
#ifdef CD_PLAYER//liweihua 2003-9-18
if(cd_type_loaded==CDDA)
{
osd_init_cdplayer();
#ifdef VIRTUAL_KEYBOARD//liweihua 2003-9-18
osd_draw_virtual_keyboard(0,0,4);
hl_keyboard_button(KeyID);
full_scrn |= KEYBOARD;
#endif
}
#endif
#ifdef DYNAMIC_SPECTRUM//zhaoyanhua add 03-11-3 19:29
//if(bEqDisplay)
{//terry,mark it,2003/12/24 10:32PM
//Show3dspectrum();
}
#endif
}
}
extern BYTE safe_state;
void DoSyncJob(void)
{
/*
if ((play_state == VCD_STATE_IDLE) ||
(play_state == VCD_STATE_STOP) ||
(play_state == VCD_STATE_OPEN) ||
(play_state == VCD_STATE_PAUSE))
{
//safe_srn_on();
}
*/
#ifdef OSD_SCREEN_SAVER
if (safe_state == 1)
DisplayScreenSaver();
#endif
#ifdef MP3_NO_DISPLAY //2004-4-23 12:50张宇M
if (t_disp==1)
mp3_noshow_diplay();
#endif
}
#if (defined(DVB_SETUP)&&!defined(SUPPORT_DVD_OSD)&&defined(OSD_SCREEN_SAVER)) //xsyan add
static void enable_osd_saver(void)
{
regs0->osd_tlink_addr = region[0].osd_header[0];
regs0->osd_blink_addr = region[0].osd_header[1];
regs0->osd_en= 1;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -