mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 21:37:42 -07:00
Make solar sensor hotkeys configurable
This commit is contained in:
parent
8172cbc170
commit
be19e0e8d4
@ -71,7 +71,9 @@ char hotkeylabels[HK_MAX][32] =
|
||||
"Pause/resume:",
|
||||
"Reset:",
|
||||
"Fast forward:",
|
||||
"Fast forward (toggle):"
|
||||
"Fast forward (toggle):",
|
||||
"Decrease sunlight (Boktai):",
|
||||
"Increase sunlight (Boktai):"
|
||||
};
|
||||
|
||||
int openedmask;
|
||||
@ -514,7 +516,7 @@ void Open(int type)
|
||||
memcpy(dlg->keymap, Config::HKKeyMapping, sizeof(int)*HK_MAX);
|
||||
memcpy(dlg->joymap, Config::HKJoyMapping, sizeof(int)*HK_MAX);
|
||||
|
||||
dlg->win = uiNewWindow("Hotkey config - melonDS", 600, 100, 0, 0, 0);
|
||||
dlg->win = uiNewWindow("Hotkey config - melonDS", 700, 100, 0, 0, 0);
|
||||
}
|
||||
|
||||
uiControl(dlg->win)->UserData = dlg;
|
||||
|
@ -93,25 +93,29 @@ ConfigEntry PlatformConfigFile[] =
|
||||
{"Joy_X", 0, &JoyMapping[10], -1, NULL, 0},
|
||||
{"Joy_Y", 0, &JoyMapping[11], -1, NULL, 0},
|
||||
|
||||
{"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], 0x0D, NULL, 0},
|
||||
{"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], 0x35, NULL, 0},
|
||||
{"HKKey_Pause", 0, &HKKeyMapping[HK_Pause], -1, NULL, 0},
|
||||
{"HKKey_Reset", 0, &HKKeyMapping[HK_Reset], -1, NULL, 0},
|
||||
{"HKKey_FastForward", 0, &HKKeyMapping[HK_FastForward], 0x0F, NULL, 0},
|
||||
{"HKKey_FastForwardToggle", 0, &HKKeyMapping[HK_FastForwardToggle], -1, NULL, 0},
|
||||
{"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], 0x0D, NULL, 0},
|
||||
{"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], 0x35, NULL, 0},
|
||||
{"HKKey_Pause", 0, &HKKeyMapping[HK_Pause], -1, NULL, 0},
|
||||
{"HKKey_Reset", 0, &HKKeyMapping[HK_Reset], -1, NULL, 0},
|
||||
{"HKKey_FastForward", 0, &HKKeyMapping[HK_FastForward], 0x0F, NULL, 0},
|
||||
{"HKKey_FastForwardToggle", 0, &HKKeyMapping[HK_FastForwardToggle], -1, NULL, 0},
|
||||
{"HKKey_SolarSensorDecrease", 0, &HKKeyMapping[HK_SolarSensorDecrease], 0x4B, NULL, 0},
|
||||
{"HKKey_SolarSensorIncrease", 0, &HKKeyMapping[HK_SolarSensorIncrease], 0x4D, NULL, 0},
|
||||
|
||||
{"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0},
|
||||
{"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0},
|
||||
{"HKJoy_Pause", 0, &HKJoyMapping[HK_Pause], -1, NULL, 0},
|
||||
{"HKJoy_Reset", 0, &HKJoyMapping[HK_Reset], -1, NULL, 0},
|
||||
{"HKJoy_FastForward", 0, &HKJoyMapping[HK_FastForward], -1, NULL, 0},
|
||||
{"HKJoy_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, NULL, 0},
|
||||
{"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0},
|
||||
{"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0},
|
||||
{"HKJoy_Pause", 0, &HKJoyMapping[HK_Pause], -1, NULL, 0},
|
||||
{"HKJoy_Reset", 0, &HKJoyMapping[HK_Reset], -1, NULL, 0},
|
||||
{"HKJoy_FastForward", 0, &HKJoyMapping[HK_FastForward], -1, NULL, 0},
|
||||
{"HKJoy_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, NULL, 0},
|
||||
{"HKJoy_SolarSensorDecrease", 0, &HKJoyMapping[HK_SolarSensorDecrease], -1, NULL, 0},
|
||||
{"HKJoy_SolarSensorIncrease", 0, &HKJoyMapping[HK_SolarSensorIncrease], -1, NULL, 0},
|
||||
|
||||
{"JoystickID", 0, &JoystickID, 0, NULL, 0},
|
||||
|
||||
{"WindowWidth", 0, &WindowWidth, 256, NULL, 0},
|
||||
{"WindowHeight", 0, &WindowHeight, 384, NULL, 0},
|
||||
{"WindowMax", 0, &WindowMaximized, 0, NULL, 0},
|
||||
{"WindowMax", 0, &WindowMaximized, 0, NULL, 0},
|
||||
|
||||
{"ScreenRotation", 0, &ScreenRotation, 0, NULL, 0},
|
||||
{"ScreenGap", 0, &ScreenGap, 0, NULL, 0},
|
||||
|
@ -29,6 +29,8 @@ enum
|
||||
HK_Reset,
|
||||
HK_FastForward,
|
||||
HK_FastForwardToggle,
|
||||
HK_SolarSensorDecrease,
|
||||
HK_SolarSensorIncrease,
|
||||
HK_MAX
|
||||
};
|
||||
|
||||
|
@ -949,6 +949,24 @@ int EmuThreadFunc(void* burp)
|
||||
if (HotkeyPressed(HK_Pause)) uiQueueMain(TogglePause, NULL);
|
||||
if (HotkeyPressed(HK_Reset)) uiQueueMain(Reset, NULL);
|
||||
|
||||
if (GBACart::CartInserted && GBACart::HasSolarSensor)
|
||||
{
|
||||
if (HotkeyPressed(HK_SolarSensorDecrease))
|
||||
{
|
||||
if (GBACart_SolarSensor::LightLevel > 0) GBACart_SolarSensor::LightLevel--;
|
||||
char msg[64];
|
||||
sprintf(msg, "Solar sensor level set to %d", GBACart_SolarSensor::LightLevel);
|
||||
OSD::AddMessage(0, msg);
|
||||
}
|
||||
if (HotkeyPressed(HK_SolarSensorIncrease))
|
||||
{
|
||||
if (GBACart_SolarSensor::LightLevel < 10) GBACart_SolarSensor::LightLevel++;
|
||||
char msg[64];
|
||||
sprintf(msg, "Solar sensor level set to %d", GBACart_SolarSensor::LightLevel);
|
||||
OSD::AddMessage(0, msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (EmuRunning == 1)
|
||||
{
|
||||
EmuStatus = 1;
|
||||
@ -1292,26 +1310,6 @@ int OnAreaKeyEvent(uiAreaHandler* handler, uiArea* area, uiAreaKeyEvent* evt)
|
||||
{
|
||||
if (evt->Modifiers == 0x0) UndoStateLoad();
|
||||
}
|
||||
else if (evt->Scancode == 0x4B) // Keypad left
|
||||
{
|
||||
if (GBACart::CartInserted && GBACart::HasSolarSensor)
|
||||
{
|
||||
if (GBACart_SolarSensor::LightLevel > 0) GBACart_SolarSensor::LightLevel--;
|
||||
char msg[64];
|
||||
sprintf(msg, "Solar sensor level set to %d", GBACart_SolarSensor::LightLevel);
|
||||
OSD::AddMessage(0, msg);
|
||||
}
|
||||
}
|
||||
else if (evt->Scancode == 0x4D) // Keypad right
|
||||
{
|
||||
if (GBACart::CartInserted && GBACart::HasSolarSensor)
|
||||
{
|
||||
if (GBACart_SolarSensor::LightLevel < 10) GBACart_SolarSensor::LightLevel++;
|
||||
char msg[64];
|
||||
sprintf(msg, "Solar sensor level set to %d", GBACart_SolarSensor::LightLevel);
|
||||
OSD::AddMessage(0, msg);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
if (EventMatchesKey(evt, Config::KeyMapping[i], false))
|
||||
|
Loading…
Reference in New Issue
Block a user