password.c
资源名称:8202s.rar [点击查看]
上传用户:poi891205
上传日期:2013-07-15
资源大小:9745k
文件大小:16k
源码类别:
DVD
开发平台:
C/C++
- /*
- * Terry,2003/8/20 06:43PM
- * This file is about password.
- */
- #if defined(SDRAM_16Mb_Mode)//&&defined(NEW_STYLE_SETUP)//zhaoyanhua add 2003-11-10 16:33
- #include "memmap.h"
- #include "memmap0.h"
- #endif
- const BYTE Custm_Password[PASSWORD_TOTAL_DIGITAL]=SUPER_PASSWORD; //defined in user_init.h, Jeff 20020606
- #ifdef PULIANG_PASSWORD //yaowh add 04-12-22
- #define REGION_CODE_PSW {IRC_8,IRC_2,IRC_0,IRC_0}
- #define FIRM_WARE_VER_PSW {IRC_UP,IRC_DOWN,IRC_LEFT,IRC_RIGHT}
- #define SUPER_PASSWORD {IRC_1,IRC_0,IRC_0,IRC_4}
- BYTE custm_count_1 = 0;
- BYTE custm_count_2 = 0;
- const BYTE Custm_Password_1[4]=FIRM_WARE_VER_PSW;
- const BYTE Custm_Password_2[4]=REGION_CODE_PSW;
- extern void osd_print_region2(t_osd_region *p, const char *s0, BYTE y_start,BYTE x_start);
- #endif
- #ifdef USER_VERSION_INFORMATION//eastech
- #define VERSION_INFORMATION {IRC_1,IRC_2,IRC_3}
- const BYTE Custm_version[3]=VERSION_INFORMATION;
- BYTE temp_data[4];
- BYTE enter_display_flag=0;
- #define VERSION_INFORMATION_STRING "VER 040727 1"
- BYTE version_count=0;
- #endif
- #ifdef MIDI_EJECT_PASSWORD //ouyang add for eject password 2004-11-20 15:10
- #define MIDI_OPEN_PASSWORD {IRC_6,IRC_6,IRC_7,IRC_7}
- const BYTE midi_open_password[4]=MIDI_OPEN_PASSWORD;
- BYTE temp_num[4];
- //BYTE enter_display_flag=0;
- BYTE midi_open_count=0;
- #endif
- #ifdef AD_TCL//2004-3-22 12:55 lijd
- const BYTE inter_Pass[4]=INTER_PASSWORD; //defined in user_init.h, Jeff 20020606
- const BYTE macro_Pass[4]=MACRO_PASSWORD; //defined in user_init.h, Jeff 20020606
- BYTE inter_count = 0;
- BYTE macro_count = 0;
- #endif
- #ifdef SUPPORT_PASSWD2
- const BYTE Custm_Password1[4]=SUPER_PASSWORD1;//defined in user_init.h, Jeff 20020606
- #endif
- #ifdef QSI_PLATFORM //qsi: added by johnson 20040713
- void display_custm_menu(void);
- enum {
- VER_SHOW_VIA_NORMAL=0,
- VER_SHOW_VIA_SPECIAL, // for internal
- VER_SHOW_MAX
- };
- static BYTE version_show_entry;
- BYTE is_show_full_qsi_version(void)
- {
- return(version_show_entry==VER_SHOW_VIA_SPECIAL);
- }
- void display_custm_menu_full(void)
- {
- version_show_entry = VER_SHOW_VIA_SPECIAL;
- //display_custm_menu();
- setup_ShowCUSTMMsg();
- }
- #endif
- //#define SUPPORT_PASSWD3 //for testing
- #ifdef SUPPORT_PASSWD3
- #ifndef SUPER_PASSWORD3
- #define SUPER_PASSWORD3 {IRC_1,IRC_5,IRC_9,IRC_7} //define super password when open tray
- #endif
- UINT8 setup_audio_mode,custm_count3=0;
- const BYTE Custm_Password3[4]=SUPER_PASSWORD3;//defined in user_init.h, Jeff 20020606
- #endif
- #ifdef WATCH_LOADER_ID
- const BYTE Loader_Password[4]={IRC_1,IRC_2,IRC_3,IRC_4}; //defined in user_init.h, Jeff 20020606
- #endif
- #ifdef DVD_SERVO
- extern const BYTE Servo_Password[8]; // kernel/hwif.c
- extern BYTE *GetServoCodeVersion();
- #endif
- #if defined (SUPPORT_SPG_GAME) && !defined (DVDRELEASE) && defined (SPG_ICE)
- const BYTE ICE_Password[4]={IRC_9,IRC_9,IRC_9,IRC_2};
- static BYTE ICEId_count=0;
- #endif
- BYTE custm_count = 0;
- #ifdef SUPPORT_PASSWD2
- BYTE custm_count1 = 0;
- BYTE only_disp_setup_menu = 0;
- #endif
- #ifdef DVD_SERVO
- BYTE servo_count=0; //Jeff 20030818
- #endif
- #ifdef WATCH_LOADER_ID
- static BYTE LoaderId_count=0;
- #endif
- //=============================================
- //for DVD_SETUP_REENG //added by JS //20040728
- #ifdef DVD_SETUP_REENG
- void display_custm_menu(void)
- {
- //printf("display_custm_menun");
- full_scrn=(SETUP|CUSTM);
- read_custm_setup_select();
- #if defined(SDRAM_16Mb_Mode)//&&defined(NEW_STYLE_SETUP)
- //NOTE:
- //when SDRAM_16M_Mode,ShowTitle() may destroyed
- // OSD memory. So must evaluate osd_base_addr again.
- //zhaoyanhua add 2003-11-10 17:06
- regs0->osd_base_addr=OSD_BASE_USE_ADDR;//P_BIDIR_LUMA;
- #endif
- ShowSetupPage(0);
- //Maoyong added for IR U/D/L/R/Sel proc func setting 2004-9-24 9:12
- SetFullscrnCmdFuncPtr( setup_func_up, setup_func_down, setup_func_left,
- setup_func_right, setup_func_select);
- }
- #else
- void display_custm_menu(void)
- {
- index_y=3;
- full_scrn=(SETUP|CUSTM);
- read_custm_setup_select();
- #if defined(SDRAM_16Mb_Mode)//&&defined(NEW_STYLE_SETUP)
- //NOTE:
- //when SDRAM_16M_Mode,ShowTitle() may destroyed
- // OSD memory. So must evaluate osd_base_addr again.
- //zhaoyanhua add 2003-11-10 17:06
- regs0->osd_base_addr=OSD_BASE_USE_ADDR;//P_BIDIR_LUMA;
- #endif
- #ifdef SETUP_TAB
- #ifdef SOFT_MENU//Modifed by ChenZhao on 2004-9-11 13:58 WP
- osd_init_setup();
- ShowSetupPage(REFRESH_CUSTM);
- #else
- ShowSetupPage(1);
- #endif
- #else
- ShowSetupPage();
- #endif
- //Maoyong added for IR U/D/L/R/Sel proc func setting 2004-9-24 9:12
- SetFullscrnCmdFuncPtr( setup_func_up, setup_func_down, setup_func_left,
- setup_func_right, setup_func_select);
- #ifdef SUPPORT_PASSWD2
- custm_count1=0;
- #endif
- custm_count=0;
- }
- #endif //endo of DVD_SETUP_REENG
- static inline void standard_chk_password(UINT8 rx)
- {
- if( (play_state==VCD_STATE_IDLE)||(play_state==VCD_STATE_OPEN) )
- {
- if (full_scrn&SETUP)
- {
- custm_count=0;
- #ifdef SUPPORT_PASSWD2
- custm_count1=0;
- #endif
- }
- if(rx==Custm_Password[custm_count])
- {
- custm_count++;
- if(custm_count>=PASSWORD_TOTAL_DIGITAL)
- {
- #ifdef QSI_PLATFORM //qsi: added by johnson 20040713
- version_show_entry=VER_SHOW_VIA_NORMAL;
- #endif
- display_custm_menu();
- return;
- }
- }
- #ifdef AD_TCL //2004-3-22 12:57 lijd
- else if (rx==inter_Pass[inter_count])
- {
- inter_count++;
- if(inter_count>=4)
- {
- psprintf(linebuf,INTER_VER);
- strcpy(RegionValStr[REGION2], linebuf);
- PrintOsdMsg(STR_OS_SPACE, REGION2, 1, 1);
- inter_count=0;
- return;
- }
- }
- else if (rx==macro_Pass[macro_count])
- {
- macro_count++;
- if(macro_count>=4)
- {
- psprintf(linebuf,MACRO_VER);
- strcpy(RegionValStr[REGION2], linebuf);
- PrintOsdMsg(STR_OS_SPACE, REGION2, 1, 1);
- macro_count=0;
- return;
- }
- }
- #endif
- else
- {
- #ifdef AD_TCL//2004-3-22 14:51 lijd
- macro_count=0;
- inter_count=0;
- #endif
- custm_count=0;
- }
- #ifdef SUPPORT_PASSWD2
- if(rx==Custm_Password1[custm_count1])
- {
- custm_count1++;
- if(custm_count1>=4)
- {
- #ifdef QSI_PLATFORM //qsi: added by johnson 20040713
- version_show_entry=VER_SHOW_VIA_SPECIAL;
- #endif
- display_custm_menu();
- only_disp_setup_menu=1;
- return;
- }
- } else
- {
- custm_count1=0;
- }
- if(only_disp_setup_menu==1)
- {
- ExitSetupPage(1);
- only_disp_setup_menu = 0;
- }
- #endif
- #ifdef SUPPORT_PASSWD3
- if( full_scrn==(SETUP|CUSTM) )
- {
- if(rx==Custm_Password3[custm_count3])
- {
- custm_count3++;
- if(custm_count3>=4)
- {
- setup_audio_mode=1;
- chg_audio_default_mode();
- }
- } else
- {
- custm_count3=0;
- }
- }
- #endif
- #ifdef DVD_SERVO
- if(rx==Servo_Password[servo_count]) { //Jeff 20030818
- servo_count++;
- if(servo_count>=8) {
- servo_count=0;
- psprintf(RegionValStr[REGION2], "%s", GetServoCodeVersion());
- PrintOsdMsg(STR_OS_SPACE, REGION2, 10, 1);
- return;
- }
- } else {
- servo_count=0;
- }
- #endif
- #ifdef WATCH_LOADER_ID
- if(rx==Loader_Password[LoaderId_count]) {
- extern char Loader_ID[28];//kenny 2002/11/22
- LoaderId_count++;
- if(LoaderId_count>=4) {
- LoaderId_count=0;
- psprintf(RegionValStr[REGION3], "LOADER ID: %s", &Loader_ID[0]);
- PrintOsdMsg(STR_OS_SPACE, REGION3, 0, 1);
- return;
- }
- } else {
- LoaderId_count=0;
- }
- #endif //#ifdef WATCH_LOADER_ID
- #if defined (SUPPORT_SPG_GAME) && !defined (DVDRELEASE) && defined (SPG_ICE)
- if(rx==ICE_Password[ICEId_count]) {
- extern void FS_ICEMainLoop();
- ICEId_count++;
- if(ICEId_count>=4) {
- ICEId_count=0;
- FS_ICEMainLoop();
- return;
- }
- } else {
- ICEId_count=0;
- }
- #endif //#ifdef WATCH_LOADER_ID
- } //if( (play_state==VCD_STATE_IDLE)||(play_state==VCD_STATE_OPEN) )
- }
- #ifdef PULIANG_PASSWORD //yaowh add 04-12-22
- static inline void puliang_chk_password(UINT8 rx)
- {
- if ( (rx==Custm_Password[custm_count])&&(full_scrn&SETUP) )
- {
- custm_count++;
- if(custm_count>=4)
- {
- display_custm_menu();
- return;
- }
- }
- else if( (rx==Custm_Password_1[custm_count_1])&&(play_state==VCD_STATE_OPEN) )
- {
- custm_count_1++;
- if(custm_count_1>=4)
- {
- PrintOsdMsg(FIRM_WARE_VER , REGION1, 0, 0);
- return;
- }
- }
- else if( (rx==Custm_Password_2[custm_count_2])&&(play_state==VCD_STATE_OPEN) )
- {
- custm_count_2++;
- if(custm_count_2>=4)
- {
- PrintOsdMsg(REGION_CODE , REGION1, 0, 0);
- return;
- }
- }
- else
- {
- custm_count_1=0;
- custm_count_2=0;
- custm_count=0;
- }
- }
- #endif //#ifdef puliang_password
- static inline void eastech_chk_password(UINT8 rx)
- {
- #ifdef EASTECH_PASSWORD
- //printf("enter2n");
- //printf("enter_display_flag= %xn",enter_display_flag);
- //printf("------------n");
- //printf("play_state= %xn",play_state);
- if( (play_state==VCD_STATE_OPEN)&&(enter_display_flag)) //||(play_state==VCD_STATE_OPEN) )
- {
- //printf("enter-------------1n");
- if (full_scrn&SETUP)
- {
- custm_count=0;
- }
- if(custm_count==0)
- {
- temp_data[0]=0;
- temp_data[1]=0;
- temp_data[2]=0;
- temp_data[3]=0;
- }
- temp_data[custm_count]=rx;
- custm_count++;
- if(temp_data[0]==Custm_version[0] &&
- temp_data[1]==Custm_version[1] &&
- temp_data[2]==Custm_version[2])
- {
- psprintf(linebuf,"%s %d ",VERSION_INFORMATION_STRING,UserSet.P_RCD);
- //psprintf(linebuf,VERSION_INFORMATION_STRING);
- strcpy(RegionValStr[REGION2], linebuf);
- PrintOsdMsg(STR_OS_SPACE, REGION2, 1, 1);
- timeout_osd[REGION2]= 3*OSD_TIMEOUT;
- custm_count=0;
- enter_display_flag=0;
- return;
- }
- if(temp_data[0]==Custm_Password[0] &&
- temp_data[1]==Custm_Password[1] &&
- temp_data[2]==Custm_Password[2]&&
- temp_data[3]==Custm_Password[3])
- {
- display_custm_menu();
- enter_display_flag=0;
- custm_count=0;
- return;
- }
- if(custm_count>4)
- {
- custm_count=0;
- enter_display_flag=0;
- }
- return;
- }
- #endif//#ifdef EASTECH_PASSWORD
- }
- #ifdef MIDI_EJECT_PASSWORD //ouyang add for eject password 2004-11-20 15:10
- UINT8 midi_open_pwd_start = 0;
- UINT8 midi_open_pwd_finished = 0;
- static inline int midi_eject_chk_password(UINT8 rx)
- {
- if(midi_open_pwd_start)
- {
- if (full_scrn&SETUP)
- {
- midi_open_count=0;
- }
- if(midi_open_count==0)
- {
- temp_num[0]=0;
- temp_num[1]=0;
- temp_num[2]=0;
- temp_num[3]=0;
- }
- temp_num[midi_open_count]=rx;
- if( rx != IRC_EJECT )
- midi_open_count++;
- else
- midi_open_count=0;
- printf("========temp_num================= %d %d %d %d =====n",temp_num[0],temp_num[1],temp_num[2],temp_num[3]);
- printf("========midi_open_password ====== %d %d %d %d =====n",midi_open_password[0],midi_open_password[1],midi_open_password[2],midi_open_password[3]);
- if(temp_num[0]==midi_open_password[0] &&
- temp_num[1]==midi_open_password[1] &&
- temp_num[2]==midi_open_password[2]&&
- temp_num[3]==midi_open_password[3])
- {
- if( rx == IRC_SELECT ){
- //enter_display_flag=0;
- midi_open_pwd_finished=1;
- ircmd_eject_toggle();
- midi_open_count=0;
- return 0;
- }
- }else
- {
- extern void CleanSysMessage(BYTE);
- // extern void osd_Clear_Region(BYTE reg, BYTE bkColor);
- if( rx == IRC_SELECT ){//xlluo modify here 11:16 2004-12-21
- midi_open_pwd_start =0;
- midi_open_pwd_finished =0;
- midi_open_count=0;
- CleanSysMessage(1);
- }
- }
- if(midi_open_count>4)
- {
- midi_open_count=0;
- //enter_display_flag=0;
- }
- // return 1;
- }
- return 1;
- }
- #endif//#ifdef MIDI_EJECT_PASSWORD //ouyang add for eject password 2004-11-20 15:10
- void chk_password(UINT8 rx)
- {
- #ifdef PASSWORD
- #if defined( EASTECH_PASSWORD )
- eastech_chk_password(rx);
- #elif defined(PULIANG_PASSWORD) //yaowh add 04-12-22
- puliang_chk_password(rx);
- #elif defined( MIDI_EJECT_PASSWORD ) //ouyang add for eject password 2004-11-20 15:10
- if (!midi_eject_chk_password(rx)) return;
- standard_chk_password(rx); //ouyang 2004-12-3 11:39
- #else
- standard_chk_password(rx);
- #endif
- #endif //#ifdef PASSWORD
- safe_srn_off();
- if(old_key==rx)
- {
- UINT16 stmp = regs0->rtc_15_0;
- int diff = stmp-timestamp_key;
- #ifdef Ti3001_OSD_UI_1 // AMP osd timeout=2*OSD_TIMEOUT //jason 2-10-4 15:34
- if (diff < OSD_TIMEOUT*2)
- #elif defined(NEW_UART_COMMAND)
- if(diff< OSD_TIMEOUT*2)
- #else
- if (diff < OSD_TIMEOUT)
- #endif
- {
- if(action_click)
- timestamp_key = regs0->rtc_15_0;
- action_click=1;
- //printf("actionn");
- }else
- {
- timestamp_key = regs0->rtc_15_0;
- action_click=0;
- //printf("action time outn");
- }
- }else
- {
- timestamp_key = regs0->rtc_15_0;
- action_click=0;
- //printf("difference keyn");
- }
- #ifndef IR_TOOL
- #ifdef IR_DBG
- printf("nn-----IR input, rx:%x ,cmd:%s -----n",rx,irc_func_str[rx]);
- #endif
- #endif
- if(system_state!=SYSTEM_IDLE)
- {
- ircmd_pre_paser(rx);
- }
- old_key=(BYTE)rx;
- }