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 <wiiuse/wpad.h>
#include "driver.h"
#include "gcvideo.h"
#include "images/nesback.h"
extern unsigned int SMBTimer;
int FDSTimer = 0;
int FDSSwitchRequested;
#define TEX_WIDTH 256
#define TEX_HEIGHT 512
@ -58,6 +62,29 @@ static void copy_to_xfb() {
copynow = GX_FALSE;
}
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 int FDSSwitchRequested;
#endif

View File

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