1
0
mirror of synced 2024-11-24 07:00:15 +01:00

Add exit keybind

This commit is contained in:
BroGamer 2022-06-20 06:57:31 +12:00
parent f473eaad5a
commit 1847ab85d8
2 changed files with 8 additions and 2 deletions

2
dist/keyconfig.toml vendored
View File

@ -1,3 +1,5 @@
EXIT = [ "ESCAPE" ]
TEST = [ "F1" ] TEST = [ "F1" ]
SERVICE = [ "F2" ] SERVICE = [ "F2" ]
DEBUG_UP = [ "UPARROW" ] DEBUG_UP = [ "UPARROW" ]

View File

@ -21,6 +21,7 @@ HOOK_DYNAMIC (i32, __stdcall, ShowMouse, i32 show) { return originalShowMouse (t
#define DRUM_HIT 20000 #define DRUM_HIT 20000
#define IF_HIT(bind) return IsButtonTapped (bind) ? DRUM_HIT : 0 #define IF_HIT(bind) return IsButtonTapped (bind) ? DRUM_HIT : 0
struct Keybindings EXIT = { .keycodes = { VK_ESCAPE } };
struct Keybindings COIN_ADD = { .keycodes = { VK_RETURN }, .buttons = { SDL_CONTROLLER_BUTTON_START } }; struct Keybindings COIN_ADD = { .keycodes = { VK_RETURN }, .buttons = { SDL_CONTROLLER_BUTTON_START } };
struct Keybindings TEST = { .keycodes = { VK_F1 } }; struct Keybindings TEST = { .keycodes = { VK_F1 } };
struct Keybindings SERVICE = { .keycodes = { VK_F2 } }; struct Keybindings SERVICE = { .keycodes = { VK_F2 } };
@ -76,6 +77,8 @@ HOOK_DYNAMIC (u16, __fastcall, GetCoin, i32 a1) {
toml_table_t *config = openConfig (configPath ("keyconfig.toml")); toml_table_t *config = openConfig (configPath ("keyconfig.toml"));
if (config) { if (config) {
SetConfigValue (config, "EXIT", &EXIT);
SetConfigValue (config, "TEST", &TEST); SetConfigValue (config, "TEST", &TEST);
SetConfigValue (config, "SERVICE", &SERVICE); SetConfigValue (config, "SERVICE", &SERVICE);
SetConfigValue (config, "DEBUG_UP", &DEBUG_UP); SetConfigValue (config, "DEBUG_UP", &DEBUG_UP);
@ -100,11 +103,12 @@ HOOK_DYNAMIC (u16, __fastcall, GetCoin, i32 a1) {
} }
UpdatePoll (windowHandle); UpdatePoll (windowHandle);
if (IsButtonTapped (COIN_ADD)) { if (IsButtonTapped (COIN_ADD))
coin_count++; coin_count++;
}
if (IsButtonTapped (TEST)) if (IsButtonTapped (TEST))
testEnabled = !testEnabled; testEnabled = !testEnabled;
if (IsButtonTapped(EXIT))
ExitProcess(0);
} }
return coin_count; return coin_count;
} }