FDS disk switching stable with one press, VS zapper game coin mapped to 1 button

This commit is contained in:
dborth 2008-10-08 04:53:06 +00:00
parent 022727bb0b
commit 219e471f83
3 changed files with 56 additions and 13 deletions

View File

@ -16,10 +16,14 @@
#include <string.h> #include <string.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include "driver.h"
#include "gcvideo.h" #include "gcvideo.h"
#include "images/nesback.h" #include "images/nesback.h"
extern unsigned int SMBTimer; extern unsigned int SMBTimer;
int FDSTimer = 0;
int FDSSwitchRequested;
#define TEX_WIDTH 256 #define TEX_WIDTH 256
#define TEX_HEIGHT 512 #define TEX_HEIGHT 512
@ -58,6 +62,29 @@ static void copy_to_xfb() {
copynow = GX_FALSE; copynow = GX_FALSE;
} }
SMBTimer++; SMBTimer++;
// FDS switch disk requested - need to eject, select, and insert
// but not all at once!
if(FDSSwitchRequested)
{
switch(FDSSwitchRequested)
{
case 1:
FCEUI_FDSEject(); // eject disk
FDSSwitchRequested++;
break;
case 2:
if(FDSTimer > 30)
{
FCEUI_FDSSelect(); // select other side
FCEUI_FDSInsert(0); // insert disk
FDSSwitchRequested = 0;
FDSTimer = 0;
}
break;
}
FDSTimer++;
}
} }
/**************************************************************************** /****************************************************************************

View File

@ -26,5 +26,6 @@ struct st_palettes {
}; };
extern struct st_palettes palettes[]; extern struct st_palettes palettes[];
extern int FDSSwitchRequested;
#endif #endif

View File

@ -22,6 +22,7 @@
#include "menu.h" #include "menu.h"
#include "fceustate.h" #include "fceustate.h"
#include "fceuram.h" #include "fceuram.h"
#include "gcvideo.h"
#include "filesel.h" #include "filesel.h"
extern bool romLoaded; extern bool romLoaded;
@ -367,9 +368,8 @@ unsigned char DecodeJoy( unsigned short pad )
} }
#endif #endif
/*** Report pressed buttons (gamepads) ***/ // Report pressed buttons (gamepads)
int i; int i;
for (i = 0; i < MAXJP; i++) for (i = 0; i < MAXJP; i++)
{ {
if ( (jp & gcpadmap[i]) // gamecube controller if ( (jp & gcpadmap[i]) // gamecube controller
@ -379,25 +379,30 @@ unsigned char DecodeJoy( unsigned short pad )
|| ( (exp_type == WPAD_EXP_NUNCHUK) && (wp & ncpadmap[i]) ) // nunchuk + wiimote || ( (exp_type == WPAD_EXP_NUNCHUK) && (wp & ncpadmap[i]) ) // nunchuk + wiimote
#endif #endif
) )
{
// if zapper is on, ignore all buttons except START and SELECT
if(!GCSettings.zapper || nespadmap[i] == JOY_START || nespadmap[i] == JOY_SELECT)
{ {
if(nespadmap[i] > 0) if(nespadmap[i] > 0)
{
J |= nespadmap[i]; J |= nespadmap[i];
}
else else
{ {
if(nesGameType == 4) // FDS if(nesGameType == 4) // FDS
{ {
/* these commands shouldn't be issued in parallel but this /* the commands shouldn't be issued in parallel so
* allows us to only map one button for both! * we'll delay them so the virtual FDS has a chance
* the gamer must just have to press the button twice */ * to process them
FCEUI_FDSInsert(0); // eject / insert disk */
FCEUI_FDSSelect(); // select other side FDSSwitchRequested = 1;
} }
else else
FCEUI_VSUniCoin(); // insert coin for VS Games FCEUI_VSUniCoin(); // insert coin for VS Games
} }
} }
} }
}
// zapper enabled // zapper enabled
if(GCSettings.zapper) if(GCSettings.zapper)
{ {
@ -418,6 +423,16 @@ unsigned char DecodeJoy( unsigned short pad )
myzappers[z][2] |= 2; myzappers[z][2] |= 2;
} }
// VS zapper games
if ( (jp & PAD_BUTTON_B) // gamecube controller
#ifdef HW_RVL
|| (wp & WPAD_BUTTON_1) // wiimote
#endif
)
{
FCEUI_VSUniCoin(); // insert coin for VS zapper games
}
// cursor position // cursor position
UpdateCursorPosition(0); // update cursor for wiimote 1 UpdateCursorPosition(0); // update cursor for wiimote 1
myzappers[z][0] = pos_x; myzappers[z][0] = pos_x;