mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-12-02 15:34:20 +01:00
Add a B/1 button press to cancel the button remapping prompt (#1037)
* Add B/1 button press to cancel button remapping * Add another nunchuck case and omit a couple unused cases
This commit is contained in:
parent
c1bbda273b
commit
9b3eccf8a2
@ -95,6 +95,7 @@ static char progressTitle[101];
|
|||||||
static char progressMsg[201];
|
static char progressMsg[201];
|
||||||
static int progressDone = 0;
|
static int progressDone = 0;
|
||||||
static int progressTotal = 0;
|
static int progressTotal = 0;
|
||||||
|
static bool buttonMappingCancelled = false;
|
||||||
|
|
||||||
u8 * bg_music;
|
u8 * bg_music;
|
||||||
u32 bg_music_size;
|
u32 bg_music_size;
|
||||||
@ -2919,7 +2920,8 @@ ButtonMappingWindow()
|
|||||||
|
|
||||||
u32 pressed = 0;
|
u32 pressed = 0;
|
||||||
|
|
||||||
while(pressed == 0)
|
buttonMappingCancelled = false;
|
||||||
|
while(pressed == 0 && !buttonMappingCancelled)
|
||||||
{
|
{
|
||||||
usleep(THREAD_SLEEP);
|
usleep(THREAD_SLEEP);
|
||||||
|
|
||||||
@ -2935,10 +2937,22 @@ ButtonMappingWindow()
|
|||||||
|
|
||||||
if(userInput[0].wpad->btns_d == WPAD_BUTTON_HOME)
|
if(userInput[0].wpad->btns_d == WPAD_BUTTON_HOME)
|
||||||
pressed = WPAD_BUTTON_HOME;
|
pressed = WPAD_BUTTON_HOME;
|
||||||
|
|
||||||
|
if(userInput[0].wpad->btns_d & WPAD_CLASSIC_BUTTON_B ||
|
||||||
|
userInput[0].wpad->btns_d & WPAD_BUTTON_B ||
|
||||||
|
userInput[0].wpad->btns_d & WPAD_BUTTON_1 ||
|
||||||
|
userInput[0].wiidrcdata.btns_d & WIIDRC_BUTTON_B)
|
||||||
|
buttonMappingCancelled = true;
|
||||||
}
|
}
|
||||||
else if(mapMenuCtrl == CTRLR_WIIDRC)
|
else if(mapMenuCtrl == CTRLR_WIIDRC)
|
||||||
{
|
{
|
||||||
pressed = userInput[0].wiidrcdata.btns_d;
|
pressed = userInput[0].wiidrcdata.btns_d;
|
||||||
|
|
||||||
|
if(userInput[0].wpad->btns_d & WPAD_CLASSIC_BUTTON_B ||
|
||||||
|
userInput[0].wpad->btns_d & WPAD_BUTTON_B ||
|
||||||
|
userInput[0].wpad->btns_d & WPAD_BUTTON_1 ||
|
||||||
|
userInput[0].pad.btns_d & PAD_BUTTON_B)
|
||||||
|
buttonMappingCancelled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2952,24 +2966,47 @@ ButtonMappingWindow()
|
|||||||
case CTRLR_WIIMOTE:
|
case CTRLR_WIIMOTE:
|
||||||
if(pressed > 0x1000)
|
if(pressed > 0x1000)
|
||||||
pressed = 0; // not a valid input
|
pressed = 0; // not a valid input
|
||||||
|
if(userInput[0].pad.btns_d & PAD_BUTTON_B ||
|
||||||
|
userInput[0].wiidrcdata.btns_d & WIIDRC_BUTTON_B ||
|
||||||
|
userInput[0].wpad->btns_d & WPAD_CLASSIC_BUTTON_B)
|
||||||
|
buttonMappingCancelled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTRLR_CLASSIC:
|
case CTRLR_CLASSIC:
|
||||||
if(userInput[0].wpad->exp.type != WPAD_EXP_CLASSIC && userInput[0].wpad->exp.classic.type < 2)
|
if(userInput[0].wpad->exp.type != WPAD_EXP_CLASSIC && userInput[0].wpad->exp.classic.type < 2)
|
||||||
pressed = 0; // not a valid input
|
pressed = 0; // not a valid input
|
||||||
|
else if(userInput[0].wpad->exp.type == WPAD_EXP_NUNCHUK)
|
||||||
|
pressed = 0; // not a valid input (Nunchuk Z/C is assigned as Classic Controller Up/Left for some reason)
|
||||||
else if(pressed <= 0x1000)
|
else if(pressed <= 0x1000)
|
||||||
pressed = 0;
|
pressed = 0;
|
||||||
|
if(userInput[0].pad.btns_d & PAD_BUTTON_B ||
|
||||||
|
userInput[0].wiidrcdata.btns_d & WIIDRC_BUTTON_B ||
|
||||||
|
userInput[0].wpad->btns_d & WPAD_BUTTON_B ||
|
||||||
|
userInput[0].wpad->btns_d & WPAD_BUTTON_1)
|
||||||
|
buttonMappingCancelled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTRLR_WUPC:
|
case CTRLR_WUPC:
|
||||||
if(userInput[0].wpad->exp.type != WPAD_EXP_CLASSIC && userInput[0].wpad->exp.classic.type == 2)
|
if(userInput[0].wpad->exp.type != WPAD_EXP_CLASSIC && userInput[0].wpad->exp.classic.type == 2)
|
||||||
pressed = 0; // not a valid input
|
pressed = 0; // not a valid input
|
||||||
else if(pressed <= 0x1000)
|
else if(pressed <= 0x1000)
|
||||||
pressed = 0;
|
pressed = 0;
|
||||||
|
if(userInput[0].pad.btns_d & PAD_BUTTON_B ||
|
||||||
|
userInput[0].wiidrcdata.btns_d & WIIDRC_BUTTON_B ||
|
||||||
|
userInput[0].wpad->btns_d & WPAD_BUTTON_B ||
|
||||||
|
userInput[0].wpad->btns_d & WPAD_BUTTON_1)
|
||||||
|
buttonMappingCancelled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTRLR_NUNCHUK:
|
case CTRLR_NUNCHUK:
|
||||||
if(userInput[0].wpad->exp.type != WPAD_EXP_NUNCHUK)
|
if(userInput[0].wpad->exp.type != WPAD_EXP_NUNCHUK)
|
||||||
pressed = 0; // not a valid input
|
pressed = 0; // not a valid input
|
||||||
|
if((userInput[0].wpad->exp.type != WPAD_EXP_NUNCHUK && userInput[0].wpad->btns_d & WPAD_BUTTON_B) ||
|
||||||
|
(userInput[0].wpad->exp.type != WPAD_EXP_NUNCHUK && userInput[0].wpad->btns_d & WPAD_BUTTON_1) ||
|
||||||
|
userInput[0].pad.btns_d & PAD_BUTTON_B ||
|
||||||
|
userInput[0].wiidrcdata.btns_d & WIIDRC_BUTTON_B ||
|
||||||
|
userInput[0].wpad->btns_d & WPAD_CLASSIC_BUTTON_B)
|
||||||
|
buttonMappingCancelled = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3138,8 +3175,13 @@ static int MenuSettingsMappingsMap()
|
|||||||
|
|
||||||
if(ret >= 0)
|
if(ret >= 0)
|
||||||
{
|
{
|
||||||
// get a button selection from user
|
int buttonPressed = ButtonMappingWindow();
|
||||||
btnmap[mapMenuCtrlSNES][mapMenuCtrl][ret] = ButtonMappingWindow();
|
|
||||||
|
if (!buttonMappingCancelled)
|
||||||
|
{
|
||||||
|
// get a button selection from user if the remap wasn't cancelled
|
||||||
|
btnmap[mapMenuCtrlSNES][mapMenuCtrl][ret] = buttonPressed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ret >= 0 || firstRun)
|
if(ret >= 0 || firstRun)
|
||||||
|
Loading…
Reference in New Issue
Block a user