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

📄 vplayer.c

📁 一个两碟控制的VCD的代码,两碟之间的转动及连续播放,已大量生产的CODE.
💻 C
字号:
/* SCCSID @(#)vplayer.c	1.44 8/3/98 */ 

#include "../const.h"
#include "../panelcmd.h"
#include "../micro.h"
#include "../vcd30.h"
#include "../driver/osd.h"
#include "../sysinfo.h"
#include "../vcxi.h"
#include "../font.h"
#include "options.h"
#include "graphic.h"
#include "stdfunc.h"
#include "html_pub.h"
#include "globals.h"
#include "playsd.h"
#include "../keydef.h"
#include "../custom.h"

extern char		forceDSAabort;

#ifdef CUST71
#define OSD_TIMEOUT 100
#else
#define OSD_TIMEOUT	75
#endif

/*
 * Virtual VCD3.0 player:
 * "Registers":
 *	1. CD-Loader status: open/close, VCD type
 *	2. Remote Control
 *	3. HTML page controllers (shall remember only URL)
 *	4. timer (do I need it?)
 *
 */

extern unsigned int before_mute;
extern int is_audio_mute;
extern int audio_level;
extern int OSD2_X,OSD2_Y,OSD2_W,OSD2_H;

void VirtualPlayer() {
  int osd_clear;
  int ircode;
  unsigned int timeout;
  int curr_highlight = currPage.curr_anchor;
  char tmp[2];
  char PLUS_10_cnt = 0;
  int cd_30opened=0;

#ifndef CUST3
#ifndef NEW_VFD_CODE
  addMicroRing(PANEL_BLANK | BLANK_ALL);
  addMicroRing(SHOW_MSG | SHOW_EVD30);
#else
  VFD_blank_all();
  VFD_msg(VFDMSG_vcd30);
#endif
#endif

#ifdef CUST71
#ifndef NEW_VFD_CODE
  addMicroRing(PANEL_BLANK | BLANK_ALL);
  addMicroRing(0x1b02);
#else
  VFD_blank_all();
#endif
#endif

#ifdef SVA_06MM
   addMicroRing(0x1b10);
#endif

#ifdef  ONE
   addMicroRing(0x1e80);
#endif


  if (setjmp(vcd30_power_buf)) {
      /*
       * reinitialise registers 
       */
      register int foo = 0xc3;
      mvd[riface_irqsuppress] = 0;
      asm("nop"); asm("nop");
      asm volatile("movtos %0,psw" : :"r" (foo));

      ircode=getInfraCode();
      vcd30_key_preprocess(ircode);
  }

  init_GX_malloc();

  au_init();

  init_html();

  disp_url();

  /*****  start navigation ****/
  while(1) {
    ircode=getInfraCode();

#ifdef OSD
    if (ircode!=NO_KEY) {
        ClrOsd(); 
	Start_OSD();
	timeout=glbTimer + OSD_TIMEOUT;
	osd_clear = 1;
    }
    else if ((glbTimer > timeout) && (osd_clear)) { 
	Close_OSD1();
        ClrOsd(); 
	osd_clear = 0;
	if (OSD2_Y < 82){
	    OSD2_rect(OSD2_X,OSD2_Y,OSD2_W,OSD2_H);
            redraw_mouse();
            Open_OSD2();
	}
    }
#endif

    if (ircode !=NO_KEY){

	
    if ((ircode>=KEY_0)&&(ircode<=KEY_9)){
#if 0
        tmp[0]='0'+ircode;
        tmp[1]=0;
        OSDKEY2(tmp, tmp);
#endif
	if (PLUS_10_cnt)
            set_highlight(ircode-1+10*PLUS_10_cnt,0);
	else 
	  if (ircode>=KEY_1)
            set_highlight(ircode-1,0);
	  else set_highlight(9, 0);	
	PLUS_10_cnt = 0;
#ifdef CUST71
        if (get_URL()==0) disp_url();
#endif
    }
    else{
    	switch (ircode) {
        case KEY_PLUS_10: 
		PLUS_10_cnt++;
		break;
   #ifdef  SUOJIA_REMOTE
       case  PREVIOUS_KEY:
   #endif

   #ifdef  SUOJIA_NEW_REMOTE
       case  PREVIOUS_KEY:
   #endif

    	case FB_KEY:

            	OSDKEY2("PREV", "PREV");
            	set_highlight(currPage.curr_anchor-1, 0); 
            	break;
   #ifdef  SUOJIA_REMOTE
       case  NEXT_KEY:
   #endif

   #ifdef  SUOJIA_NEW_REMOTE
       case  NEXT_KEY:
   #endif

    	case FF_KEY:

            	OSDKEY2("NEXT", "NEXT");
            	set_highlight(currPage.curr_anchor+1, 0); 
            	break;

    	case ZOOM_RIGHT_KEY:
            	OSDKEY2("RIGHT", "RIGHT");
        	move_cursor(0x10); 
        	break;
    	case ZOOM_LEFT_KEY:  
        	OSDKEY2("LEFT", "LEFT");
        	move_cursor(0x50); 
        	break;
    	case ZOOM_UP_KEY:
        	OSDKEY2("UP", "UP");
        	move_cursor(0x60); 
        	break;
    	case ZOOM_DOWN_KEY:
        	OSDKEY2("DOWN", "DOWN");
	        move_cursor(0x20); 
        	break;
	case PLAY_KEY:
		OSDKEY(MSG_e3_play, MSG_c3_play);
        	if (get_URL()==0) disp_url();
        	break;
        case STOPRETURN_KEY:
        case RETURN_KEY:
    	case STOP_KEY:
      		OSDKEY(MSG_e3_return, MSG_c3_return);
      		prev_url();
      		break;
    	case PROGRAM_KEY:
#ifdef OSD
      		OSDKEY(MSG_e3_marked, MSG_c3_marked);
#endif
      		add_bookmark(&currPage);
      		break;
    	case DISPLAY_KEY:
        	if (list_bookmark()==0) 
	    		show_bookmark();
        	disp_url();
        	break;
    	case PBC_KEY:
		vcd20(VCD30_PLAY_VCD);
        	break;
    	case TV_MODE_KEY:
		TV_mode_detect();
		break;
    	case MUTE_KEY:
		is_audio_mute ^= 1;
		if (is_audio_mute){
	    		before_mute = vcx_audio_volume;
	    		vcx_audio_volume = 0;
		}	
		else{
	    		vcx_audio_volume = before_mute;
		}
		process_volume();
		break;
    	case VOLUME_UP_KEY:
		if (is_audio_mute) {
			is_audio_mute = 0;
			vcx_audio_volume = before_mute;
		}
		if ((vcx_audio_volume&0xff)<0x10){
	    		vcx_audio_volume += 0x101;
	    		audio_level++;
		}
		process_volume();
		break;
    	case VOLUME_DOWN_KEY:
		if (is_audio_mute) {
			is_audio_mute = 0;
			vcx_audio_volume = before_mute;
		}
        	if (vcx_audio_volume>0){
            		vcx_audio_volume -= 0x101; 
	    		audio_level--;
        	}
		process_volume();
		break;
    	case ROTATE_CLOCK_KEY:
		vcd20(VCD30_ROTATE_CLOCK);
		break;
    	case ROTATE_ANTI_CLOCK_KEY:
		vcd20(VCD30_ROTATE_ANTI_CLOCK);
		break;
        case DISC_1_EJECT_KEY:
             if (EAUX8_HIGH) {   /* DISC_SW_IS_HIGH */
                  vcd20(VCD30_DISC_1_EJECT_CLOCK);
              } else {
              if (cd_30opened == 0) {
              if (currPage.flag_sound)
                  au_end(0); 
                CLEAR_EAUX4;         /* TRAY_CLOSE */
                do {
                ;
                } while (EAUX1_HIGH);  /* DISC_2_OPEN_HIGH*/
                cd_30opened = 1;
                SET_EAUX3;
                SET_EAUX4;           /* TRAY_STOP */
              } else {
                CLEAR_EAUX3;         /* TRAY_OPEN */
                do {

                } while (EAUX14_HIGH);    /* DISC_2_CLOSE_IS_HIGH*/
                cd_30opened = 0;
                SET_EAUX3;
                SET_EAUX4;           /* TRAY_STOP */
              }
            }
                break;
        case DISC_2_EJECT_KEY:
             if (EAUX8_LOW) {              /* DISC_SW_IS_LOW */
                  vcd20(VCD30_DISC_2_EJECT_CLOCK);
              } else {
             if (cd_30opened == 0) {
               if (currPage.flag_sound)
                  au_end(0); 
                CLEAR_EAUX3;         /* TRAY_OPEN */
                do {

                } while (EAUX13_HIGH);    /* DISC_1_OPEN_HIGH*/
                cd_30opened = 1;
                SET_EAUX3;
                SET_EAUX4;           /* TRAY_STOP */
              } else {
                if (currPage.flag_sound)
                  au_end(0); 
                  CLEAR_EAUX4;        /* TRAY_CLOSE */
                do {
                   } while (EAUX10_HIGH);    /* DISC_1_CLOSE_IS_HIGH*/
                 cd_30opened = 0;
                 SET_EAUX3;
                 SET_EAUX4;           /* TRAY_STOP */
              }
            }
             break;

#ifndef CUST71
#ifdef THREE_CDS
    	case ROTATE_CLOCK_KEY:
		vcd20(VCD30_ROTATE_CLOCK);
		break;
    	case ROTATE_ANTI_CLOCK_KEY:
		vcd20(VCD30_ROTATE_ANTI_CLOCK);
		break;
#endif
#endif
    	case NO_KEY:
        	break;
    	default:
		PLUS_10_cnt = 0;
    	}
    }
    }
    /****  other action: audio, refresh ****/
    html_sound();
#if (CUST3 && !CUST71)
    receive_dsa();
#endif
    html_timeout();
  }
}

void show_bookmark() 
{
    while(1) {
        int ircode=getInfraCode();
        if ((ircode < KEY_PLUS_10) && (ircode >= KEY_0)) {
	    if (ircode == KEY_0)
                play_bookmark(10);
	    else
                play_bookmark(ircode);
            break;
        }
        else if (ircode == STOP_KEY)
	    break;			/* Stop showing bookmark list */
	else if (ircode == CLEAR_KEY) {
	    /* Clear bookmark list */
	    while (del_bookmark()) ;
	    break;
	}
        html_sound();
    }
}

#if (!CUST71 || POWER_ON)
void vcd30_poweroff() 
{
    if (currPage.flag_sound) 
	au_end(0);

    process_power_off_key();
}
#endif

extern unsigned char cd_tray_just_closed;

#ifndef CUST71
void vcd30_eject() {
    if (currPage.flag_sound) 
	au_end(0);

    forceDSAabort = 0;
    vcd20(VCD30_EJECT);
}
#endif

int vcd30_key_preprocess(int key)
{
#ifdef CUST71
    extern int cd_disc_slot;
#ifdef POWER_ON
    if (key == POWER_KEY)
        vcd30_power_off();
    else
#endif
    {
    if (key == EJECT_KEY)   {
        if (currPage.flag_sound)
            au_end(0);

        forceDSAabort = 0;
    }
    if ((key == EJECT_KEY) || (key == FIRST_DISC_KEY && cd_disc_slot !=1) ||
        (key == SECOND_DISC_KEY && cd_disc_slot !=2) || 
	(key == THIRD_DISC_KEY && cd_disc_slot !=3) ||
        (key == ROTATE_ANTI_CLOCK_KEY) || (key == EXCHANGE_KEY))
	vcd20(key);
    }
#else /* CUST71 */
    if (key == EJECT_KEY) {
	vcd30_eject();
    } else if (key == POWER_KEY) {
	vcd30_poweroff();
    }
#endif /* CUST71 */
}

void process_volume()
{
    char num;
    char osdmsg[6];
    int  tmp=0;

#if (!CUST3 && !P315 || CUST71)
#ifdef OSD
    osdmsg[0]=' ';
    osdmsg[1]=FONT_S_VOL;
    osdmsg[2]=' ';
    osdmsg[4]=' ';
    osdmsg[5]=0;
    tmp = vcx_audio_volume&0xff;
    if (tmp>=10){ 
        osdmsg[3]='1';
    	osdmsg[4] = tmp+'0'-10;
    }
    else{
        osdmsg[3]=tmp+'0';
    }
    OSDKEY(osdmsg,osdmsg);
#endif
#endif

}

⌨️ 快捷键说明

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