From b657722e34d964986024bd6258c3c2222a65b50c Mon Sep 17 00:00:00 2001 From: dborth Date: Mon, 22 Jun 2009 19:57:33 +0000 Subject: [PATCH] add DI_Close, controller reset --- source/ngc/fceugx.cpp | 1 + source/ngc/pad.cpp | 128 ++++++++++++++++++++++++------------------ source/ngc/pad.h | 2 +- 3 files changed, 75 insertions(+), 56 deletions(-) diff --git a/source/ngc/fceugx.cpp b/source/ngc/fceugx.cpp index 0c799d3..7b3c3e2 100644 --- a/source/ngc/fceugx.cpp +++ b/source/ngc/fceugx.cpp @@ -221,6 +221,7 @@ int main(int argc, char *argv[]) #endif #ifdef HW_RVL + DI_Close(); // fixes some black screen issues DI_Init(); // first #endif diff --git a/source/ngc/pad.cpp b/source/ngc/pad.cpp index 3b65f5e..c1f9607 100644 --- a/source/ngc/pad.cpp +++ b/source/ngc/pad.cpp @@ -46,7 +46,7 @@ u32 nespadmap[11]; // Original NES controller buttons u32 zapperpadmap[11]; // Original NES Zapper controller buttons u32 btnmap[2][4][12]; // button mapping -void ResetControls() +void ResetControls(int consoleCtrl, int wiiCtrl) { int i = 0; @@ -66,70 +66,88 @@ void ResetControls() nespadmap[i++] = 0; // insert coin for VS games, insert/eject/select disk for FDS /*** Gamecube controller Padmap ***/ - i=0; - btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_B; - btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_A; - btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_Y; - btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_X; - btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z; - btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_START; - 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; - btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_L; + if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_GCPAD)) + { + i=0; + btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_B; + btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_A; + btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_Y; + btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_X; + btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z; + btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_START; + 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; + btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_L; + } /*** Wiimote Padmap ***/ - i=0; - btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_1; - btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_2; - btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0; - btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0; - btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS; - btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS; - 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; - btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; + if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_WIIMOTE)) + { + i=0; + btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_1; + btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_2; + btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0; + btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0; + btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS; + btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS; + 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; + btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; + } /*** Classic Controller Padmap ***/ - i=0; - btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_Y; - 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_A; - btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_MINUS; - btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_PLUS; - 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; - btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_L; + if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_CLASSIC)) + { + i=0; + btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_Y; + 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_A; + btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_MINUS; + btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_PLUS; + 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; + btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_L; + } /*** Nunchuk + wiimote Padmap ***/ - i=0; - 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++] = 0; - btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = 0; - btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_MINUS; - btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_PLUS; - 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; - btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_A; + if(consoleCtrl == 0 || (consoleCtrl == CTRL_PAD && wiiCtrl == CTRLR_NUNCHUK)) + { + i=0; + 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++] = 0; + btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = 0; + btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_MINUS; + btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_PLUS; + 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; + btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_A; + } /*** Zapper : GC controller button mapping ***/ - i=0; - btnmap[CTRL_ZAPPER][CTRLR_GCPAD][i++] = PAD_BUTTON_A; // shoot - btnmap[CTRL_ZAPPER][CTRLR_GCPAD][i++] = PAD_BUTTON_B; // insert coin + if(consoleCtrl == 0 || (consoleCtrl == CTRL_ZAPPER && wiiCtrl == CTRLR_GCPAD)) + { + 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 ***/ - i=0; - btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; // shoot - btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; // insert coin + if(consoleCtrl == 0 || (consoleCtrl == CTRL_ZAPPER && wiiCtrl == CTRLR_WIIMOTE)) + { + i=0; + btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; // shoot + btnmap[CTRL_ZAPPER][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; // insert coin + } } /**************************************************************************** diff --git a/source/ngc/pad.h b/source/ngc/pad.h index fab29fd..86d458f 100644 --- a/source/ngc/pad.h +++ b/source/ngc/pad.h @@ -25,7 +25,7 @@ extern int rumbleRequest[4]; extern u32 btnmap[2][4][12]; void SetControllers(); -void ResetControls(); +void ResetControls(int wc = 0, int cc = 0); void ShutoffRumble(); void DoRumble(int i); s8 WPAD_StickX(u8 chan,u8 right);