add DI_Close, controller reset

This commit is contained in:
dborth 2009-06-22 19:58:18 +00:00
parent 37632bdc58
commit 2bfce2dd57
3 changed files with 113 additions and 84 deletions

View File

@ -58,12 +58,12 @@ static int cursor_y[5] = {0,0,0,0,0};
int scopeTurbo = 0; // tracks whether superscope turbo is on or off int scopeTurbo = 0; // tracks whether superscope turbo is on or off
u32 btnmap[4][4][12]; // button mapping u32 btnmap[4][4][12]; // button mapping
void ResetControls() void ResetControls(int consoleCtrl, int wiiCtrl)
{ {
memset(btnmap, 0, sizeof(btnmap));
int i; int i;
/*** Gamecube controller Padmap ***/ /*** Gamecube controller Padmap ***/
if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_GCPAD))
{
i=0; i=0;
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_A; 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_B;
@ -77,8 +77,11 @@ void ResetControls()
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_DOWN; 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_LEFT;
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_RIGHT; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_RIGHT;
}
/*** Wiimote Padmap ***/ /*** Wiimote Padmap ***/
if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_WIIMOTE))
{
i=0; i=0;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; 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_2;
@ -92,8 +95,11 @@ void ResetControls()
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_LEFT; 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_UP;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN;
}
/*** Classic Controller Padmap ***/ /*** Classic Controller Padmap ***/
if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_CLASSIC))
{
i=0; i=0;
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_A; 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_B;
@ -107,8 +113,11 @@ void ResetControls()
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_DOWN; 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_LEFT;
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_RIGHT; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_RIGHT;
}
/*** Nunchuk + wiimote Padmap ***/ /*** Nunchuk + wiimote Padmap ***/
if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_NUNCHUK))
{
i=0; i=0;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_A; 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_BUTTON_B;
@ -122,8 +131,11 @@ void ResetControls()
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_DOWN; 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_LEFT;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_RIGHT; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_RIGHT;
}
/*** Superscope : GC controller button mapping ***/ /*** Superscope : GC controller button mapping ***/
if(consoleCtrl == 0 || (consoleCtrl == CTRL_SCOPE && wiiCtrl == CTRLR_GCPAD))
{
i=0; i=0;
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_A; 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_BUTTON_B;
@ -131,8 +143,11 @@ void ResetControls()
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_Y; 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_X;
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_START; btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
}
/*** Superscope : wiimote button mapping ***/ /*** Superscope : wiimote button mapping ***/
if(consoleCtrl == 0 || (consoleCtrl == CTRL_SCOPE && wiiCtrl == CTRLR_WIIMOTE))
{
i=0; i=0;
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; 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_A;
@ -140,28 +155,41 @@ void ResetControls()
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_UP; 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_DOWN;
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS; btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
}
/*** Mouse : GC controller button mapping ***/ /*** Mouse : GC controller button mapping ***/
if(consoleCtrl == 0 || (consoleCtrl == CTRL_MOUSE && wiiCtrl == CTRLR_GCPAD))
{
i=0; i=0;
btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_A; btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_B; btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
}
/*** Mouse : wiimote button mapping ***/ /*** Mouse : wiimote button mapping ***/
if(consoleCtrl == 0 || (consoleCtrl == CTRL_MOUSE && wiiCtrl == CTRLR_WIIMOTE))
{
i=0; i=0;
btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
}
/*** Justifier : GC controller button mapping ***/ /*** Justifier : GC controller button mapping ***/
if(consoleCtrl == 0 || (consoleCtrl == CTRL_JUST && wiiCtrl == CTRLR_GCPAD))
{
i=0; i=0;
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_B; 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_A;
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_START; btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
}
/*** Justifier : wiimote button mapping ***/ /*** Justifier : wiimote button mapping ***/
if(consoleCtrl == 0 || (consoleCtrl == CTRL_JUST && wiiCtrl == CTRLR_WIIMOTE))
{
i=0; i=0;
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; 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_A;
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS; btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
}
} }
#ifdef HW_RVL #ifdef HW_RVL

View File

@ -24,7 +24,7 @@
extern u32 btnmap[4][4][12]; extern u32 btnmap[4][4][12];
extern int rumbleRequest[4]; extern int rumbleRequest[4];
void ResetControls(); void ResetControls(int cc = 0, int wc = 0);
void ShutoffRumble(); void ShutoffRumble();
void DoRumble(int i); void DoRumble(int i);
s8 WPAD_Stick(u8 chan, u8 right, int axis); s8 WPAD_Stick(u8 chan, u8 right, int axis);

View File

@ -331,6 +331,7 @@ main(int argc, char *argv[])
#endif #endif
#ifdef HW_RVL #ifdef HW_RVL
DI_Close(); // fixes some black screen issues
DI_Init(); // first DI_Init(); // first
#endif #endif