📄 osd.c
字号:
W9925_OutData(LOWORD(dwData)); // write DATA to display RAM
EA=_bEA;
l++; // increase char count
k++; // access next _dwDisplayArray data
}
// can't write end code when write 32 full OSD
if (bChars<MAX_DISPLAY)
{
// must out end code
// W9925_OutData(0x0000);
// W9925_OutData(0x0000);
_wAddress=((l+bDisplayStart)<<1)-1;
_wAddress&=0x3FFF; // 14 bits valid
_wAddress |=0x8000;
// get data from _dwDisplayArray
dwData=_dwDisplayArray[k]; // contain the data for display RAM
_bEA=EA;
EA=0;
W9925_OutIndex(_wAddress);
W9925_OutData(0xFFFF);
W9925_OutData(0xFFFF);
EA=_bEA;
}
_wOSDEffect=_wOSDDEMO;
//enable OSD display
W9925_WriteReg(OGUPR0, wGuideLength);
W9925_WriteReg(OSDCR,_wOSDEffect|wDisplayBank|OSD_ENABLE|OSD_GUIDE1); // set OSD effect control
wGuideLength=0;
if (wDisplayBank!=ONE_BANK)
{
if (wDisplayBank==BANK_0)
{
wDisplayBank=BANK_1;
}
else
wDisplayBank=BANK_0;
}
#endif //#ifndef NO_OSD
}
// *********************************************************************
// Function : OSD_Initial
// Description : Initial the OSD color pallete and reset flags/variables
// Arguments : NULL
// Return : NULL
// Side Effect :
// *********************************************************************
void OSD_Initial()
{
// set color pallete
// index 0 is not used
// white(index1)
// W9925_WriteReg(OPAL0,w1);
// W9925_WriteReg(OPAL2,w2);
// W9925_WriteReg(OPAL4,w3);
// *** TCH; Add Color0
// W9925_WriteReg(OPAL0,0x00EB);
// W9925_WriteReg(OPAL2,0x0080);
// W9925_WriteReg(OPAL4,0x0080);
// yellow, red
W9925_WriteReg(OPAL0,0xE091);
W9925_WriteReg(OPAL2,0x4436);
W9925_WriteReg(OPAL4,0x8022);
//yellow, green(index2,3)
W9925_WriteReg(OPAL1,0xE0F2);
W9925_WriteReg(OPAL3,0x4480);
W9925_WriteReg(OPAL5,0x8080);
_OSD_OutDisplayRAM(0,0);
W9925_WriteReg(OSDCR,0x0);
// after initial OSD, then can program the bitmap/display RAM
_bOSDInitial=TRUE;
_gbRUHoldSec=0;
_gbCEHoldSec=0;
_gbLBHoldSec=0;
_bRStackDeep=0;
_bLStackDeep=0;
_bCStackDeep=0;
_wOSDEffect=OLCTL_VALUE|TFACTOR_VALUE;
gcShowStatus.bEchoLevel=ECHO_LEVEL;
}
// *********************************************************************
// Function : _OSD_SearchMessage
// Description : Initial the OSD color pallete and reset flags/variables
// Arguments : bType : the message ID for searching
// bCorner : the message's corner
// Return : bStack : stack index to message stacks(0-based)
// 0xFF : no matched ID
// Side Effect :
// *********************************************************************
BYTE _OSD_SearchMessage(BYTE bType, BYTE bCorner)
{
#ifndef NO_OSD
BYTE bStack;
switch(bCorner)
{
case RIGHT_UPPER:
// pointer to right upper message stack
_OSDStatcks=_bOSDRStacks;
// pointer to the stack deep
_bStackDeep=&_bRStackDeep;
break;
case LEFT_BOTTOM:
// pointer to left bottom message stack
_OSDStatcks=_bOSDLStacks;
// pointer to the stack deep
_bStackDeep=&_bLStackDeep;
break;
case CENTER_CORNER:
// pointer to center message stack
_OSDStatcks=_bOSDCStacks;
// pointer to the stack deep
_bStackDeep=&_bCStackDeep;
break;
}
// search message stack for same message type
for (bStack=0;bStack<(*_bStackDeep);bStack++)
{
if (_OSDStatcks[bStack].bType==bType) // same message type
{
return bStack; //return 0-based
}
}
#endif //#ifndef NO_OSD
return 0xFF; // no matched ID
}
// *********************************************************************
// Function : _OSD_SetCorner
// Description : Set the row and column position for display char
// Arguments : bCorner : LEFT_UPPER
// RIGHT_UPPER
// LEFT_BOTTOM
// RIGHT_BOTTOM
// Return : NULL
// : The __iRow/__iCol are set
// Side Effect :
// *********************************************************************
void _OSD_SetCorner(BYTE bCorner)
{
// BC5380
switch(bCorner)
{
/*
case LEFT_UPPER: //left-upper
__iRow=1;
__iCol=2;
break;
*/
case RIGHT_UPPER:
// the first row address for right upper message
__iRow=1;
// __iCol=12;
// if(_bMessageGroup = MSG_ZOOM ) _iCol = 2;
// the last char will align to right
__iCol=ALIGN_RIGHT_COLUMN;
break;
case LEFT_BOTTOM:
// the last row for PAL=11
// the last row for NTSC=9, or the OSD will be cut in some TV
__iRow=9; // the first row address for left bottom message
if (__btTVType==PAL_TV)
__iRow++;
__iCol=2*CHINESE_COLUMNS; // the first col address
break;
/*
case RIGHT_BOTTOM: //right-bottom
__iRow=11;
__iCol=12;
break;
*/
}
// must adjust the row address
#ifndef OSD_TEST
if (__btTVType==PAL_TV)
#endif //#ifndef OSD_TEST
__iRow++;
}
// *********************************************************************
// Function : _OSD_DeleteMessage
// Description : Delete the message ID from message stack
// Arguments : bMessage: the message ID to delete
// bCorner : the message's corner
// Return : NULL
// Side Effect :
// *********************************************************************
void _OSD_DeleteMessage(BYTE bMessage, BYTE bCorner)
{
#ifndef NO_OSD
BYTE bStack;
switch(bCorner)
{
case RIGHT_UPPER:
_OSDStatcks=_bOSDRStacks;
_bStackDeep=&_bRStackDeep;
break;
case LEFT_BOTTOM:
_OSDStatcks=_bOSDLStacks;
_bStackDeep=&_bLStackDeep;
break;
case CENTER_CORNER:
_OSDStatcks=_bOSDCStacks;
_bStackDeep=&_bCStackDeep;
break;
}
// search the matched message ID position
bStack=_OSD_SearchMessage(bMessage, bCorner);
// same message ID found
if (bStack!=0xFF)
{
// move higer stack down one entry.
for (bStack;bStack<(*_bStackDeep)-1;bStack++)
_OSDStatcks[bStack]=_OSDStatcks[bStack+1];
// decrease stack deep
(*_bStackDeep)--;
}
#endif //#ifndef NO_OSD
}
// *********************************************************************
// Function : _OSD_CopyToArray
// Description : Copy the _bIndexArray data to specified array
// Arguments : bCorner : for the array data will be copied to
// bOffset : the offset for for the first copied data
// Return : NULL
// Side Effect :
// *********************************************************************
void _OSD_CopyToArray(BYTE bCorner, BYTE bOffset)
{
BYTE bIndex;
BYTE *bpArray=NULL;
switch(bCorner)
{
case RIGHT_UPPER:
bpArray=&_bRMessageArray;
break;
case LEFT_BOTTOM:
bpArray=&_bLMessageArray;
break;
}
if (bpArray==NULL)
return;
bIndex=bOffset;
// _bIndexArray[0] contain bytes to be copied
for (k=1;k<=_bIndexArray[0];k++)
{
if (k>=12)
break;
bpArray[bIndex+1]=_bIndexArray[k];
bIndex++;
}
bpArray[0]=bIndex;
}
// *********************************************************************
// Function : _OSD_ShowPlayStats
// Description : Update the play mode to _bRMessageArray
// Arguments : bMessage : the play mode
// Return : NULL
// Side Effect :
// *********************************************************************
void _OSD_ShowPlayStatus(BYTE bMessage)
{
#ifndef NO_OSD
BYTE bIndex;
BYTE bTemp=FALSE;
// all the play mode are grouped as MSG_PLAYING
_bMessageGroup=MSG_PLAYING;
switch(bMessage)
{
case MSG_STEP:
_bIndexArray=aMsgStep;
break;
case MSG_FREEZE:
_bIndexArray=aMsgFreezeOn;
break;
case MSG_PLAYING:
_bIndexArray=aMsgPlay;
break;
case MSG_STOP:
_bIndexArray=aMsgStop;
break;
case MSG_FAST:
_bIndexArray=aMsgFast;
break;
case MSG_SCANFORWARD:
_bIndexArray=aMsgScanF;
bTemp=TRUE;
break;
case MSG_SCANBACKWARD:
_bIndexArray=aMsgScanB;
bTemp=TRUE;
break;
case MSG_SLOW:
_bIndexArray=aMsgSlow;
bTemp=TRUE;
// show slow speed in DISPLAY mode
/*
// do not add speed factor for slow
// because the bitmap RAM space is not enough
if (gcShowStatus.bOsdDisplay)
{
bTemp=FALSE;
}
*/
break;
case MSG_PAUSE:
_bIndexArray=aMsgPause;
break;
}
// copy the _bIndexArray data to _bRMessageArray
_OSD_CopyToArray(RIGHT_UPPER, 0);
if (bTemp) // need add speed factor
{
if (bMessage==MSG_SLOW)
{
// slow add speed factor "1/N"
bIndex=_bRMessageArray[0]+1;
// show slow speed in DISPLAY mode
if (!gcShowStatus.bOsdDisplay)
{
// 1
_bRMessageArray[bIndex]=CHAR_1;
bIndex++;
}
// /
_bRMessageArray[bIndex]=CHAR_SLASH;
_bRMessageArray[0]=bIndex;
}
bIndex=_bRMessageArray[0]+1;
// N factor
_bRMessageArray[bIndex]=_bSpeedFactor+CHAR_0;
_bRMessageArray[0]=bIndex;
}
#endif //#ifndef NO_OSD
}
// *********************************************************************
// Function : _OSD_ShowTime
// Description : Show the time by the format mm:ss after text
// Arguments : bIndex : pointer to a OSD index array
// bMessage: the message for the OSD
// bMin : minute value
// bSec : second value
// Return : NULL
// Side Effect : It will change _bRMessageArray content
// *********************************************************************
void _OSD_ShowTime ( BYTE bIndex[], BYTE bMessage, BYTE bMin, BYTE bSec)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -