mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-24 03:29:22 +01:00
add DI_Close, controller reset
This commit is contained in:
parent
37632bdc58
commit
2bfce2dd57
@ -58,110 +58,138 @@ static int cursor_y[5] = {0,0,0,0,0};
|
||||
int scopeTurbo = 0; // tracks whether superscope turbo is on or off
|
||||
u32 btnmap[4][4][12]; // button mapping
|
||||
|
||||
void ResetControls()
|
||||
void ResetControls(int consoleCtrl, int wiiCtrl)
|
||||
{
|
||||
memset(btnmap, 0, sizeof(btnmap));
|
||||
|
||||
int i;
|
||||
/*** Gamecube controller Padmap ***/
|
||||
i=0;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_X;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_Y;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_L;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_R;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_UP;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_DOWN;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_LEFT;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_RIGHT;
|
||||
if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_GCPAD))
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_X;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_Y;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_L;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_R;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_UP;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_DOWN;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_LEFT;
|
||||
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_RIGHT;
|
||||
}
|
||||
|
||||
/*** Wiimote Padmap ***/
|
||||
i=0;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_2;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_1;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0x0000;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0x0000;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_RIGHT;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_LEFT;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_UP;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN;
|
||||
if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_WIIMOTE))
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_2;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_1;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0x0000;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0x0000;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_RIGHT;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_LEFT;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_UP;
|
||||
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN;
|
||||
}
|
||||
|
||||
/*** Classic Controller Padmap ***/
|
||||
i=0;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_A;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_B;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_X;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_Y;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_L;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_R;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_PLUS;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_MINUS;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_UP;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_DOWN;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_LEFT;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_RIGHT;
|
||||
if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_CLASSIC))
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_A;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_B;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_X;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_Y;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_L;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_R;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_PLUS;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_MINUS;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_UP;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_DOWN;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_LEFT;
|
||||
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_RIGHT;
|
||||
}
|
||||
|
||||
/*** Nunchuk + wiimote Padmap ***/
|
||||
i=0;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_A;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_B;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_C;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_Z;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_2;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_1;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_PLUS;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_MINUS;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_UP;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_DOWN;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_LEFT;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_RIGHT;
|
||||
if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_NUNCHUK))
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_A;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_B;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_C;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_Z;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_2;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_1;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_PLUS;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_MINUS;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_UP;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_DOWN;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_LEFT;
|
||||
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_RIGHT;
|
||||
}
|
||||
|
||||
/*** Superscope : GC controller button mapping ***/
|
||||
i=0;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_Y;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_X;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
|
||||
if(consoleCtrl == 0 || (consoleCtrl == CTRL_SCOPE && wiiCtrl == CTRLR_GCPAD))
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_Y;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_X;
|
||||
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
|
||||
}
|
||||
|
||||
/*** Superscope : wiimote button mapping ***/
|
||||
i=0;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_UP;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
|
||||
if(consoleCtrl == 0 || (consoleCtrl == CTRL_SCOPE && wiiCtrl == CTRLR_WIIMOTE))
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_UP;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN;
|
||||
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
|
||||
}
|
||||
|
||||
/*** Mouse : GC controller button mapping ***/
|
||||
i=0;
|
||||
btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||
btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||
if(consoleCtrl == 0 || (consoleCtrl == CTRL_MOUSE && wiiCtrl == CTRLR_GCPAD))
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||
btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||
}
|
||||
|
||||
/*** Mouse : wiimote button mapping ***/
|
||||
i=0;
|
||||
btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||
btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||
if(consoleCtrl == 0 || (consoleCtrl == CTRL_MOUSE && wiiCtrl == CTRLR_WIIMOTE))
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||
btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||
}
|
||||
|
||||
/*** Justifier : GC controller button mapping ***/
|
||||
i=0;
|
||||
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
|
||||
if(consoleCtrl == 0 || (consoleCtrl == CTRL_JUST && wiiCtrl == CTRLR_GCPAD))
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
|
||||
}
|
||||
|
||||
/*** Justifier : wiimote button mapping ***/
|
||||
i=0;
|
||||
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
|
||||
if(consoleCtrl == 0 || (consoleCtrl == CTRL_JUST && wiiCtrl == CTRLR_WIIMOTE))
|
||||
{
|
||||
i=0;
|
||||
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HW_RVL
|
||||
|
@ -24,7 +24,7 @@
|
||||
extern u32 btnmap[4][4][12];
|
||||
extern int rumbleRequest[4];
|
||||
|
||||
void ResetControls();
|
||||
void ResetControls(int cc = 0, int wc = 0);
|
||||
void ShutoffRumble();
|
||||
void DoRumble(int i);
|
||||
s8 WPAD_Stick(u8 chan, u8 right, int axis);
|
||||
|
@ -331,6 +331,7 @@ main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
#ifdef HW_RVL
|
||||
DI_Close(); // fixes some black screen issues
|
||||
DI_Init(); // first
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user