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

📄 drm_ui.c

📁 dvd里面的一个文件系统的代码
💻 C
📖 第 1 页 / 共 3 页
字号:
#include "user_init.h"

#ifdef SUPPORT_DIVX_HOME_THEATER

#include "global.h"
#include "drm.h"
#include "osd_palette.h"
#include "IR_VFD/ircmd.h"
#include "osd.h"
#include "memmap0.h"

char buf_save_drm_code[20];              //WSLEE for generate drm code 050615

#ifdef DRM_CODE               //WSLEE for generate drm code 050615
void Gen_RegCode(void){
        set_divx_drm_model_id(Divx_drm_modelID);//linrc change for change this ID needn't update fs_mp4.a 2005-8-11 17:15
		//set_divx_drm_model_id(DIVX_DRM_MODEL_ID);		
        generate_registration_code( buf_save_drm_code );
}
#endif

void divx_func_left()
{
    sys_cmd = CMD_SELECT | CMD_FUNC_GAME_L;
}

void divx_func_right()
{
    sys_cmd = CMD_SELECT | CMD_FUNC_GAME_R;
}


void divx_func_select()
{
    sys_cmd = CMD_FUNC | CMD_FUNC_SELECT;

    if( full_scrn & DIVX_DRM_MENU )
    {
#ifdef SDRAM_16Mb_Mode          // 2005/06/18 yltseng
        regs0->osd_base_addr=GetOSDBackUpAddress();
#endif
        full_scrn = 0;
        osd_init();
    }
}
#ifndef DRM_SHOW_FOLLOW_OSD_LANGUAGE_SET
#ifndef DRM_UI_FIVE_LANG
int osd_divx_drm_display( int iPage, int iCode )
{
	char buffer[20];
    #define DRM_FONT_COLOR          1
    #define DRM_BACK_COLOR          0

    extern BYTE    osd0_state;
    osd0_state = 0;
    t_disp = 0;

#ifdef NEW_OSD_DRIVER

    #ifdef OSD_SUPPORT_2_COLOR  // 2005/06/18 yltseng
	const _t_osd_hdr osd_divx_menu_hdr[] = {
        { 36 * 4 * 4, 32 * 5, 32, 80, SIMPLE_HEADER, OSD_FORMAT_2COLOR,  OSD_INTERLACED },
	};
    #else
	const _t_osd_hdr osd_divx_menu_hdr[] = {
        { 36 * 4 * 4, 32 * 5, 32, 80, NORMAL_HEADER, OSD_FORMAT_4COLOR,  OSD_INTERLACED },
	};
    #endif
    
    #ifdef LARGE_OSD_SHOW_IN_LOGO
        #ifdef SDRAM_16Mb_Mode
    regs0->osd_base_addr=OSD_BASE_USE_ADDR;
        #elif defined(SDRAM_32Mb_Mode)
    regs0->osd_base_addr = P_EVBYA_END;
    wb_tag_init();            
        #endif  //SDRAM_16Mb_Mode or SDRAM_32Mb_Mode 
    #endif  //#ifdef LARGE_OSD_SHOW_IN_LOGO

    #ifdef LARGE_OSD_USE_DSP_MEMORY
    switch( InitializeOSDMenu(OSD_MENU_DRM_UI) )
    {
    //cases other than success is not handled...
    default:
        break;
    }
    #endif  //#ifdef LARGE_OSD_USE_DSP_MEMORY

	osd_init_regions( sizeof( osd_divx_menu_hdr ) / sizeof( _t_osd_hdr ), (_t_osd_hdr *) &osd_divx_menu_hdr );
	osd_set_palette_color( 0, DRM_BACK_COLOR, __palette4F( 150,210, 141, 0xe0 ) );
	osd_set_palette_color( 0, DRM_FONT_COLOR, __palette4F( 0, 70, 0,0xff ) );
    
    #ifdef SUPPORT_SW_OSD_SCALING  // for HD OSD, by robert.chang, 2006-09-28
    if( GET_TV_RESOLUTION()  == HD_720 )
        osd_init_scaling(sizeof( osd_divx_menu_hdr ) / sizeof( _t_osd_hdr ), 1);	
    else if(GET_TV_RESOLUTION()  == HD_1080)
        osd_init_scaling(sizeof( osd_divx_menu_hdr ) / sizeof( _t_osd_hdr ), 2);		
    #endif

    osd_tog_region( 0, OSD_ON );
#else

    extern void osd_init_regions(int n, const _t_osd_hdr *hdrp);
    
	const _t_osd_hdr osd_divx_menu_hdr[] = {
        { 18 * 4, 24, 32, 34, NORMAL_HEADER, OSD_FORMAT_4COLOR,  OSD_INTERLACED },
        { 36 * 8, 32 * 5, 32, 80, SETUP_HEADER, OSD_FORMAT_16COLOR,  OSD_INTERLACED },
	};

	osd_init_regions( sizeof( osd_divx_menu_hdr ) / sizeof( _t_osd_hdr ), (_t_osd_hdr *) &osd_divx_menu_hdr );

    SetOsdCol( 1, 1, DRM_BACK_COLOR, __palette4F( 150,210, 141, 0xe0 ) );
    SetOsdCol( 1, 1, DRM_FONT_COLOR, __palette4F( 0, 70, 0,0xff ) );

    #ifdef SUPPORT_SW_OSD_SCALING  // for HD OSD, by robert.chang, 2006-09-28
    if( GET_TV_RESOLUTION()  == HD_720 )
        osd_init_scaling(sizeof( osd_divx_menu_hdr ) / sizeof( _t_osd_hdr ), 1);	
    else if(GET_TV_RESOLUTION()  == HD_1080)
        osd_init_scaling(sizeof( osd_divx_menu_hdr ) / sizeof( _t_osd_hdr ), 2);
    #endif
    
#endif    

    switch( iPage )
    {
    case DRM_DISPLAY_REGISTRATION_CODE:
        
		set_divx_drm_model_id(Divx_drm_modelID);//linrc change for change this ID needn't update fs_mp4.a 2005-8-11 17:15
		//set_divx_drm_model_id(DIVX_DRM_MODEL_ID);		
        generate_registration_code( buffer );
        #ifdef ALCO_PORTABLE//sheny add for alco 11/23
        osd_DrawString( 0, 0, "      DIVX[R] VIDEO ON DEMAND     ", DRM_FONT_COLOR, DRM_BACK_COLOR ); //23 char
        #else
        osd_DrawString( 0, 0, "      -DIVX[R] VIDEO ON DEMAND-     ", DRM_FONT_COLOR, DRM_BACK_COLOR ); //23 char
        #endif
        osd_DrawString( 0, 1, " YOUR REGISTRATION CODE IS:XXXXXXXX", DRM_FONT_COLOR, DRM_BACK_COLOR ); //33 char
        osd_DrawString( 0, 2, "TO LEARN MORE VISIT WWW.DIVX.COM/VOD", DRM_FONT_COLOR, DRM_BACK_COLOR );
        osd_DrawString( 27, 1, buffer, DRM_FONT_COLOR, DRM_BACK_COLOR );
        break;

    case DRM_DISPLAY_AUTHORIZATION_ERROR:

        osd_DrawString( 0, 0, "      -AUTHORIZATION ERROR-         ", DRM_FONT_COLOR, DRM_BACK_COLOR );
        iCode %= 100;
        
        if( iCode == 1 )
        {
            osd_DrawString( 0, 1, "    THIS PLAYER IS NOT AUTHORIZED", DRM_FONT_COLOR, DRM_BACK_COLOR );//19
            osd_DrawString( 0, 2, "         TO PLAY THIS VIDEO.", DRM_FONT_COLOR, DRM_BACK_COLOR );//19
        }
        else if( iCode == 2 )
            osd_DrawString( 0, 2, "       NOT FOR ACTIVATING", DRM_FONT_COLOR, DRM_BACK_COLOR );//18
        else
            osd_DrawString( 0, 2, "       ERROR OR UNSUPPORT", DRM_FONT_COLOR, DRM_BACK_COLOR );//18
        break;

    case DRM_DISPLAY_RENTAL_EXPIRED:
        
        osd_DrawString( 0, 2, "          -RENTAL EXPIRED-          ", DRM_FONT_COLOR, DRM_BACK_COLOR );        //16
        break;

    case DRM_DISPLAY_RENTAL_CONFIRMATION:

		// modify by gary.huang 070316, we need to care rental file with unlimited views.
		if (iCode == 0xff)
		{
	        osd_DrawString( 0, 0, "     -VIEW DIVX[R] VOD RENTAL-      ", DRM_FONT_COLOR, DRM_BACK_COLOR );
	            
	        osd_DrawString( 0, 1, "THIS RENTAL HAS UNLIMITED VIEWS LEFT.", DRM_FONT_COLOR, DRM_BACK_COLOR );
	
	        osd_DrawString( 0, 2, "     DO YOU WANT TO USE ONE OF", DRM_FONT_COLOR, DRM_BACK_COLOR );

	        osd_DrawString( 0, 3, "     YOUR UNLIMITED VIEWS NOW?", DRM_FONT_COLOR, DRM_BACK_COLOR );
		}
		else
		{
	        osd_DrawString( 0, 0, "     -VIEW DIVX[R] VOD RENTAL-      ", DRM_FONT_COLOR, DRM_BACK_COLOR );
	            
	            psprintf( linebuf, "   THIS RENTAL HAS %02d VIEWS LEFT.", iCode % 100 );
	        osd_DrawString( 0, 1, linebuf, DRM_FONT_COLOR, DRM_BACK_COLOR );
	
	        osd_DrawString( 0, 2, "     DO YOU WANT TO USE ONE OF", DRM_FONT_COLOR, DRM_BACK_COLOR );
	            psprintf( linebuf, "       YOUR %02d VIEWS NOW?", iCode % 100 );
	        osd_DrawString( 0, 3, linebuf, DRM_FONT_COLOR, DRM_BACK_COLOR );
	    }
        
        osd_DrawString( 10, 4, "[YES]", DRM_BACK_COLOR, DRM_FONT_COLOR );
        osd_DrawString( 22, 4, "[NO]",  DRM_FONT_COLOR, DRM_BACK_COLOR );

        goto DRM_MENU_START;
        break;

    case DRM_DISPLAY_HW_UNSUPPORTED:
    
        osd_DrawString( 0, 2, "        -DIVX DRM UNSUPPORT-        ", DRM_FONT_COLOR, DRM_BACK_COLOR );
        break;

    case DRM_DISPLAY_AES_ONLY:
        
        osd_DrawString( 0, 2, "         -ONLY AES SUPPORT-         ", DRM_FONT_COLOR, DRM_BACK_COLOR );
        break;

    default:
        return -1;
        break;
    }

    osd_DrawString( 15, 4, "[DONE]", DRM_BACK_COLOR, DRM_FONT_COLOR );

DRM_MENU_START:

    full_scrn = DIVX_DRM_MENU;
    
    //Maoyong added for IR U/D/L/R/Sel proc func setting 2004-9-24 10:14
    SetFullscrnCmdFuncPtr( ircmd_null, ircmd_null, divx_func_left,
                                   divx_func_right, divx_func_select);
    int iRet = 0;

    if( iPage != DRM_DISPLAY_REGISTRATION_CODE )
    {
        int iBtnYes = 1;
        
        while( 1 )
        {
            polling();
            
            if( sys_cmd == ( CMD_SELECT | CMD_FUNC_GAME_L ) )
                iBtnYes = 1;
            else if( sys_cmd == ( CMD_SELECT | CMD_FUNC_GAME_R ) )
                iBtnYes = 0;
            else if( sys_cmd == ( CMD_FUNC | CMD_FUNC_SELECT ) )
                break;

            if( iPage == DRM_DISPLAY_RENTAL_CONFIRMATION )
            {
                if( iBtnYes )
                {
                    osd_DrawString( 10, 4, "[YES]", DRM_BACK_COLOR, DRM_FONT_COLOR );
                    osd_DrawString( 22, 4, "[NO]",  DRM_FONT_COLOR, DRM_BACK_COLOR );
                }
                else
                {
                    osd_DrawString( 10, 4, "[YES]", DRM_FONT_COLOR, DRM_BACK_COLOR );
                    osd_DrawString( 22, 4, "[NO]",  DRM_BACK_COLOR, DRM_FONT_COLOR );                    
                }

                iRet = iBtnYes;
            }

            sys_cmd = 0;
        }
    }
    
    return iRet;
}	
#else//#ifndef DRM_UI_FIVE_LANG

    t_osd_str DivxStr1[5][10] = 
{
     {
        { 0, 0, "DIVX VIDEO ON DEMAND" },
        { 0, 1, "REGISTRATION CODE" },
        { 0, 2, "YOUR REGISTRATION CODE IS A ONE TIME" },
        { 0, 3, "CODE USED TO SETUP YOUR VIDEO ON" },
        { 0, 4, "DEMAND ACCOUNT. THIS WILL ALLOW YOU TO"},
        { 0, 5, "PURCHASE AND RENT VIDEOS TO THIS" },
        { 0, 6, "PLAYER. WHEN ASKED FOR YOU" },
        { 0, 7, "REGISTRATION CODE IT IS: " },
        { 0, 8, "" },
        { 0, 0, NULL }
    },
    {
        { 0, 0, "'DIVX-VIDEO AUF ABRUF'" },
        { 0, 1, "REGISTRIERUNGSCODE" },
        { 0, 2, "SIE ERHALTEN EINEN EINMALIGEN CODE."},
        { 0, 3, "MIT DEM SIE IHR 'VIDEO ON DEMAND'-" },
        { 0, 4, "KONTO EINRICHTEN.DAMIT K""\xd6""NNEN SIE" },
        { 0, 5, "DIVX-VIDEOS KAUFEN UND LEIHEN." },
        { 0, 6, "IHR REGISTRIERUNGSCODE LAUTET:" },
        { 0, 7, "" },
        { 0, 8, "" },
        { 0, 0, NULL }
    },
    {
        { 0, 0, "'DIVX-V""\xcd""DEO A LA CARTA'" },
        { 0, 1, "C""\xd3""DIGO DE REGISTRO" },
        { 0, 2, "RECIBE UN ""\xda""NICO C""\xd3""DIGO CON EL QUE"},
        { 0, 3, "PUEDE CONFIGURAR SU CUENTA 'VIDEO ON"},
        { 0, 4, "DEMAND'. DE ESE MODO PUEDE ADQUIRIR O" },
        { 0, 5, "ALQUILAR V""\xcd""DEOS." },
        { 0, 6, "SU C""\xd3""DIGO DE REGISTRO ES:" },
        { 0, 7, "" },
        { 0, 8, "" },
        { 0, 0, NULL }
    },        
    {
        { 0, 0, "'VID""\xc9""O DIVX ""\xc0"" LA DEMANDE'" },
        { 0, 1, "CODE D'ENREGISTREMENT VOTRE CODE ""\xc0"},
        { 0, 2, "UTILISATION UNIQUE VOUS PERMET DE"},
        { 0, 3, "CR""\xc9""ER VOTRE COMPTE 'VID""\xc9""O ""\xc0"" LA "},
        { 0, 4, "DEMANDE'.IL VOUS PERMETTRA D'ACHETER " },
        { 0, 5, "ET DE LOUER DES VID""\xc9""OS DIVX "},
        { 0, 6, "VOTRE CODE 'ENREGISTREMENT :" },
        { 0, 7, ""},
        { 0, 8, "" },

⌨️ 快捷键说明

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