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

📄 ircmd_card.c

📁 mp3 player program please read carefully.
💻 C
📖 第 1 页 / 共 2 页
字号:
	    else if(detect_result_last==0x02)   //when play CF
	    {
	    	if((detect_type == 0x03)||(detect_type == 0x02))
	    	{
	    	now_valid_type = 0;	
	    	SwitchMedia(CARD2CD);
	    	}
	    	else
	    	{
	        now_valid_type = (detect_type & 0x1c);
	        SwitchMedia(CD2CARD);
	        }
	        
	     }   
	    else	//play other card  dingzhy 4-10-22 13:52
	    {
	    SwitchMedia(CARD2CD);
	    now_valid_type = 0;
	    }
	
}		
#endif	//#ifdef IR_SWITCH_CD_USB_CF_OTHER

#ifdef SWITCH_CD_CARD_USB//liweihua add 2004-6-8 13:57, for swtich between cd/card/usb
//color define
#define COLOR_WHITE         2
#define COLOR_GRAY          3
#define COLOR_GRAYWHITE     14
#define COLOR_YELLOW        7
#define COLOR_YELLOWGREEN   9
#define COLOR_DBLUE         4
#define COLOR_LBLUE         6
#define COLOR_GREEN         13
#define COLOR_ORANGE        5
//button id define
#define CDBUTTON            0
#ifdef SUPPORT_USB
#define USBBUTTON           CDBUTTON+1
#else
#define USBBUTTON           CDBUTTON
#endif
#ifdef CARD_SETUP_TYPE_3    //dingzhy 2005-6-23 10:03
#define CFBUTTON            (USBBUTTON+1)
#define SDBUTTON            (USBBUTTON+2)
#define MSBUTTON            (USBBUTTON+3)
#define SMCBUTTON           (USBBUTTON+4)
#else  //dingzy add for 3in1 card,usb and cd change 2005-6-23 10:00
#define CARDBUTTON          (USBBUTTON+1)//2
#endif
//define osd parameter
#define RWIDTH      64*4
#define RHEIGHT     288
#define GUIREGION   3


BYTE *show_string[] = { "READ CD",
                        #ifdef SUPPORT_USB
                        "READ USB",
                        #endif
                        #ifdef CARD_SETUP_TYPE_3  //dingzhy 2005-6-23 10:00
                        "READ CF",
                        "READ SD/MMC",
                        "READ MS/MS PRO",
                        "READ SMC",
                        #else
                        "READ CARD",
                        #endif
                        };
BYTE select_media_type = 0;//define selected media type through switch gui
BYTE hilight_button_id;

void draw_switch_background(void)
{
    osd_draw_region_rect(0, 0, RWIDTH, RHEIGHT, COLOR_LBLUE, GUIREGION);
    osd_DrawRegionLine(0, 0, RWIDTH-1, 0, COLOR_WHITE, 1, GUIREGION);
    osd_DrawRegionLine(0, 0, 0, RHEIGHT-1, COLOR_WHITE, 1, GUIREGION);
    osd_DrawRegionLine(RWIDTH-1, 0, RWIDTH-1, RHEIGHT, COLOR_GRAY,1, GUIREGION);
    osd_DrawRegionLine(0, RHEIGHT-1, RWIDTH, RHEIGHT-1, COLOR_GRAY, 1, GUIREGION);    
}
void draw_switch_button(BYTE button_id,BYTE fontcolor,BYTE backcolor,BYTE region)
{
    osd_DrawRegionString(1, button_id*8+6, show_string[button_id],fontcolor,backcolor,region);    
}
#ifdef SWITCH_CD_CARD_USB //winking.J add for DISPLAY 2006 07 17
BYTE AngleSwichFlag;
#endif

void show_switch_gui(void)
{

#ifdef SWITCH_CD_CARD_USB //winking.J add for DISPLAY 2006 07 17
   AngleSwichFlag = 1;
#endif

    //osd_init_switchGUI();
    hilight_button_id = 0;
    if(detect_type == 0)
    {
        psprintf(RegionValStr[REGION1], "USB/CARD NOT FOUND");
        PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);   
    }
    else
    {
	#ifdef SUPPORT_MP4_SUBTITLE	//yaowh add 2005-12-22 11:28
		if(g_pfnPollingSubtitle)
		{
			IsSubtitle = 1;
			supClearSubtitle();
		}	
	#endif
    	osd_init_switchGUI();	//yaowh move here 2005-12-22 11:28
        draw_switch_background();
        if(media_type == MEDIA_CARD)
            hilight_button_id = CDBUTTON;
        else if((detect_type & USB_DEVICE) ) 
            hilight_button_id = USBBUTTON;
        #ifdef CARD_SETUP_TYPE_3   //dingzhy 2005-6-23 10:00
        else if((detect_type & CF_CARD_DEVICE)) 
            hilight_button_id = CFBUTTON;
        else if((detect_type & SD_CARD_DEVICE)) 
            hilight_button_id = SDBUTTON;
        else if((detect_type & MS_CARD_DEVICE)) 
            hilight_button_id = MSBUTTON;
        else if((detect_type & SMC_CARD_DEVICE)) 
            hilight_button_id = SMCBUTTON;
        #else
        else if((detect_type & SD_CARD_DEVICE)||(detect_type & MS_CARD_DEVICE)) 
            hilight_button_id = CARDBUTTON;
        #endif
        
        hilight_button(hilight_button_id);
    }
    
}
//draw default button 
void set_switch_button(void)
{
    BYTE i;
    //DRAW all button with gray font
    #ifdef CARD_SETUP_TYPE_3  //dingzhy add  2005-6-23 10:01
    for(i=CDBUTTON;i<=SMCBUTTON;i++)
        draw_switch_button(i,COLOR_GRAY,COLOR_LBLUE,GUIREGION);
    #else
    for(i=CDBUTTON;i<=CARDBUTTON;i++)
        draw_switch_button(i,COLOR_GRAY,COLOR_LBLUE,GUIREGION);
    #endif    
    //draw all exist media button with white font
    //CD button    
    if(media_type == MEDIA_CARD)
        draw_switch_button(CDBUTTON,COLOR_WHITE,COLOR_LBLUE,GUIREGION);
    // USB button
    #ifdef SUPPORT_USB
    if(detect_type & USB_DEVICE)
        draw_switch_button(USBBUTTON,COLOR_WHITE,COLOR_LBLUE,GUIREGION);
    #endif
    // CF button
    #ifdef CARD_SETUP_TYPE_3  //dingzhy 2005-6-23 10:01
    if(detect_type & CF_CARD_DEVICE)
        draw_switch_button(CFBUTTON,COLOR_WHITE,COLOR_LBLUE,GUIREGION);
    // SD/MMC button
    if(detect_type & SD_CARD_DEVICE)
        draw_switch_button(SDBUTTON,COLOR_WHITE,COLOR_LBLUE,GUIREGION);
    // MS/MS pro button
    if(detect_type & MS_CARD_DEVICE)
        draw_switch_button(MSBUTTON,COLOR_WHITE,COLOR_LBLUE,GUIREGION);
    // SMC button
    if(detect_type & SMC_CARD_DEVICE)
        draw_switch_button(SMCBUTTON,COLOR_WHITE,COLOR_LBLUE,GUIREGION);
    #else
    if((detect_type & SD_CARD_DEVICE)||(detect_type & MS_CARD_DEVICE))
        draw_switch_button(CARDBUTTON,COLOR_WHITE,COLOR_LBLUE,GUIREGION);
    #endif

}

//draw default button and hilight the current select button
void hilight_button(BYTE button_id)
{
    set_switch_button();
    osd_DrawRegionString(1, button_id*8+6, show_string[button_id],COLOR_WHITE,COLOR_ORANGE,GUIREGION); 
}

void switch_gui_up(void)
{
    BYTE offset;
    BYTE current_type;
    offset = detect_type << (7-hilight_button_id);
    if((media_type == MEDIA_CARD)&&(hilight_button_id <= CDBUTTON))
        hilight_button_id = CDBUTTON;
    else if((media_type == MEDIA_CD) && (hilight_button_id <= (CDBUTTON+1)))
        hilight_button_id = CDBUTTON+1;
    else if(offset > 0)
    {
        hilight_button_id--;
        if(hilight_button_id > CDBUTTON)
        {
            #ifdef SUPPORT_USB
            current_type = 0x01<<(hilight_button_id-1);
            #else
            current_type = 0x01<<(hilight_button_id);
            #endif
            if((current_type & detect_type) == 0)
            {
                hilight_button_id--;
                if((media_type == MEDIA_CD) && (hilight_button_id == CDBUTTON))
                return;
            }
        }
        hilight_button(hilight_button_id);
    }
}
void switch_gui_down(void)
{
    BYTE offset;
    BYTE current_type;
    offset = detect_type>>hilight_button_id;
    #ifdef CARD_SETUP_TYPE_3  //dingzhy 2005-6-23 10:01
    if(hilight_button_id>=SMCBUTTON)
        hilight_button_id = SMCBUTTON;
    #else
    if(hilight_button_id>=CARDBUTTON)
        hilight_button_id = CARDBUTTON;
    #endif
    #ifdef SUPPORT_USB
     #ifndef CARD_SETUP_TYPE_3 //dingzhy add 2005-6-23 10:18
     else if(((detect_type>>hilight_button_id) > 0)&&(hilight_button_id < CARDBUTTON))
     #else
    else if((detect_type>>hilight_button_id) > 0)
     #endif
    #else
    else if((detect_type>>(hilight_button_id+1)) > 0)
    #endif
    {
        hilight_button_id++;
        #ifdef SUPPORT_USB
        current_type = 0x01<<(hilight_button_id-1);
        #else
        current_type = 0x01<<(hilight_button_id);
        #endif
        #ifdef CARD_SETUP_TYPE_3 //dingzhy  2005-6-23 10:02
        if((current_type & detect_type) == 0)
            hilight_button_id++;
        #endif
        hilight_button(hilight_button_id);
    }
}
void switch_gui_select(void)
{
    BYTE current_type;
    
    AVD_SetMediaInterrupt();
    
    switch(hilight_button_id)
    {
        case CDBUTTON:
            select_media_type = 0;
            SwitchMedia(CARD2CD);
            break;
        #ifdef SUPPORT_USB
        case USBBUTTON:
            select_media_type = USB_DEVICE;
            storage_type = USB_DEVICE;  //dingzhy  add for  3in1 car usb and disc change  050623 
            SwitchMedia(CD2CARD);
            break;
        #endif
				#ifdef CARD_SETUP_TYPE_3  //dingzhy  add  0623
        case CFBUTTON:
            select_media_type = CF_CARD_DEVICE;
            SwitchMedia(CD2CARD);
            break;
        case SDBUTTON:
            select_media_type = SD_CARD_DEVICE;
            SwitchMedia(CD2CARD);
            break;
        case MSBUTTON:
            select_media_type = MS_CARD_DEVICE;
            SwitchMedia(CD2CARD);
            break;
        case SMCBUTTON:
            select_media_type = SMC_CARD_DEVICE;
            break;
        #else//#ifdef CARD_SETUP_TYPE_3  //dingzhy  a
        case CARDBUTTON:
        		if(detect_type & SD_CARD_DEVICE)
        		{
            	select_media_type = SD_CARD_DEVICE;
            	storage_type = SD_CARD_DEVICE;
            }
            else if(detect_type & MS_CARD_DEVICE)
            {
            	select_media_type = MS_CARD_DEVICE;
            	storage_type = MS_CARD_DEVICE;
            }
            SwitchMedia(CD2CARD);
            break;
        #endif//#ifdef CARD_SETUP_TYPE_3  //dingzhy  a
        default:
            break;
    }
}
void ircmd_switch_cd_card_usb(void)
{
    if(play_state == VCD_STATE_OPEN)
        return;
    if (full_scrn & SWITCH_GUI)
    {
        full_scrn &= (~SWITCH_GUI);
        #ifdef CD_PLAYER 
        if(cd_type_loaded==CDDA)
        {
            osd_init_cdplayer();
        }else               
            osd_init();
        #else
        delay_srv_10ms(1);	//yaowh add 2005-12-22 11:27
        osd_init();
        full_scrn = 0;
        
        #ifdef SUPPORT_MP4_SUBTITLE	//yaowh add 2005-12-22 11:22
        if(IsSubtitle)
        {
			supOpenSubtitle();
		}
		#endif
        #endif
    }
    else
    {
        if((full_scrn & MARK)||(full_scrn & GOTO))
        {
            invalid_key();
            return;
        }
        full_scrn |= SWITCH_GUI;

        show_switch_gui();
        //Maoyong added for IR U/D/L/R/Sel proc func setting 2004-9-24 9:59
        SetFullscrnCmdFuncPtr( switch_gui_up, switch_gui_down, ircmd_null,
                                   ircmd_null, switch_gui_select);
    }
}

#endif//#ifdef SWITCH_CD_CARD_USB
#if defined(FAT_FILE_MODE) && defined(SPHE8202_FAT_WRITE_API)//liweihua mod 2005-3-15 16:16
void ircmd_card_copy(void)
{
    if(fat_play_mode == 1)
    {
        if(pFsJpeg->ControlArea == CNT_AREA_CARD)
        {
            if(pFsJpeg->gifsState == FS_STATE_HDD)
                CardCopy();
            else
            {
                FATCopy();
             }

        }
        else
        {
            invalid_key();
            return;
        }
    }
}
void ircmd_card_delete(void)
{
    if(fat_play_mode == 1)
    {
        FATDelete();
        return;
    }
}
#endif


#endif  //#if defined(SUPPORT_CARD_STORAGE)||defined(SUPPORT_USB)||defined(SPHE8202_CARD_STORAGE)

⌨️ 快捷键说明

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