mirror of
https://github.com/dborth/fceugx.git
synced 2024-10-31 22:45:05 +01:00
restore zapper fix from liuhb86 -
https://github.com/dborth/fceugx/pull/347
This commit is contained in:
parent
a5eeb6fc02
commit
69308ec1a3
@ -464,6 +464,58 @@ static unsigned char DecodeJoy(unsigned short chan)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool zapper_triggered = false;
|
||||
// zapper enabled
|
||||
if(GCSettings.Controller == CTRL_ZAPPER)
|
||||
{
|
||||
int z; // NES port # (0 or 1)
|
||||
|
||||
if(GameInfo->type == GIT_VSUNI)
|
||||
z = 0;
|
||||
else
|
||||
z = 1;
|
||||
|
||||
myzappers[z][2] = 0; // reset trigger to not pressed
|
||||
|
||||
// is trigger pressed?
|
||||
if ( (jp & btnmap[CTRL_ZAPPER][CTRLR_GCPAD][0]) // gamecube controller
|
||||
#ifdef HW_RVL
|
||||
|| ( (exp_type == WPAD_EXP_NONE) && (wp & btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][0]) ) // wiimote
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// report trigger press
|
||||
myzappers[z][2] |= 2;
|
||||
zapper_triggered = true;
|
||||
}
|
||||
|
||||
// VS zapper games
|
||||
if ( (jp & btnmap[CTRL_ZAPPER][CTRLR_GCPAD][1]) // gamecube controller
|
||||
#ifdef HW_RVL
|
||||
|| ( (exp_type == WPAD_EXP_NONE) && (wp & btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][1]) ) // wiimote
|
||||
#endif
|
||||
)
|
||||
{
|
||||
FCEUI_VSUniCoin(); // insert coin for VS zapper games
|
||||
zapper_triggered = true;
|
||||
}
|
||||
|
||||
// cursor position
|
||||
int channel = 0; // by default, use wiimote 1
|
||||
#ifdef HW_RVL
|
||||
if (userInput[1].wpad->ir.valid)
|
||||
{
|
||||
channel = 1; // if wiimote 2 is connected, use wiimote 2 as zapper
|
||||
}
|
||||
#endif
|
||||
UpdateCursorPosition(channel); // update cursor for wiimote
|
||||
myzappers[z][0] = pos_x;
|
||||
myzappers[z][1] = pos_y;
|
||||
|
||||
// Report changes to FCE Ultra
|
||||
zapperdata[z]->Update(z,myzappers[z],0);
|
||||
}
|
||||
|
||||
// Report pressed buttons (gamepads)
|
||||
int i;
|
||||
for (i = 0; i < MAXJP; i++)
|
||||
@ -478,7 +530,7 @@ static unsigned char DecodeJoy(unsigned short chan)
|
||||
)
|
||||
{
|
||||
// if zapper is on, ignore all buttons except START and SELECT
|
||||
if(GCSettings.Controller != CTRL_ZAPPER || nespadmap[i] == JOY_START || nespadmap[i] == JOY_SELECT)
|
||||
if (!zapper_triggered)
|
||||
{
|
||||
if(rapidAlternator && nespadmap[i] == RAPID_A)
|
||||
{
|
||||
@ -512,48 +564,6 @@ static unsigned char DecodeJoy(unsigned short chan)
|
||||
}
|
||||
}
|
||||
|
||||
// zapper enabled
|
||||
if(GCSettings.Controller == CTRL_ZAPPER)
|
||||
{
|
||||
int z; // NES port # (0 or 1)
|
||||
|
||||
if(GameInfo->type == GIT_VSUNI)
|
||||
z = 0;
|
||||
else
|
||||
z = 1;
|
||||
|
||||
myzappers[z][2] = 0; // reset trigger to not pressed
|
||||
|
||||
// is trigger pressed?
|
||||
if ( (jp & btnmap[CTRL_ZAPPER][CTRLR_GCPAD][0]) // gamecube controller
|
||||
#ifdef HW_RVL
|
||||
|| ( (exp_type == WPAD_EXP_NONE) && (wp & btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][0]) ) // wiimote
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// report trigger press
|
||||
myzappers[z][2] |= 2;
|
||||
}
|
||||
|
||||
// VS zapper games
|
||||
if ( (jp & btnmap[CTRL_ZAPPER][CTRLR_GCPAD][1]) // gamecube controller
|
||||
#ifdef HW_RVL
|
||||
|| ( (exp_type == WPAD_EXP_NONE) && (wp & btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][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;
|
||||
myzappers[z][1] = pos_y;
|
||||
|
||||
// Report changes to FCE Ultra
|
||||
zapperdata[z]->Update(z,myzappers[z],0);
|
||||
}
|
||||
|
||||
return J;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user