diff options
-rw-r--r-- | src/Config.h | 2 | ||||
-rw-r--r-- | src/libui_sdl/DlgInputConfig.cpp | 2 | ||||
-rw-r--r-- | src/libui_sdl/PlatformConfig.cpp | 14 | ||||
-rw-r--r-- | src/libui_sdl/PlatformConfig.h | 3 | ||||
-rw-r--r-- | src/libui_sdl/main.cpp | 43 |
5 files changed, 56 insertions, 8 deletions
diff --git a/src/Config.h b/src/Config.h index 642e9d5..363df70 100644 --- a/src/Config.h +++ b/src/Config.h @@ -26,7 +26,7 @@ namespace Config typedef struct { - char Name[16]; + char Name[32]; int Type; void* Value; int DefaultInt; diff --git a/src/libui_sdl/DlgInputConfig.cpp b/src/libui_sdl/DlgInputConfig.cpp index b77f8fe..b17f049 100644 --- a/src/libui_sdl/DlgInputConfig.cpp +++ b/src/libui_sdl/DlgInputConfig.cpp @@ -58,7 +58,7 @@ char dskeylabels[12][8] = {"A:", "B:", "Select:", "Start:", "Right:", "Left:", " int identity[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; -char hotkeylabels[HK_MAX][32] = {"Close/open lid:", "Microphone:"}; +char hotkeylabels[HK_MAX][32] = {"Close/open lid:", "Microphone:", "Fast Forward:", "Fast Forward (Toggle):"}; int openedmask; InputDlgData inputdlg[2]; diff --git a/src/libui_sdl/PlatformConfig.cpp b/src/libui_sdl/PlatformConfig.cpp index 46e502d..5708fc8 100644 --- a/src/libui_sdl/PlatformConfig.cpp +++ b/src/libui_sdl/PlatformConfig.cpp @@ -88,11 +88,15 @@ 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}, - - {"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0}, - {"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0}, + {"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], 0x0D, NULL, 0}, + {"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], 0x35, 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_FastForward", 0, &HKJoyMapping[HK_FastForward], -1, NULL, 0}, + {"HKJoy_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, NULL, 0}, {"WindowWidth", 0, &WindowWidth, 256, NULL, 0}, {"WindowHeight", 0, &WindowHeight, 384, NULL, 0}, diff --git a/src/libui_sdl/PlatformConfig.h b/src/libui_sdl/PlatformConfig.h index 013a0a7..be29c17 100644 --- a/src/libui_sdl/PlatformConfig.h +++ b/src/libui_sdl/PlatformConfig.h @@ -25,7 +25,8 @@ enum { HK_Lid = 0, HK_Mic, - + HK_FastForward, + HK_FastForwardToggle, HK_MAX }; diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index cb93294..ed5e80d 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -159,6 +159,7 @@ s16* MicWavBuffer; u32 MicCommand; +bool HotkeyFPSToggle = false; void SetupScreenRects(int width, int height); @@ -838,6 +839,27 @@ int EmuThreadFunc(void* burp) HotkeyMask |= 0x1; } + if (JoyButtonPressed(Config::HKJoyMapping[HK_FastForwardToggle], njoybuttons, joybuttons, joyhat)) + { + HotkeyFPSToggle = !HotkeyFPSToggle; + Config::LimitFPS = !Config::LimitFPS; + uiMenuItemSetChecked(MenuItem_LimitFPS, Config::LimitFPS==1); + } + + if (!HotkeyFPSToggle) // For fast forward (hold) hotkey + { + if (JoyButtonHeld(Config::HKJoyMapping[HK_FastForward], njoybuttons, joybuttons, joyhat)) + { + Config::LimitFPS = false; + uiMenuItemSetChecked(MenuItem_LimitFPS, false); + } + else if (!Config::LimitFPS) + { + Config::LimitFPS = true; + uiMenuItemSetChecked(MenuItem_LimitFPS, true); + } + } + if (JoyButtonHeld(Config::HKJoyMapping[HK_Mic], njoybuttons, joybuttons, joyhat)) MicCommand |= 2; else @@ -1126,6 +1148,19 @@ int OnAreaKeyEvent(uiAreaHandler* handler, uiArea* area, uiAreaKeyEvent* evt) if (evt->Scancode == Config::HKKeyMapping[HK_Mic]) MicCommand &= ~1; + + if (evt->Scancode == Config::HKKeyMapping[HK_FastForwardToggle]) + { + HotkeyFPSToggle = !HotkeyFPSToggle; + Config::LimitFPS = !Config::LimitFPS; + uiMenuItemSetChecked(MenuItem_LimitFPS, Config::LimitFPS==1); + } + + if (evt->Scancode == Config::HKKeyMapping[HK_FastForward] && !HotkeyFPSToggle) + { + Config::LimitFPS = true; + uiMenuItemSetChecked(MenuItem_LimitFPS, Config::LimitFPS==1); + } } else if (!evt->Repeat) { @@ -1157,6 +1192,12 @@ int OnAreaKeyEvent(uiAreaHandler* handler, uiArea* area, uiAreaKeyEvent* evt) if (evt->Scancode == Config::HKKeyMapping[HK_Mic]) MicCommand |= 1; + if (evt->Scancode == Config::HKKeyMapping[HK_FastForward] && !HotkeyFPSToggle) + { + Config::LimitFPS = false; + uiMenuItemSetChecked(MenuItem_LimitFPS, Config::LimitFPS==1); + } + if (evt->Scancode == 0x57) // F11 OSD::AddMessage(0x00FFFF, "OSD test"); //NDS::debug(0); @@ -2079,6 +2120,7 @@ void OnSetLimitFPS(uiMenuItem* item, uiWindow* window, void* blarg) int chk = uiMenuItemChecked(item); if (chk != 0) Config::LimitFPS = true; else Config::LimitFPS = false; + HotkeyFPSToggle = !Config::LimitFPS; // ensure that the hotkey toggle indicator is synced with this menu item } void ApplyNewSettings(int type) @@ -2307,6 +2349,7 @@ void CreateMainWindowMenu() uiMenuAppendSubmenu(menu, submenu); } + MenuItem_ScreenFilter = uiMenuAppendCheckItem(menu, "Screen filtering"); uiMenuItemOnClicked(MenuItem_ScreenFilter, OnSetScreenFiltering, NULL); |