📄 osd.c
字号:
/*
** FILE
** osd.c
**
** DESCRIPTION
** control OSD interface.
**
*/
#include "config.h"
#include "memmap.h"
#include "global.h"
#include "dma.h"
#include "mon.h"
#include "func.h"
#include "osd.h"
#include "osdfont.h"
#include "osd_str.h"
#include "stdlib.h"
#include "endian.h"
#include "osd_init.h"
//--------DEBUG MESSAGE--------//
//#define MONE_OSD_BUFFER
//#define MONE_POLLING_OSD
#define OSD_SHADE
#define ADD_DECMP 1
//void ClearOsdMsg(int);
BYTE reindex(BYTE c);
//void ClearOsdRam(void);
//void ShowRemOsdMsg(void);
//void ShowOsdMsg(char *, int);
/*
**
*/
t_osd_region region[8];
#if SUPPORT_OSD
#define SUPPORT_OSD_COLOR4 1
#define SUPPORT_OSD_COLOR16 0
#define COLOR_BACK 0
#define COLOR_BORDER 2
#define COLOR_FORE 3
#define CHAR_SEPARATOR 1
#define LINE_SPACE 16
#define COLOR4 1
//0 -> 00(OSD background)
//1 -> 01(anti background)
static const BYTE PatternEdge[] = { //Detect Edge
0x00, //0000 0000 0000
0x01, //0001 0000 0001
0x04, //0010 0000 0100
0x05, //0011 0000 0101
0x10, //0100 0001 0000
0x11, //0101 0001 0001
0x14, //0110 0001 0100
0x15, //0111 0001 0101
0x40, //1000 0100 0000
0x41, //1001 0100 0001
0x44, //1010 0100 0100
0x45, //1011 0100 0101
0x50, //1100 0101 0000
0x51, //1101 0101 0001
0x54, //1110 0101 0100
0x55 //1111 0101 0101
};
//0 -> 00(OSD background)
//1 -> 11(font color:yellow-green)
//font boundary(only horizontal) -> 01(anti-background)
static const BYTE pattern_4Normal[] = { //old:pattern_4
0x00, //0000 0000 0000
0x07, //0001 0000 0111
0x1d, //0010 0001 1101
0x1f, //0011 0001 1111
0x74, //0100 0111 0100
0x77, //0101 0111 0111
0x7d, //0110 0111 1101
0x7f, //0111 0111 1111
0xd0, //1000 1101 0000
0xd7, //1001 1101 0111
0xdd, //1010 1101 1101
0xdf, //1011 1101 1111
0xf4, //1100 1111 0100
0xf7, //1101 1111 0111
0xfd, //1110 1111 1101
0xff, //1111 1111 1111
};
//0 -> 00(OSD background:STD_BLACK)
//1 -> 11(font color:STD_WHITE)
static const BYTE pattern_setup[] = { //setup menu normal
0x00, //0000 0000 0000
0x03, //0001 0000 0011
0x0c, //0010 0000 1100
0x0f, //0011 0000 1111
0x30, //0100 0011 0000
0x33, //0101 0011 0011
0x3c, //0110 0011 1100
0x3f, //0111 0011 1111
0xc0, //1000 1100 0000
0xc3, //1001 1100 0011
0xcc, //1010 1100 1100
0xcf, //1011 1100 1111
0xf0, //1100 1111 0000
0xf3, //1101 1111 0011
0xfc, //1110 1111 1100
0xff, //1111 1111 1111
};
//0 -> 00(OSD background:STD_BLACK)
//1 -> 01(font color:STD_GREEN)
static const BYTE pattern_setup_anti[] = { //setup menu anti
0x00, //0000 0000 0000
0x01, //0001 0000 0001
0x04, //0010 0000 0100
0x05, //0011 0000 0101
0x10, //0100 0001 0000
0x11, //0101 0001 0001
0x14, //0110 0001 0100
0x15, //0111 0001 0101
0x40, //1000 0100 0000
0x41, //1001 0100 0001
0x44, //1010 0100 0100
0x45, //1011 0100 0101
0x50, //1100 0101 0000
0x51, //1101 0101 0001
0x54, //1110 0101 0100
0x55, //1111 0101 0101
};
//0 -> 10(OSD background:STD_MAGENTA)
//1 -> 01(font color:STD_WHITE)
static const BYTE pattern_setup_title[] = { //setup menu title
0xaa, //0000 1010 1010
0xab, //0001 1010 1011
0xae, //0010 1010 1110
0xaf, //0011 1010 1111
0xba, //0100 1011 1010
0xbb, //0101 1011 1011
0xbe, //0110 1011 1110
0xbf, //0111 1011 1111
0xea, //1000 1110 1010
0xeb, //1001 1110 1011
0xee, //1010 1110 1110
0xef, //1011 1110 1111
0xfa, //1100 1111 1010
0xfb, //1101 1111 1011
0xfe, //1110 1111 1110
0xff, //1111 1111 1111
};
//0 -> 10(transparent background)
//1 -> 11(font color:yellow-green)
/*
static const BYTE pattern_4Prog[] = { //old:pattern_a4
0xaa, //0000 1010 1010
0xab, //0001 1010 1011
0xad, //0010 1010 1110
0xaf, //0011 1010 1111
0xba, //0100 1011 1010
0xbb, //0101 1011 1011
0xbd, //0110 1011 1110
0xbf, //0111 1011 1111
0xda, //1000 1110 1010
0xdb, //1001 1110 1011
0xdd, //1010 1110 1110
0xdf, //1011 1110 1111
0xfa, //1100 1111 1010
0xfb, //1101 1111 1011
0xfd, //1110 1111 1110
0xff, //1111 1111 1111
};
*/
//-------------------------------------------------------------------//
#ifdef SUPPORT_OSD_COLOR4
#define COLOR0 0x01
#define COLOR1 0x03
#undef COLOR0
#undef COLOR1
#ifdef OSD_SHADE
#if 1 //ZHX 050303
static const UINT16 palette_4color[] = {
__palette2F(0x50, 0x70, 0x70, 0, 0), //ZHX 032403 newly is 0
__palette2F(0x68, 0x80, 0x80, 1, 1), //ZHX 032403 newly is 0
__palette2F(0x50, 0x70, 0x70, 0, 0), //ZHX 032403 newly is __palette2F(0x50, 0x70, 0x70, 0, 0)
__palette2F(0xF8, 0x80, 0x80, 1, 1), //ZHX 032403 newly is STD_WHITE
};
#else
static const UINT16 palette_4color[] = {
0,
0,
__palette2F(0x48, 0x80, 0x80, 0, 0),
STD_WHITE,
};
#endif
#else
//4 color palette
static const UINT16 palette_4color[] = {
__palette2F(0x50, 0x70, 0x70, 0, 0), //shade behind font
MOD_BLACK,
__palette2F(0x50, 0x70, 0x70, 1, 0), //shade outside font
MOD_GREEN,
};
#endif
//4 color setup palette
//(Blending,Fill)=
//(*,0)=Blending factor as active
//(*,1)=force to fill color
static const UINT16 palette_4color_setup[] = {
//Standard Color in osd.h
STD_BLACK, //Std. BLACK:Normal Font,Background//---Blending
STD_GREEN, //Std. GREEN:Hilight Font,Foreground
STD_MAGENTA, //Std. MAGENTA:Menu Page Title Background//---Blending
STD_WHITE, //Std. WHITE:Normal Font,Foreground
};
#endif /* SUPPORT_OSD_COLOR4 */
//----------------------------------------------------------------//
#ifdef SUPPORT_OSD_COLOR16
#define COLOR0 0x01
#define COLOR1 0x0f
static const BYTE pattern_16[] = {
(COLOR0 << 4) | (COLOR0 << 0),
(COLOR0 << 4) | (COLOR1 << 0),
(COLOR1 << 4) | (COLOR0 << 0), (COLOR1 << 4) | (COLOR1 << 0),
};
#undef COLOR0
#undef COLOR1
#define TRANS_COLOR 0x0000
#define DRK_GREEN_COLOR 0x1111
#define MID_GREEN_COLOR 0x2222
#define BR_GREEN_COLOR 0x3333
#define YELLOW_COLOR 0x4444
#define DRK_ORANGE 0x5555
#define BR_ORANGE 0x6666
#define DRK_RED_COLOR 0x7777
#define BR_RED_COLOR 0x8888
#define GRAY_COLOR 0x9999
#define BR_GRAY_COLOR 0xaaaa
#ifdef CDDA_USE_LOGO
#define BR_WHITE_DX 0xffff
#endif
static const UINT16 palette_16color[] = {
0x00, //TRANS_COLOR 0
__palette2F(75, 85, 74, 1, 1), //DRK_GREEN_COLOR 1
__palette2F(100, 85, 74, 1, 1), //BR_GREEN_COLOR 2
__palette2F(125, 85, 74, 1, 1), //BR_GREEN_COLOR 3
__palette2F(199, 15, 167, 1, 1), //YELLOW_COLOR 4
__palette2F(152, 41, 201, 1, 1), //DRK_ORANGE 5
__palette2F(164, 35, 192, 1, 1), //BR_ORANGE 6
__palette2F(112, 64, 229, 1, 1), //DRK_RED_COLOR 7
__palette2F(78, 84, 255, 1, 1), //BR_RED_COLOR 8
__palette2F(128, 128, 128, 1, 1), //GRAY_COLOR 9
__palette2F(64, 128, 128, 1, 0), //BR_GRAY_COLOR a
0, 0, 0, 0,
#ifdef CDDA_USE_LOGO
__palette2F(0xF8, 0x80, 0x80, 1, 1), //ZHX BR_WHITE_DX
#else
0,
#endif
};
#endif /* SUPPORT_OSD_COLOR16 */
//------------------------------------------------------------------//
//static const BYTE pattern_16[] = { 0x00, 0x0F, 0xF0, 0xFF };
#define OSD_WIDTH_PIXEL 128
#if COLOR4
#define PIXEL_PER_BYTE 4
#else /* */
#define PIXEL_PER_BYTE 2
#endif /* */
#define OSD_WIDTH_BYTE (OSD_WIDTH_PIXEL/PIXEL_PER_BYTE)
#define OSD_WIDTH_WORD (OSD_WIDTH_BYTE/4)
#define OSD_HEIGHT 48
#ifndef NULL
#define NULL ((void *)0)
#endif /* */
static const UINT16 osd_header_offset[4] = {
8 + 2 * 4, 8 + 2 * 16, 8 + 2 * 256, 8
};
#define OSD_IS_4COLOR(f) (((f)&OSD_FORMAT_MASK)==OSD_FORMAT_4COLOR)
#define OSD_IS_INTERLACED(f) ((f)&OSD_INTERLACED)
#define OSD_DATA_OFFSET(f) (osd_header_offset[(f)&OSD_FORMAT_MASK])
#define OBV_BASE (SDRAM_BASE + regs0->osdya*1024)
#define get_osdbuf_baseptr() ((void *)OBV_BASE)
/*
** Color definition(EQ Table)
*/
#if CONFIG==CONFIG_COMBO_SVCD
#define MAX_VOLUME 25
#else
#define MAX_VOLUME 21
#endif
#define TRANS_COLOR 0x0000
#define DRK_GREEN_COLOR 0x1111
#define MID_GREEN_COLOR 0x2222
#define BR_GREEN_COLOR 0x3333
#define YELLOW_COLOR 0x4444
#define DRK_ORANGE 0x5555
#define BR_ORANGE 0x6666
#define DRK_RED_COLOR 0x7777
#define BR_RED_COLOR 0x8888
#define GRAY_COLOR 0x9999
#define BR_GRAY_COLOR 0xaaaa
#ifdef CDDA_USE_LOGO
#define BR_WHITE_DX 0xffff
#endif
#define OSD_FONT_HEIGHT 24 //jasing 01-03-07
//#define OSD_FONT_HEIGHT 18 //jasing 01-03-07
#define OSD_REGION0_WIDTH 32
#define OSD_REGION1_WIDTH 96+4 //48
#define OSD_REGION2_WIDTH 72+8
#define OSD_REGION3_WIDTH 96+4 //48
#define OSD_REGION4_WIDTH 96+4 //48
#define OSD_REGION0_X 32
#define OSD_REGION0_Y 32
#define OSD_REGION1_X 80
#define OSD_REGION1_Y 80+8
#define OSD_REGION2_X 32
#define OSD_REGION2_Y 100
#define OSD_REGION3_X 80
#define OSD_REGION3_Y 170+5
#define OSD_REGION4_X 80
#define OSD_REGION4_Y 256+4
#define OSD_FONT_HEIGHT8 8
//#define REGIONS_ACTIVE 8//jhuang 2002/3/10 move to global .h
const UINT16 bColorTab[] = { DRK_GREEN_COLOR, MID_GREEN_COLOR, BR_GREEN_COLOR,
YELLOW_COLOR, DRK_ORANGE, DRK_RED_COLOR, BR_RED_COLOR
};
/*
** Disable OSD
*/
void osd_disable(void)
{
regs0->osd_en = 0;
#if CONFIG==CONFIG_COMBO_SVCD
if(tv_wait_sync)
WAIT_VSYNC; //this action become effective when vsync only
#endif
}
/*
** Enable OSD
*/
void osd_enable(void)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -