⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nav_menu.c

📁 ESS3890+SL原代码(1*16内存)
💻 C
📖 第 1 页 / 共 2 页
字号:
/* Copyright 2003, ESS Technology, Inc.                                 *//* SCCSID @(#)nav_menu.c	4.4 10/17/03 *//* Based on filesys.c	4.8 02/17/03 */#include "vcxi.h"#include "const.h"#include "cg.h"#include "filesys.h"#include "nav_menu.h"#include "display.h"#include "timedef.h"#ifdef ID3#include "id3.h"#endif#ifdef MP3#include "mp3.h"#endif#ifdef ECHO#include "echo.h"#endif#ifdef EQUALIZER#include "eq.h"#endif/*------------------------------------------------------------------------ * Debugging macros *------------------------------------------------------------------------*/#ifdef DEBUG_OSDint osdreg=1;#define CPRINTF(a,b) {osdreg+=3;if(osdreg>13)osdreg=1;debug_osd(a,b,osdreg);}#else#define CPRINTF(a,b)#endif#if 0int bpt;#define BREAKPOINT(x) {bpt=x;while(bpt) VCX_service();}#else#define BREAKPOINT(x) #endif/*------------------------------------------------------------------------ * Private defines *------------------------------------------------------------------------*/#ifdef LONG_FILENAME_SUPP	/* enable in filesys.h for Joliet support */ #define ItemNum         6#define MP3_DIR_LENGTH	20#define MP3_PAGE_XSTART 1#define MP3_PAGE_YSTART 2#define MP3_VERT_LISTING#else#define ItemNum         12#define MP3_DIR_LENGTH	10#define MP3_PAGE_XSTART 16#define MP3_PAGE_YSTART 1#endif LONG_FILENAME_SUPP #define HorzSpace       13#define WIN_LENGTH      28#define BACK_COLOR      10#ifdef LONG_FILENAME_SUPP #define BTN_LENGTH      26#define CG_FRAME_DX	24#else#define BTN_LENGTH      13#define CG_FRAME_DX	12#endif/*------------------------------------------------------------------------ * Global or external variables *------------------------------------------------------------------------*/#ifdef HOST_SLAVE/*extern*/ char InitCD_Force_Stop=0;extern unsigned char cd_stop;unsigned char Long_File_Name;int temp_mp3_song=0;#endif#ifdef WMA_DEC extern int wma_smpl_num;#endif/*------------------------------------------------------------------------ * Private variables *------------------------------------------------------------------------*/static int prev_file_item = 0;static int prev_dir_item = -1;/*------------------------------------------------------------------------ * Private functions *------------------------------------------------------------------------*/#ifdef DATA_CDstatic MP3_page_buf(int, int);static void MP3_track(void);static void MP3_menu(void);int MP3_song(void);void track_to_mp3(int);#ifdef USE_ID3_INFOextern unsigned char cd_stop;void show_ID3(int track);#endif#endif /* DATA_CD *//*------------------------------------------------------------------------ * Begin function listing *------------------------------------------------------------------------*/#ifdef DATA_CDstatic char MP3_DIR[32]="FOLDER  : ";static char MP3_PAGE[] = "PAGE XX/XX";static char mp3_select;static int show_text(uchar *message, int x, int y, int xoffset, 		     int yoffset, int align){    unsigned char pmsg[27];    int j=0;        cg_ch2pixel(&x, &y);    x+=xoffset;    y+=yoffset;    while(message[j]!=0 && j<26 ){        if (message[j] >= 'a') pmsg[j] = message[j] - ('a' - 'A');        else            pmsg[j] = message[j];        j++;    }    pmsg[j]=0;        return GI_text_show(pmsg, x, y, align);}static int show_icon(int icon_id, int x, int y, int xoffset, int yoffset){    cg_ch2pixel(&x, &y);    x+=xoffset;    y+=yoffset;    return GI_icon_show(icon_id, x, y);}/************************************************************************  Function:  Description:*************************************************************************/void MP3_draw_box(){    char new_msg[29];    int need_aud = 0;    int i = 0;    int xstart=76;#ifdef MP3    if((STREAM_type == MP3_ID) && (MPG_frames))need_aud = 1;#endif#ifdef WMA_DEC    if((STREAM_type == WMA_ID) && (wma_smpl_num))need_aud = 1;#endif    CG_menu_on = 1; /* OSD menu is ON */        for (i=1; i<12; i++){	if(need_aud) AUD_service();	button_erase(0, i, WIN_LENGTH, 1, BACK_COLOR);    }        CG_show_window(0, 1, 28, 11, 1, 1, 0);    #ifdef JPEG_DEC    if( (is_fuji_cd&0xF0) == 0xE0 ){ 	CG_map_color_array(10, 8, 3);	show_text("FUJICOLOR CD", 7, 10, 0, 16, 0);    }#endif    }/**********************************************************************/static void color_mapping(int mode, int hli, int *color1, int *color2){    if (hli > 0) { *color1 = 7; *color2 = 3; }    else if (hli<0 && mode==0) { *color1 = 7; *color2 = 3; }    else { *color1 = 13; *color2 = 7; }}/**********************************************************************/static void frame_color_restore(int dummy, int hli, int x, int y, int length){    int j = 0;    if (!dummy && hli == 1) j = 1;    CG_show_frame(x, y, length, 1, j);}static MP3_page_buf(int cur_page, int total_pages){    int bcd_num;            bcd_num = hex2bcd[cur_page];    MP3_PAGE[5] = ((bcd_num >> 4) & 0xf) + '0';    MP3_PAGE[6] = (bcd_num & 0xf) + '0';        bcd_num = hex2bcd[total_pages];    MP3_PAGE[8] = ((bcd_num >> 4) & 0xf) + '0';    MP3_PAGE[9] = (bcd_num & 0xf) + '0';}#ifdef USE_ID3_INFO/* display the ID3 Info */void show_ID3(int track){    char msg[25];    char *read_p, *R_p[2];    ID3_INFO *id3;    unsigned int i,j,tmp, y_offset[2];        if( cd_stop #ifdef EQUALIZER      || OSD_eq_mode > 0#endif	) return;        id3 = ID3_info;    y_offset[0] = 114; y_offset[1] = 140;    R_p[0] = &(ID3_info->song_title[0]);    R_p[1] = &(ID3_info->artist[0]);        if(id3->cur_track != track){/*This is 1st time to show current ID3*/	id3->cur_track = track; id3->cur_timer = 0;	id3->str_len[0] = id3->str_len[1] = 0;	id3_str_index = 0;		for(i=0; i<24; i++) msg[i] = ' '; msg[24] = 0;		/*try to find the length of ID3_info */	for(j=0; j<2; j++){	    /* Clear the OSD area for display*/	    CG_map_color_array(BACK_COLOR, 13, 3);	    GI_text_show(msg, 96, y_offset[j], 0);	    	    read_p = R_p[j];	    tmp = 0;	    for(i=0; i<MAX_ID3_STRING; i++){		if(read_p[i] == 0) break;		if(read_p[i]==' ' && read_p[i+1]==' ' && read_p[i+2]==' '){		    read_p[i] = 0; break;		} 		if(read_p[i] >= '0' && read_p[i] <= 'Z') tmp = 1; 		else if(read_p[i] >= 'a' && read_p[i] <= 'z'){		    read_p[i] -= 0x20; tmp = 1;		} else if (read_p[i] != ' ') read_p[i] = '_';		id3->str_len[j] ++;	    }	    	    if(!tmp) id3->str_len[j] = 0;	    	    if(id3->str_len[j] >0 ){				if( id3->str_len[j] <= 24) {		    CG_map_color_array(BACK_COLOR, 13, 3);		    GI_text_show(read_p, 96, y_offset[j], 0);		} else {		    id3->str_len[j] += 23;		    id3->position[j] = 23;		}		id3_str_index ++;	    }#ifdef HOST_SLAVE	    extern unsigned char force_mp3_title_flag ;	    extern unsigned char force_mp3_artist_flag;	    if (id3_str_index){		force_mp3_title_flag = 1;		force_mp3_artist_flag = 1;	    }#endif	}    }        if(glbTimer - id3->cur_timer <= 30 || !id3_str_index) return;    id3->cur_timer = glbTimer;            for(j=0; j<2; j++){        if(id3->str_len[j] <= 0) continue;        read_p = R_p[j];	#ifdef ECHO	MIC_service();#endif	if(id3->str_len[j] <=24) {	    CG_map_color_array(BACK_COLOR, 13, 3);            GI_text_show(read_p, 96, y_offset[j], 0);            continue;	}		if(id3->position[j] < 23){            for(i=0; i<(23-id3->position[j]); i++) msg[i] = ' ';            for(i=0; i<(id3->position[j]+1); i++)                 msg[i+(23-id3->position[j])] = read_p[i];	} else {	    read_p += id3->position[j] - 23;	    tmp = (id3->str_len[j] - id3->position[j]);	    if(tmp > 24) tmp = 24;	    for(i=0; i<tmp; i++)msg[i] = read_p[i];	    for(i=tmp; i<24; i++) msg[i] = ' ';	}	msg[24] = 0;		CG_map_color_array(BACK_COLOR, 13, 3);	GI_text_show(msg, 96, y_offset[j], 0);		id3->position[j] ++;	if(id3->position[j] > id3->str_len[j]) id3->position[j] = 0;    }    }#endif /* USE_ID3_INFO *//* list MP3 directory */static void MP3_track(void){    int i,hli,j=0;    int x=1,y=4;    int list_track;    int file_cnt = 0;    int color1,color2;    unsigned char icon_id;    int pre_item;    int redraw_item = 0;    int switch_page = 0;    int prev_file_page = -1;    list_track = real_track[mp3_dir];        i = 0;    do {        MP3_DIR[i] = iso9660_dir[list_track].name[i];        i++;    } while (iso9660_dir[list_track].name[i] && i<MP3_DIR_LENGTH);    while ( i < MP3_DIR_LENGTH ) {        MP3_DIR[i] = ' ';        i++;    }    MP3_DIR[i] = 0;    CG_map_color_array(BACK_COLOR, 13, 3);    show_text(MP3_DIR, 1,1,0,6,0);        prev_file_page = mp3_page;    if(mp3_menu_changed) prev_file_page = -1;        mp3_page = mp3_song/ItemNum;    mp3_select = mp3_song-mp3_page*ItemNum;    pre_item = prev_file_item - mp3_page*ItemNum;        if( prev_file_page != mp3_page) switch_page = 1;        MP3_page_buf(mp3_page+1, (iso9660_dir[list_track].dir-1)/ItemNum+1);        CG_map_color_array(BACK_COLOR, 13, 3);    show_text(MP3_PAGE, MP3_PAGE_XSTART, MP3_PAGE_YSTART, 0, 6, 0);        for (i=0; i<iso9660_file_cnt; i++) {        if (iso9660_file[i].dir == list_track) {            if (file_cnt >= ItemNum*mp3_page) {#ifdef JPEG_DEC                if (((iso9660_file[i].loc)>>24) == JPEG_ID) {                    icon_id = ICON_JPG;                } else#endif#ifdef WMA_DEC                if (((iso9660_file[i].loc)>>24) == WMA_ID) {                    icon_id = ICON_WMA;                } else#endif#ifdef GAMEBOY#ifdef VGB		if (((iso9660_file[i].loc)>>24) == GAME_GB_ID) {                    icon_id = ICON_DISC;                }else#endif#ifdef INES 		if (((iso9660_file[i].loc)>>24) == GAME_NES_ID) {                    icon_id = ICON_DISC;                }else#endif#endif /* GAMEBOY */#ifdef MP3CDG 		if (((iso9660_file[i].loc)>>24) == MP3CDG_ID) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -