mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
fix oversight regarding hotkey joystick buttons. also prevent triggering the lid command a billion times in a row with a joystick button.
This commit is contained in:
@ -126,7 +126,7 @@ ConfigEntry ConfigFile[] =
|
|||||||
|
|
||||||
{"SavStaRelocSRAM", 0, &SavestateRelocSRAM, 1, NULL, 0},
|
{"SavStaRelocSRAM", 0, &SavestateRelocSRAM, 1, NULL, 0},
|
||||||
|
|
||||||
{"AudioVolume", 0, &AudioVolume, 255, NULL, 0},
|
{"AudioVolume", 0, &AudioVolume, 256, NULL, 0},
|
||||||
{"MicInputType", 0, &MicInputType, 1, NULL, 0},
|
{"MicInputType", 0, &MicInputType, 1, NULL, 0},
|
||||||
{"MicWavPath", 1, MicWavPath, 0, "", 511},
|
{"MicWavPath", 1, MicWavPath, 0, "", 511},
|
||||||
|
|
||||||
|
@ -299,6 +299,8 @@ void MicCallback(void* data, Uint8* stream, int len)
|
|||||||
|
|
||||||
bool JoyButtonPressed(int btnid, int njoybuttons, Uint8* joybuttons, Uint32 hat)
|
bool JoyButtonPressed(int btnid, int njoybuttons, Uint8* joybuttons, Uint32 hat)
|
||||||
{
|
{
|
||||||
|
if (btnid < 0) return false;
|
||||||
|
|
||||||
bool pressed;
|
bool pressed;
|
||||||
if (btnid == 0x101) // up
|
if (btnid == 0x101) // up
|
||||||
pressed = (hat & SDL_HAT_UP);
|
pressed = (hat & SDL_HAT_UP);
|
||||||
@ -393,6 +395,8 @@ int EmuThreadFunc(void* burp)
|
|||||||
LidStatus = false;
|
LidStatus = false;
|
||||||
MicCommand = 0;
|
MicCommand = 0;
|
||||||
|
|
||||||
|
bool lastlidcmd = false;
|
||||||
|
|
||||||
Uint8* joybuttons = NULL; int njoybuttons = 0;
|
Uint8* joybuttons = NULL; int njoybuttons = 0;
|
||||||
if (Joystick)
|
if (Joystick)
|
||||||
{
|
{
|
||||||
@ -430,10 +434,7 @@ int EmuThreadFunc(void* burp)
|
|||||||
|
|
||||||
for (int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
int btnid = Config::JoyMapping[i];
|
bool pressed = JoyButtonPressed(Config::JoyMapping[i], njoybuttons, joybuttons, hat);
|
||||||
if (btnid < 0) continue;
|
|
||||||
|
|
||||||
bool pressed = JoyButtonPressed(btnid, njoybuttons, joybuttons, hat);
|
|
||||||
|
|
||||||
if (i == 4) // right
|
if (i == 4) // right
|
||||||
pressed = pressed || (axisX >= 16384);
|
pressed = pressed || (axisX >= 16384);
|
||||||
@ -448,10 +449,17 @@ int EmuThreadFunc(void* burp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (JoyButtonPressed(Config::HKJoyMapping[HK_Lid], njoybuttons, joybuttons, hat))
|
if (JoyButtonPressed(Config::HKJoyMapping[HK_Lid], njoybuttons, joybuttons, hat))
|
||||||
|
{
|
||||||
|
if (!lastlidcmd)
|
||||||
{
|
{
|
||||||
LidStatus = !LidStatus;
|
LidStatus = !LidStatus;
|
||||||
LidCommand = true;
|
LidCommand = true;
|
||||||
|
lastlidcmd = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
lastlidcmd = false;
|
||||||
|
|
||||||
if (JoyButtonPressed(Config::HKJoyMapping[HK_Mic], njoybuttons, joybuttons, hat))
|
if (JoyButtonPressed(Config::HKJoyMapping[HK_Mic], njoybuttons, joybuttons, hat))
|
||||||
MicCommand |= 2;
|
MicCommand |= 2;
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user