add DI_Close, controller reset

This commit is contained in:
dborth 2009-06-22 19:57:33 +00:00
parent 7a921641b8
commit b657722e34
3 changed files with 75 additions and 56 deletions

View File

@ -221,6 +221,7 @@ int 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

View File

@ -46,7 +46,7 @@ u32 nespadmap[11]; // Original NES controller buttons
u32 zapperpadmap[11]; // Original NES Zapper controller buttons u32 zapperpadmap[11]; // Original NES Zapper controller buttons
u32 btnmap[2][4][12]; // button mapping u32 btnmap[2][4][12]; // button mapping
void ResetControls() void ResetControls(int consoleCtrl, int wiiCtrl)
{ {
int i = 0; int i = 0;
@ -66,70 +66,88 @@ void ResetControls()
nespadmap[i++] = 0; // insert coin for VS games, insert/eject/select disk for FDS nespadmap[i++] = 0; // insert coin for VS games, insert/eject/select disk for FDS
/*** Gamecube controller Padmap ***/ /*** Gamecube controller Padmap ***/
i=0; if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_GCPAD))
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_B; {
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_A; i=0;
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_Y; 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_A;
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_Y;
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_START; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_X;
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_UP; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z;
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_DOWN; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_LEFT; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_UP;
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_RIGHT; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_DOWN;
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_L; 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_TRIGGER_L;
}
/*** Wiimote Padmap ***/ /*** Wiimote Padmap ***/
i=0; if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_WIIMOTE))
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_1; {
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_2; i=0;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_1;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_2;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_RIGHT; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_LEFT; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_UP; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_RIGHT;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_LEFT;
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; 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_A;
}
/*** Classic Controller Padmap ***/ /*** Classic Controller Padmap ***/
i=0; if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_CLASSIC))
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_Y; {
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_B; i=0;
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_A; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_B;
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_MINUS; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_X;
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_PLUS; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_A;
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_UP; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_MINUS;
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_DOWN; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_PLUS;
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_LEFT; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_UP;
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_RIGHT; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_DOWN;
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_L; 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_FULL_L;
}
/*** Nunchuk + wiimote Padmap ***/ /*** Nunchuk + wiimote Padmap ***/
i=0; if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_NUNCHUK))
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_C; {
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_Z; i=0;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = 0; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_C;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = 0; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_Z;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_MINUS; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = 0;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_PLUS; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = 0;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_UP; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_MINUS;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_DOWN; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_PLUS;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_LEFT; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_UP;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_RIGHT; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_DOWN;
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_A; 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_A;
}
/*** Zapper : GC controller button mapping ***/ /*** Zapper : GC controller button mapping ***/
i=0; if(consoleCtrl == 0 || (consoleCtrl == CTRL_ZAPPER && wiiCtrl == CTRLR_GCPAD))
btnmap[CTRL_ZAPPER][CTRLR_GCPAD][i++] = PAD_BUTTON_A; // shoot {
btnmap[CTRL_ZAPPER][CTRLR_GCPAD][i++] = PAD_BUTTON_B; // insert coin i=0;
btnmap[CTRL_ZAPPER][CTRLR_GCPAD][i++] = PAD_BUTTON_A; // shoot
btnmap[CTRL_ZAPPER][CTRLR_GCPAD][i++] = PAD_BUTTON_B; // insert coin
}
/*** Zapper : wiimote button mapping ***/ /*** Zapper : wiimote button mapping ***/
i=0; if(consoleCtrl == 0 || (consoleCtrl == CTRL_ZAPPER && wiiCtrl == CTRLR_WIIMOTE))
btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; // shoot {
btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; // insert coin i=0;
btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; // shoot
btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; // insert coin
}
} }
/**************************************************************************** /****************************************************************************

View File

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