[Wii] added configurable menu key combo

This commit is contained in:
ekeeke 2022-11-07 19:56:03 +01:00
parent 6ec9ac2729
commit 5b7d5bfd56
6 changed files with 66 additions and 22 deletions

View File

@ -173,6 +173,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
* added configurable NTSC filter * added configurable NTSC filter
* added configurable FPS display & toggleable fast-forward key combo * added configurable FPS display & toggleable fast-forward key combo
(HOME + MINUS with Wii controllers or R TRIGGER + START with Gamecube controller) (HOME + MINUS with Wii controllers or R TRIGGER + START with Gamecube controller)
* added configurable menu key combo
* added 50hz progressive mode (576p) support for emulation * added 50hz progressive mode (576p) support for emulation
* added WiiU GamePad Controller support on vWii (Fix94) * added WiiU GamePad Controller support on vWii (Fix94)
* added support for Sega CD / Mega-CD PRG-RAM and Word-RAM cheat codes * added support for Sega CD / Mega-CD PRG-RAM and Word-RAM cheat codes

View File

@ -103,7 +103,7 @@ typedef struct
t_input_config input[MAX_INPUTS]; t_input_config input[MAX_INPUTS];
uint16 pad_keymap[4][MAX_KEYS+1]; uint16 pad_keymap[4][MAX_KEYS+1];
#ifdef HW_RVL #ifdef HW_RVL
uint32 wpad_keymap[4*3+1][MAX_KEYS]; uint32 wpad_keymap[4*3+1][MAX_KEYS+1];
uint8 autosleep; uint8 autosleep;
int32 calx; int32 calx;
int32 caly; int32 caly;

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,7 @@
* *
* Genesis Plus GX input support * Genesis Plus GX input support
* *
* Copyright Eke-Eke (2007-2019) * Copyright Eke-Eke (2007-2022)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met:
@ -784,7 +784,50 @@ static void wpad_config(u8 exp, int chan, int first_key, int last_key)
} }
} }
/* re-enable background PAD scanning and exit */ /* Configurable menu key */
GUI_MsgBoxUpdate(0,"Press key(s) for MENU");
/* reset key combo */
config.wpad_keymap[4*exp + chan][KEY_MENU] = 0;
/* wait for user input */
p = 0;
while (!p)
{
VIDEO_WaitVSync();
if (exp <= WPAD_EXP_CLASSIC)
{
WPAD_ScanPads();
p = WPAD_ButtonsHeld(chan);
}
else
{
WiiDRC_ScanPads();
p = WiiDRC_ButtonsHeld();
}
}
/* register keys until none are pressed anymore */
while (p)
{
/* update key combo */
config.wpad_keymap[4*exp + chan][KEY_MENU] |= p;
/* update WPAD status */
VIDEO_WaitVSync();
if (exp <= WPAD_EXP_CLASSIC)
{
WPAD_ScanPads();
p = WPAD_ButtonsHeld(chan);
}
else
{
WiiDRC_ScanPads();
p = WiiDRC_ButtonsHeld();
}
}
/* re-enable background WPAD scanning and exit */
inputs_disabled = 0; inputs_disabled = 0;
} }
@ -813,20 +856,15 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
p = WiiDRC_ButtonsHeld(); p = WiiDRC_ButtonsHeld();
/* Default Wii controller menu keys */ /* Default fast-forward key combo */
if (WiiDRC_ButtonsDown() & WIIDRC_BUTTON_HOME) if (WiiDRC_ButtonsDown() & WIIDRC_BUTTON_HOME)
{ {
/* Default fast-forward key combo */
if (p & WIIDRC_BUTTON_MINUS) if (p & WIIDRC_BUTTON_MINUS)
{ {
audioSync ^= AUDIO_WAIT; audioSync ^= AUDIO_WAIT;
videoSync = (audioSync && config.vsync && (gc_pal != vdp_pal)) ? VIDEO_WAIT : 0; videoSync = (audioSync && config.vsync && (gc_pal != vdp_pal)) ? VIDEO_WAIT : 0;
return; return;
} }
/* Return to emulator settings */
ConfigRequested = 1;
return;
} }
/* Left Analog Stick */ /* Left Analog Stick */
@ -847,6 +885,13 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
/* Retrieve current key mapping */ /* Retrieve current key mapping */
u32 *wpad_keymap = config.wpad_keymap[4*exp + chan]; u32 *wpad_keymap = config.wpad_keymap[4*exp + chan];
/* User configurable menu combo */
if ((p & wpad_keymap[KEY_MENU]) == wpad_keymap[KEY_MENU])
{
ConfigRequested = 1;
return;
}
/* Emulated device */ /* Emulated device */
switch (input.dev[i]) switch (input.dev[i])
{ {
@ -1351,7 +1396,6 @@ int gx_input_FindDevices(void)
return found; return found;
} }
void gx_input_SetDefault(void) void gx_input_SetDefault(void)
{ {
int i,j; int i,j;
@ -1383,6 +1427,7 @@ void gx_input_SetDefault(void)
config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_BUTTONY] = 0; config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_BUTTONY] = 0;
config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_BUTTONZ] = 0; config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_BUTTONZ] = 0;
config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_MODE] = 0; config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_MODE] = 0;
config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_MENU] = WPAD_BUTTON_HOME;
/* Wiimote + Nunchuk */ /* Wiimote + Nunchuk */
config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_BUTTONA] = WPAD_NUNCHUK_BUTTON_Z; config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_BUTTONA] = WPAD_NUNCHUK_BUTTON_Z;
@ -1393,6 +1438,7 @@ void gx_input_SetDefault(void)
config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_BUTTONY] = WPAD_BUTTON_1; config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_BUTTONY] = WPAD_BUTTON_1;
config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_BUTTONZ] = WPAD_BUTTON_2; config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_BUTTONZ] = WPAD_BUTTON_2;
config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_MODE] = WPAD_BUTTON_MINUS; config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_MODE] = WPAD_BUTTON_MINUS;
config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_MENU] = WPAD_BUTTON_HOME;
/* Classic Controller */ /* Classic Controller */
config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_BUTTONA] = WPAD_CLASSIC_BUTTON_Y; config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_BUTTONA] = WPAD_CLASSIC_BUTTON_Y;
@ -1403,6 +1449,7 @@ void gx_input_SetDefault(void)
config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_BUTTONY] = WPAD_CLASSIC_BUTTON_ZR; config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_BUTTONY] = WPAD_CLASSIC_BUTTON_ZR;
config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_BUTTONZ] = WPAD_CLASSIC_BUTTON_X; config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_BUTTONZ] = WPAD_CLASSIC_BUTTON_X;
config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_MODE] = WPAD_CLASSIC_BUTTON_MINUS; config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_MODE] = WPAD_CLASSIC_BUTTON_MINUS;
config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_MENU] = WPAD_CLASSIC_BUTTON_HOME;
/* WiiU GamePad Controller */ /* WiiU GamePad Controller */
config.wpad_keymap[4*3][KEY_BUTTONA] = WIIDRC_BUTTON_Y; config.wpad_keymap[4*3][KEY_BUTTONA] = WIIDRC_BUTTON_Y;
@ -1413,6 +1460,7 @@ void gx_input_SetDefault(void)
config.wpad_keymap[4*3][KEY_BUTTONY] = WIIDRC_BUTTON_R; config.wpad_keymap[4*3][KEY_BUTTONY] = WIIDRC_BUTTON_R;
config.wpad_keymap[4*3][KEY_BUTTONZ] = WIIDRC_BUTTON_X; config.wpad_keymap[4*3][KEY_BUTTONZ] = WIIDRC_BUTTON_X;
config.wpad_keymap[4*3][KEY_MODE] = WIIDRC_BUTTON_MINUS; config.wpad_keymap[4*3][KEY_MODE] = WIIDRC_BUTTON_MINUS;
config.wpad_keymap[4*3][KEY_MENU] = WIIDRC_BUTTON_HOME;
} }
#endif #endif
@ -1673,20 +1721,15 @@ void gx_input_UpdateEmu(void)
/* Update Wii controllers status */ /* Update Wii controllers status */
WPAD_ScanPads(); WPAD_ScanPads();
/* Default Wii controller menu keys */ /* Default fast-forward key combo */
if (WPAD_ButtonsDown(0) & (WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME)) if (WPAD_ButtonsDown(0) & (WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME))
{ {
/* Default fast-forward key combo */
if (WPAD_ButtonsHeld(0) & (WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS)) if (WPAD_ButtonsHeld(0) & (WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS))
{ {
audioSync ^= AUDIO_WAIT; audioSync ^= AUDIO_WAIT;
videoSync = (audioSync && config.vsync && (gc_pal != vdp_pal)) ? VIDEO_WAIT : 0; videoSync = (audioSync && config.vsync && (gc_pal != vdp_pal)) ? VIDEO_WAIT : 0;
return; return;
} }
/* Return to emulator settings */
ConfigRequested = 1;
return;
} }
#endif #endif

View File

@ -3,7 +3,7 @@
* *
* Genesis Plus GX input support * Genesis Plus GX input support
* *
* Copyright Eke-Eke (2007-2019) * Copyright Eke-Eke (2007-2022)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met: