aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl
diff options
context:
space:
mode:
authorRaphaël Zumer <rzumer@tebako.net>2019-12-11 19:21:59 -0500
committerRaphaël Zumer <rzumer@tebako.net>2019-12-18 23:35:18 -0500
commitbe19e0e8d49485d91c4106bad79daa766f7cb131 (patch)
tree52223be77a9913840a74ab20796abf8138100893 /src/libui_sdl
parent8172cbc1706874651d227ce72d213fb636e506d4 (diff)
Make solar sensor hotkeys configurable
Diffstat (limited to 'src/libui_sdl')
-rw-r--r--src/libui_sdl/DlgInputConfig.cpp6
-rw-r--r--src/libui_sdl/PlatformConfig.cpp32
-rw-r--r--src/libui_sdl/PlatformConfig.h2
-rw-r--r--src/libui_sdl/main.cpp38
4 files changed, 42 insertions, 36 deletions
diff --git a/src/libui_sdl/DlgInputConfig.cpp b/src/libui_sdl/DlgInputConfig.cpp
index a80e2ec..21394b1 100644
--- a/src/libui_sdl/DlgInputConfig.cpp
+++ b/src/libui_sdl/DlgInputConfig.cpp
@@ -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;
diff --git a/src/libui_sdl/PlatformConfig.cpp b/src/libui_sdl/PlatformConfig.cpp
index c8ec19f..a2eaab9 100644
--- a/src/libui_sdl/PlatformConfig.cpp
+++ b/src/libui_sdl/PlatformConfig.cpp
@@ -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},
-
- {"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},
+ {"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_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},
diff --git a/src/libui_sdl/PlatformConfig.h b/src/libui_sdl/PlatformConfig.h
index 842e72a..682b9bc 100644
--- a/src/libui_sdl/PlatformConfig.h
+++ b/src/libui_sdl/PlatformConfig.h
@@ -29,6 +29,8 @@ enum
HK_Reset,
HK_FastForward,
HK_FastForwardToggle,
+ HK_SolarSensorDecrease,
+ HK_SolarSensorIncrease,
HK_MAX
};
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index a96b77a..38804f6 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -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))