fix zapper crash bug

This commit is contained in:
dborth 2008-10-03 23:31:17 +00:00
parent 51956d16da
commit 10383c8fbe
3 changed files with 15 additions and 15 deletions

View File

@ -681,20 +681,20 @@ ConfigureControllers ()
{ {
case 0: // four score case 0: // four score
GCSettings.FSDisable ^= 1; GCSettings.FSDisable ^= 1;
ToggleFourScore(GCSettings.FSDisable); ToggleFourScore(GCSettings.FSDisable, romLoaded);
break; break;
case 1: // zapper case 1: // zapper
GCSettings.zapper -= 1; // we do this so Port 2 is first option shown GCSettings.zapper -= 1; // we do this so Port 2 is first option shown
if(GCSettings.zapper < 0) if(GCSettings.zapper < 0)
GCSettings.zapper = 2; GCSettings.zapper = 2;
ToggleZapper(GCSettings.zapper); ToggleZapper(GCSettings.zapper, romLoaded);
break; break;
case 2: // zapper crosshair case 2: // zapper crosshair
GCSettings.crosshair ^= 1; GCSettings.crosshair ^= 1;
break; break;
case 3: case 3:
/*** Configure Nunchuk ***/ /*** Configure Nunchuk ***/
ConfigureButtons (CTRLR_NUNCHUK); ConfigureButtons (CTRLR_NUNCHUK);

View File

@ -42,7 +42,7 @@ unsigned int gcpadmap[] = {
PAD_TRIGGER_L, PAD_TRIGGER_R, PAD_TRIGGER_L, PAD_TRIGGER_R,
PAD_BUTTON_UP, PAD_BUTTON_DOWN, PAD_BUTTON_UP, PAD_BUTTON_DOWN,
PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT, PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT,
PAD_TRIGGER_Z // insert coin for VS games PAD_TRIGGER_Z
}; };
/*** Wiimote Padmap ***/ /*** Wiimote Padmap ***/
unsigned int wmpadmap[] = { unsigned int wmpadmap[] = {
@ -50,7 +50,7 @@ unsigned int wmpadmap[] = {
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS, WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT,
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN, WPAD_BUTTON_UP, WPAD_BUTTON_DOWN,
WPAD_BUTTON_A // insert coin for VS games WPAD_BUTTON_A
}; };
/*** Classic Controller Padmap ***/ /*** Classic Controller Padmap ***/
unsigned int ccpadmap[] = { unsigned int ccpadmap[] = {
@ -58,7 +58,7 @@ unsigned int ccpadmap[] = {
WPAD_CLASSIC_BUTTON_MINUS, WPAD_CLASSIC_BUTTON_PLUS, WPAD_CLASSIC_BUTTON_MINUS, WPAD_CLASSIC_BUTTON_PLUS,
WPAD_CLASSIC_BUTTON_UP, WPAD_CLASSIC_BUTTON_DOWN, WPAD_CLASSIC_BUTTON_UP, WPAD_CLASSIC_BUTTON_DOWN,
WPAD_CLASSIC_BUTTON_LEFT, WPAD_CLASSIC_BUTTON_RIGHT, WPAD_CLASSIC_BUTTON_LEFT, WPAD_CLASSIC_BUTTON_RIGHT,
WPAD_CLASSIC_BUTTON_A // insert coin for VS games WPAD_CLASSIC_BUTTON_A
}; };
/*** Nunchuk + wiimote Padmap ***/ /*** Nunchuk + wiimote Padmap ***/
unsigned int ncpadmap[] = { unsigned int ncpadmap[] = {
@ -66,7 +66,7 @@ unsigned int ncpadmap[] = {
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS, WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN, WPAD_BUTTON_UP, WPAD_BUTTON_DOWN,
WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT,
WPAD_BUTTON_A // insert coin for VS games WPAD_BUTTON_A
}; };
static uint32 JSReturn = 0; static uint32 JSReturn = 0;
@ -86,19 +86,19 @@ void InitialisePads()
FCEUI_SetInput(0, SI_GAMEPAD, InputDPR, 0); FCEUI_SetInput(0, SI_GAMEPAD, InputDPR, 0);
FCEUI_SetInput(1, SI_GAMEPAD, InputDPR, 0); FCEUI_SetInput(1, SI_GAMEPAD, InputDPR, 0);
ToggleFourScore(GCSettings.FSDisable); ToggleFourScore(GCSettings.FSDisable, true);
ToggleZapper(GCSettings.zapper); ToggleZapper(GCSettings.zapper, true);
} }
void ToggleFourScore(int set) void ToggleFourScore(int set, bool loaded)
{ {
if(romLoaded) if(loaded)
FCEUI_DisableFourScore(set); FCEUI_DisableFourScore(set);
} }
void ToggleZapper(int set) void ToggleZapper(int set, bool loaded)
{ {
if(romLoaded) if(loaded)
{ {
// set defaults // set defaults
zapperdata[0]=NULL; zapperdata[0]=NULL;

View File

@ -27,8 +27,8 @@ s8 WPAD_StickX(u8 chan,u8 right);
s8 WPAD_StickY(u8 chan, u8 right); s8 WPAD_StickY(u8 chan, u8 right);
void InitialisePads(); void InitialisePads();
void GetJoy(); void GetJoy();
void ToggleFourScore(int set); void ToggleFourScore(int set, bool loaded);
void ToggleZapper(int set); void ToggleZapper(int set, bool loaded);
void DrawCursor(); void DrawCursor();
#endif #endif