📄 cg.c
字号:
} /* CG_track_entry[15:0] = (CG track entry[15:12] | * OSD track number[11:0]) */ CG_track_entry = cur_track_number; tmp = OUTOSDX(OSD_TRACK_REGION,OSD_new_track,OSD_new_track,0); CG_track_entry |= (tmp << 12); }#endif /* PLAY20 */}/* * OSD_time_track(): * This function turns on the flags for displaying OSD time and/or track. * * Inputs: * time_track_mask - Mask specifying whether to set time and/or track * regions for display. (see example below) * Example: * 1. OSD_TIME_REGION_MASK|OSD_TRACK_REGION_MASK: show both time & track * 2. OSD_TIME_REGION_MASK: show time only * 3. OSD_TRACK_REGION_MASK: show track only * duration - Specifies the length of time(in seconds) to display * the time and track information. If '0' is specified then * the time will be displayed indefinitely until explicitly * cleared. */void OSD_time_track(unsigned short time_track_mask, int duration){ OSD_displayed_regions |= time_track_mask;}void OSD_clear_all(int clean_dram){ int i; if (clean_dram) { dram_clear(OSD_start, OP_OSD_LENGTH); CG_menu_on = 0; /* OSD menu is OFF */ } OSD_displayed_regions = 0; CG_track_entry = 0; /* reset..force to update track */ if (gi_msg_number) { for (i=0; i<MAX_MESSAGE_NUMBER; i++) { gi_msg[i].state=STATE_INVALID; gi_msg[i].rect.xstart = 0; gi_msg[i].rect.xend = 0; gi_msg[i].rect.ystart = 0; gi_msg[i].rect.yend = 0; } gi_msg_number = 0; }}void OSD_clear_region(int area){ int i;#ifdef DATA_CD if (STREAM_type) if ( area<1 || area>3 ) return;#endif OSD_displayed_regions &= ~(ptrLshift[area-1]); if (gi_msg_number) { for (i=0; i<MAX_MESSAGE_NUMBER; i++) { if( gi_msg[i].state==STATE_ERASE ) { if ( msg_in_region(i,area) ) gi_msg_remove(i,1); } } }}#ifdef ECHO/* * OSD for echo. We support up to 15 levels. */#define ECHO_LEVEL_POS 6#define CECHO_LEVEL_POS 6unsigned char echo_msg[] = "ECHO +0 ";#ifdef BILINGUAL_OSDunsigned char c_echo_msg[] = { CN_HEADER, CN_HUI2, CN_HEADER, CN_SHENG1, ' ', '+', '0', ' ', 0};#endifvoid OSD_echo(){ int tmp, pos, cpos; int region; region = OSD_KARAOKE_REGION;#ifdef MP3 /* for MP3, don't want to conflict with NPOSD region */ if (STREAM_type) region = 7;#endif if (vcx_echo == -1) { OUTOSD(region, MSG_mic_off, MSG_c_mic_off, 5); } else { if (vcx_echo == 0){ OUTOSD(region, MSG_mic_on, MSG_c_mic_on, 5); } else { tmp = vcx_echo; pos = ECHO_LEVEL_POS; cpos = CECHO_LEVEL_POS; if (vcx_echo >= 10) { echo_msg[ECHO_LEVEL_POS] = '1';#ifdef BILINGUAL_OSD c_echo_msg[CECHO_LEVEL_POS] = '1';#endif tmp -= 10; pos++; cpos++; } echo_msg[ECHO_LEVEL_POS+1] = ' '; echo_msg[pos] = '0' + tmp;#ifdef BILINGUAL_OSD c_echo_msg[CECHO_LEVEL_POS+1] = ' '; c_echo_msg[cpos] = '0' + tmp;#endif OUTOSD(region, echo_msg, c_echo_msg, 5); } }}#endif /* #ifdef ECHO *//* * Display pitch/volume bar. 8 characters, one space, +/- level */PRIVATE unsigned char pitchbarbuf[16];void OSD_pitch_bar(level)int level;{ int i; int region; region = OSD_KARAOKE_REGION; for (i = 0; i < 15; i++) { asm("nop"); pitchbarbuf[i] = FONT_KEYSCALE; } pitchbarbuf[15] = '\0'; pitchbarbuf[0] = FONT_KEYLOW; pitchbarbuf[7] = FONT_KEYMID; pitchbarbuf[14] = FONT_KEYHIGH; pitchbarbuf[level+7] = FONT_KEYCURR; CG_map_color_array(1,6,3); OUTOSD(region, pitchbarbuf, pitchbarbuf, 5);}#if defined(GAMMA) || defined(FLESHTONE)#define SLIDE_BAR#endif#ifdef GAMMAvoid GAMMA_bar(int level){#ifdef SLIDE_BAR OSD_slide_bar(level, 9/*blue*/);#else if (level<0) { /* Clear GAMMA OSD */ OSD_clear_region(OSD_SLIDE_BAR_REGION-1); return; } PLAY_fill_volumebarbuf(level); volumebarbuf[7] = 0; /* zero termination */ OUTOSD(OSD_SLIDE_BAR_REGION-1, MSG_gamma, MSG_gamma, EXTENDED_TIME_OUT); CG_map_color_array(1,6,3); OUTOSD(OSD_SLIDE_BAR_REGION, volumebarbuf, volumebarbuf, EXTENDED_TIME_OUT); #endif SLIDE_BAR}#endif GAMMA#ifdef SLIDE_BARPRIVATE uchar slidebar_buf[] = { FONT_CIRCLE,' ',' ',' ',' ',' ',' ',' ',' ', 0};/* Function: paints OSD slide-bar at OSD_SLIDE_BAR_REGION input: level: 0 =< level <= 14 color_index - index of 16-color palette. output: (none)*/void OSD_slide_bar(int level, int color_index){ int x1,y1; static char prev_level; static char slide_bar_msg_index; if (level<0) { /* Gamma slide-bar */ OSD_clear_region(OSD_SLIDE_BAR_REGION); return; } x1=OSD2CG_map[OSD_SLIDE_BAR_REGION].x + CG_FONT_WIDTH+10; y1=OSD2CG_map[OSD_SLIDE_BAR_REGION].y; if (OSD_displayed_regions & OSD_REGION_9) { /* incremental update */ /* reset OSD timeout */ gi_msg[slide_bar_msg_index].time = EXTENDED_TIME_OUT*2; if (level == 14) { x1 += 130; /* 10 * 13 */ } else if (level > prev_level) { x1 += 10*prev_level; } else { x1 += 10*level; color_index = 7/*black*/; } OSD_area_fill(x1,y1+8,x1+10,y1+24, color_index); if ((level == 7) && (level < prev_level)) OSD_line(x1,y1+2,x1,y1+30, 8/*yellow*/); /* default line */ } else { CG_map_color_array(0,7,8); slide_bar_msg_index = OUTOSD(OSD_SLIDE_BAR_REGION, slidebar_buf, slidebar_buf, EXTENDED_TIME_OUT); if (slide_bar_msg_index>=0) { OSD_area_fill(x1-2,y1,x1+144,y1+32, 7/*black*/); OSD_line(x1+70,y1+2,x1+70,y1+30, 8/*yellow*/); /*default line */ if (level) OSD_area_fill(x1,y1+8,x1+10*level,y1+24, color_index); } } prev_level = level;}#endif SLIDE_BAR#ifdef PLAY20void OSD_digest_menu(int selection){ char * line_1, * line_2;#ifdef BILINGUAL_OSD char * c_line_1, * c_line_2;#endif#ifdef JPEG_DGST if (selection == 1) { assign_osd_msg(line_1, MSG_intro_X_disc_2, c_line_1, MSG_c_intro_X_disc_2); assign_osd_msg(line_2, MSG_track_X_exit_4, c_line_2, MSG_c_track_X_exit_4); } else #endif /* JPEG_DGST */ if (selection == 2) { assign_osd_msg(line_1, MSG_intro_1_disc_X, c_line_1, MSG_c_intro_1_disc_X); assign_osd_msg(line_2, MSG_track_X_exit_4, c_line_2, MSG_c_track_X_exit_4); } else { assign_osd_msg(line_1, MSG_intro_1_disc_2, c_line_1, MSG_c_intro_1_disc_2); assign_osd_msg(line_2, MSG_track_3_exit_4, c_line_2, MSG_c_track_3_exit_4); } GI_msg_show(1,MSG_digest_menu,#ifdef BILINGUAL_OSD MSG_c_digest_menu,#endif 180,88,0,-1,-1,-1,AREA_ERASE,0); GI_msg_show(1,line_1,#ifdef BILINGUAL_OSD c_line_1,#endif 136,146,0,-1,-1,-1,AREA_ERASE,0); GI_msg_show(1,line_2,#ifdef BILINGUAL_OSD c_line_2,#endif 136,178,0,-1,-1,-1,AREA_ERASE,0);}#endif /* PLAY20 *//* CG Functions*//************************************************************************ Function: Description:*************************************************************************/static void cg_install_font_attr(){ FONT_ATR *pfont_atr; /* ENGLISH */ pfont_atr = &cg_font_attr[ENGLISH_FONTS]; pfont_atr->comp_font = T_osd_efonts_comp_font; pfont_atr->code_book = T_osd_efonts_code_book; pfont_atr->offset_tbl = T_osd_efonts_offset_tbl, pfont_atr->index = 0; pfont_atr->bytes = CG_BYTES_PER_CH/2; pfont_atr->width = CG_FONT_WIDTH; pfont_atr->height = CG_FONT_HEIGHT; pfont_atr->start_offset = ENGLISH_FONTS_START; pfont_atr->max_char = OTHER_ONE_SPACE_FONTS_START; pfont_atr->id_offset = 0;#ifdef BILINGUAL_OSD /* Simpified Chinese */ pfont_atr = &cg_font_attr[CHINESE_FONTS]; pfont_atr->comp_font = T_osd_cfonts_comp_font; pfont_atr->code_book = T_osd_cfonts_code_book; pfont_atr->offset_tbl = T_osd_cfonts_offset_tbl, pfont_atr->index = 0; pfont_atr->bytes = CG_BYTES_PER_CH; pfont_atr->width = CG_FONT_WIDTH * 2; pfont_atr->height = CG_FONT_HEIGHT; pfont_atr->start_offset = OTHER_TWO_SPACES_FONTS_START; pfont_atr->max_char = CHINESE_END; pfont_atr->id_offset = 0;#endif /* Small English VSF */ pfont_atr = &cg_font_attr[VWENGLISH_FONTS]; pfont_atr->comp_font = newicon_comp_font; pfont_atr->code_book = newicon_code_book; pfont_atr->offset_tbl = newicon_offset_tbl, pfont_atr->index = 0; pfont_atr->bytes = 0; pfont_atr->width = 0; pfont_atr->height = 0; pfont_atr->start_offset = 0; pfont_atr->max_char = 0xaf; pfont_atr->id_offset = 0;#ifdef NEWVSE_FONT pfont_atr = &cg_font_attr[BIGVSE_FONTS]; pfont_atr->comp_font = newicon_comp_font; pfont_atr->code_book = newicon_code_book; pfont_atr->offset_tbl = newicon_offset_tbl, pfont_atr->index = 0; pfont_atr->bytes = 0; pfont_atr->width = 0; pfont_atr->height = 0; pfont_atr->start_offset = 0; pfont_atr->max_char = 0x80; pfont_atr->id_offset = 0;#endif#ifdef EXTRA_VWFONTS pfont_atr = &cg_font_attr[VWFRENCH_FONTS]; pfont_atr->comp_font = newicon_comp_font; pfont_atr->code_book = newicon_code_book; pfont_atr->offset_tbl = newicon_offset_tbl, pfont_atr->index = 0; pfont_atr->bytes = 0; pfont_atr->width = 0; pfont_atr->height = 0; pfont_atr->start_offset = 0; pfont_atr->max_char = OTHER_ONE_SPACE_FONTS_START; pfont_atr->id_offset = 0;#endif}/************************************************************************ The fonts in ROM are stored at 2bits/pixel. When transferred to DRAM each pixel is expanded to 4 bits. The following array is for that purpose, and convert 2 pixels at a time.*************************************************************************/static uchar map4to8[16] = { 0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, 0x20, 0x21, 0x22, 0x23, 0x30, 0x31, 0x32, 0x33, };static CG_COLOR_MAP cg_map_color_array = { 0x0,0x0, TEXT_BACKGROUND, TEXT_BACKGROUND, TEXT_BORDER, TEXT_BORDER, TEXT_FOREGROUND, TEXT_FOREGROUND};/************************************************************************ return current charset *************************************************************************/int CG_current_font(){ return current_charset;}/************************************************************************ Change the default 2 bit to 4 bit mapping. color2 is 0..3 color4 is 0..15*************************************************************************/static uchar prev_color4[4] = {0xf,0xf,0xf,0xf}; /* initialize for text map*/void CG_map_color(int color2, int color4){ int i; uchar *p; if (prev_color4[color2] != color4) { p = map4to8 + color2; for (i=0; i<4; i++, p+=4) *p = (*p & 0xf0) | color4; color4 <<= 4; p = map4to8 + color2*4; for (i=0; i<4; i++, p++) *p = (*p & 0x0f) | color4; } prev_color4[color2] = color4;}/************************************************************************ Change*************************************************************************/void CG_color_array_mapping(int color1, int color2, int color3){ cg_map_color_array.color1 = color1; cg_map_color_array.color2 = color2; cg_map_color_array.color3 = color3; }void CG_map_color3(int color1, int color2, int color3){ CG_map_color(1, color1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -