Esempio n. 1
0
static void KeyboardCommands(void)
{
  int is_shift, is_alt;

  keys=GetKeyboard(); 

  if(InputType[2]==SIFC_FKB)	// Family Keyboard (FKB)
  {
   if(keyonly(SCROLLLOCK)) 
   {
    cidisabled^=1;
    FCEUI_DispMessage("Family Keyboard %sabled.",cidisabled?"en":"dis");
   }
   #ifdef SDL
   	SDL_WM_GrabInput( cidisabled? SDL_GRAB_ON: SDL_GRAB_OFF );
   #endif
   if(cidisabled) return;
  }

  is_shift = KEY(LEFTSHIFT) | KEY(RIGHTSHIFT);
  is_alt = KEY(LEFTALT) | KEY(RIGHTALT);

   #ifdef SDL
	if(keyonly(F4))
	{
		if(is_shift)
			FCEUI_SetRenderDisable(-1, 2);
		else
			FCEUI_SetRenderDisable(2, -1);
	}
	#endif
	
	#if defined(SDL) && !defined(FLASH)
		if(keyonly(ENTER) && is_alt) ToggleFS();
	#endif


// Disable most keyboard shortcuts in Flash
#ifndef FLASH

	NoWaiting &=~ 1;
	
	if(KEY(GRAVE))
	{
		NoWaiting|=1;
	}
	
	if(gametype==GIT_FDS)
	{
		if(keyonly(F6)) FCEUI_FDSSelect();
		if(keyonly(F8)) FCEUI_FDSInsert(0);
	}
	
	if(keyonly(F9))
	{
		FCEUI_SaveSnapshot();
	}

	if(gametype!=GIT_NSF)
	{
		#ifndef EXTGUI
		if(keyonly(F2))
		{
			DoCheatSeq();
		}
		#endif
		
		if(keyonly(F5)) 
		{
			if(is_shift)
				FCEUI_SaveMovie(NULL);
			else
				FCEUI_SaveState(NULL);
		}
		
		if(keyonly(F7)) 
		{
			if(is_shift)
				FCEUI_LoadMovie(NULL);
			else
				FCEUI_LoadState(NULL);
		}
	}

  if(keyonly(F1)) FCEUI_ToggleTileView();

  if(keyonly(F10)) FCEUI_ResetNES();
  if(keyonly(F11)) FCEUI_PowerNES();

  #ifdef EXTGUI
  if(keyonly(F3)) GUI_Hide(-1);
  if(KEY(F12)) GUI_RequestExit();
  if(KEY(ESCAPE)) CloseGame();
  #else
  if(KEY(F12) || KEY(ESCAPE)) CloseGame();
  #endif

  if(gametype==GIT_VSUNI)
  {
	if(keyonly(F8)) FCEUI_VSUniCoin();
	if(keyonly(F6))
        {
	 DIPS^=1;
	 FCEUI_VSUniToggleDIPView();
	}
	if(!(DIPS&1)) goto DIPSless;
	if(keyonly(1)) FCEUI_VSUniToggleDIP(0);
	if(keyonly(2)) FCEUI_VSUniToggleDIP(1);
	if(keyonly(3)) FCEUI_VSUniToggleDIP(2);
	if(keyonly(4)) FCEUI_VSUniToggleDIP(3);
	if(keyonly(5)) FCEUI_VSUniToggleDIP(4);
	if(keyonly(6)) FCEUI_VSUniToggleDIP(5);
	if(keyonly(7)) FCEUI_VSUniToggleDIP(6);
	if(keyonly(8)) FCEUI_VSUniToggleDIP(7);
  }
  else
  {
   static uint8 bbuf[32];
   static int bbuft;
   static int barcoder = 0;

   if(keyonly(H)) FCEUI_NTSCSELHUE();
   if(keyonly(T)) FCEUI_NTSCSELTINT();
   if(KEY(KP_MINUS) || KEY(MINUS)) FCEUI_NTSCDEC();
   if(KEY(KP_PLUS) || KEY(EQUAL)) FCEUI_NTSCINC();

   if((InputType[2] == SIFC_BWORLD) || (cspec == SIS_DATACH))
   {
    if(keyonly(F8)) 
    {
     barcoder ^= 1;
     if(!barcoder)
     {
      if(InputType[2] == SIFC_BWORLD)
      {
       strcpy(&BWorldData[1],bbuf);
       BWorldData[0]=1;
      }
      else
       FCEUI_DatachSet(bbuf);
      FCEUI_DispMessage("Barcode Entered");
     } 
     else { bbuft = 0; FCEUI_DispMessage("Enter Barcode");}
    }
   } else barcoder = 0;

	#define SSM(x)		\
	{ if(barcoder) { if(bbuft < 13) {bbuf[bbuft++] = '0' + x; bbuf[bbuft] = 0;} FCEUI_DispMessage("Barcode: %s",bbuf);}	\
	else { 			\
	 if(is_shift) FCEUI_SelectMovie(x); 	\
	 else FCEUI_SelectState(x); 	\
	} }

   DIPSless:
   if(keyonly(0)) SSM(0);
   if(keyonly(1)) SSM(1);
   if(keyonly(2)) SSM(2);
   if(keyonly(3)) SSM(3);
   if(keyonly(4)) SSM(4);
   if(keyonly(5)) SSM(5);
   if(keyonly(6)) SSM(6);
   if(keyonly(7)) SSM(7);
   if(keyonly(8)) SSM(8);
   if(keyonly(9)) SSM(9);
   #undef SSM
 }
#endif
}
Esempio n. 2
0
static void KeyboardCommands(void) {
    int is_shift, is_alt;

    keys = GetKeyboard();

    if ((InputType[2] == SIFC_FKB) || (InputType[2] == SIFC_SUBORKB) || (InputType[2] == SIFC_PEC586KB)) {
        if (cidisabled) return;
    }

    is_shift = KEY(LEFTSHIFT) | KEY(RIGHTSHIFT);
    is_alt = KEY(LEFTALT) | KEY(RIGHTALT);

    if (keyonly(F4)) {
        if (is_shift) FCEUI_SetRenderDisable(-1, 2);
        else FCEUI_SetRenderDisable(2, -1);
    }

    {
        static int nocount = 0;

        NoWaiting &= ~1;
        if (KEY(GRAVE))	//&& nocount)
            NoWaiting |= 1;
        nocount = (nocount + 1) & 3;
    }

    if (gametype == GIT_FDS) {
        if (keyonly(F6)) FCEUI_FDSSelect();
        if (keyonly(F8)) FCEUI_FDSInsert(0);
    }

    if (keyonly(F9)) FCEUI_SaveSnapshot();
    if (gametype != GIT_NSF) {
        if (keyonly(F5)) {
            if (is_shift)
                FCEUI_SaveMovie(NULL);
            else
                FCEUI_SaveState(NULL);
        }
        if (keyonly(F7)) {
            if (is_shift)
                FCEUI_LoadMovie(NULL);
            else
                FCEUI_LoadState(NULL);
        }
    }

//  if(keyonly(F1)) FCEUI_ToggleTileView();

    if (gametype == GIT_VSUNI) {
        if (keyonly(F8)) FCEUI_VSUniCoin();
        if (keyonly(F6)) {
            DIPS ^= 1;
            FCEUI_VSUniToggleDIPView();
        }
        if (!(DIPS & 1)) goto DIPSless;
        if (keyonly(1)) FCEUI_VSUniToggleDIP(0);
        if (keyonly(2)) FCEUI_VSUniToggleDIP(1);
        if (keyonly(3)) FCEUI_VSUniToggleDIP(2);
        if (keyonly(4)) FCEUI_VSUniToggleDIP(3);
        if (keyonly(5)) FCEUI_VSUniToggleDIP(4);
        if (keyonly(6)) FCEUI_VSUniToggleDIP(5);
        if (keyonly(7)) FCEUI_VSUniToggleDIP(6);
        if (keyonly(8)) FCEUI_VSUniToggleDIP(7);
    } else {
        static uint8 bbuf[32];
        static int bbuft;
        static int barcoder = 0;

        if (keyonly(H)) FCEUI_NTSCSELHUE();
        if (keyonly(T)) FCEUI_NTSCSELTINT();
        if (KEY(KP_MINUS) || KEY(MINUS)) FCEUI_NTSCDEC();
        if (KEY(KP_PLUS) || KEY(EQUAL)) FCEUI_NTSCINC();

        if ((InputType[2] == SIFC_BWORLD) || (cspec == SIS_DATACH)) {
            if (keyonly(F8)) {
                barcoder ^= 1;
                if (!barcoder) {
                    if (InputType[2] == SIFC_BWORLD) {
                        strcpy(&BWorldData[1], bbuf);
                        BWorldData[0] = 1;
                    } else
                        FCEUI_DatachSet(bbuf);
                    FCEUI_DispMessage("Barcode Entered");
                } else {
                    bbuft = 0;
                    FCEUI_DispMessage("Enter Barcode");
                }
            }
        } else barcoder = 0;

#define SSM(x)				  \
	{ if (barcoder) { if (bbuft < 13) { bbuf[bbuft++] = '0' + x; bbuf[bbuft] = 0; } FCEUI_DispMessage("Barcode: %s", bbuf); }		 \
	  else {						 \
		  if (is_shift) FCEUI_SelectMovie(x);		  \
		  else FCEUI_SelectState(x);		 \
	  }	\
	}

DIPSless:
        if (keyonly(0)) SSM(0);
        if (keyonly(1)) SSM(1);
        if (keyonly(2)) SSM(2);
        if (keyonly(3)) SSM(3);
        if (keyonly(4)) SSM(4);
        if (keyonly(5)) SSM(5);
        if (keyonly(6)) SSM(6);
        if (keyonly(7)) SSM(7);
        if (keyonly(8)) SSM(8);
        if (keyonly(9)) SSM(9);
#undef SSM
    }
}