From 3261674819fc4ff720ec04bd3d1bcdac17dcaa4c Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Sat, 16 Nov 2024 14:25:14 +0100 Subject: [PATCH] Update Help text, default config, and clang --- src/common/config.cpp | 97 +++++++++++------------------------- src/input/input_handler.cpp | 10 ++-- src/qt_gui/kbm_help_dialog.h | 8 +-- src/qt_gui/main_window.cpp | 6 +-- 4 files changed, 42 insertions(+), 79 deletions(-) diff --git a/src/common/config.cpp b/src/common/config.cpp index ac9c5b634..1461a9ce2 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -702,82 +702,45 @@ void setDefaultValues() { } constexpr std::string_view GetDefaultKeyboardConfig() { - return R"(#This is the default keybinding config -#To change per-game configs, modify the CUSAXXXXX.ini files -#To change the default config that applies to new games without modifying already existing configs, modify default.ini -#If you don't like certain mappings, delete, change or comment them out. -#You can add any amount of KBM keybinds to a single controller input, -#but you can use each KBM keybind for one controller input. -#Every input consists of up to 3 different keys. + return R"(#Feeling lost? Check out the Help section! -#Keybinds used by the emulator (these are unchangeable): -#F12 : Trigger Renderdoc capture -#F11 : Fullscreen -#F10 : FPS counter -#Ctrl + F10 : Debug overlay -#F9 : Pause emulator, but only if the debug overlay is active -#F8 : reparse keyboard input(this) -#F7 : toggle mouse-to-joystick input -# (it overwrites everything else to that joystick, so this is required) +triangle = f +circle = space +cross = e +square = r -#This is a mapping for Bloodborne, inspired by other Souls titles on PC. +up = w, lalt +up = mousewheelup +down = s, lalt +down = mousewheeldown +left = a, lalt +left = mousewheelleft +right = d, lalt +right = mousewheelright -#Specifies which joystick the mouse movement controls. -mouse_to_joystick = right; +l1 = rightbutton, lshift +r1 = leftbutton +l2 = rightbutton +r2 = leftbutton, lshift +l3 = x +r3 = q +r3 = middlebutton -#Use healing item, change status in inventory -triangle = f; -#Dodge, back in inventory -circle = space; -#Interact, select item in inventory -cross = e; -#Use quick item, remove item in inventory -square = r; +key_toggle = i, lalt -#Emergency extra bullets -up = w, lalt; -up = mousewheelup; -#Change quick item -down = s, lalt; -down = mousewheeldown; -#Change weapon in left hand -left = a, lalt; -left = mousewheelleft; -#Change weapon in right hand -right = d, lalt; -right = mousewheelright; -#Change into 'inventory mode', so you don't have to hold the secondary key every time you go into menus -key_toggle = i, lalt; +options = escape +touchpad = g -#Menu -options = escape; -#Gestures -touchpad = g; -#Transform -l1 = rightbutton, lshift; -#Light attack -r1 = leftbutton; -#Shoot -l2 = rightbutton; -#Heavy attack -r2 = leftbutton, lshift; -#Does nothing -l3 = x; -#Center cam, lock on -r3 = q; -r3 = middlebutton; +mouse_to_joystick = right +mouse_movement_params = 1, 0.5, 0.125 -#Axis mappings -#Move -#Change to 'walk mode' by holding the following key: -#(halves the distance the inputs push the virtual joystick to a given direction) -leftjoystick_halfmode = lctrl; -axis_left_x_minus = a; -axis_left_x_plus = d; -axis_left_y_minus = w; -axis_left_y_plus = s; +leftjoystick_halfmode = lctrl +axis_left_x_minus = a +axis_left_x_plus = d +axis_left_y_minus = w +axis_left_y_plus = s )"; } std::filesystem::path GetFoolproofKbmConfigFile(const std::string& game_id) { diff --git a/src/input/input_handler.cpp b/src/input/input_handler.cpp index 58b5b1dd1..769716fd8 100644 --- a/src/input/input_handler.cpp +++ b/src/input/input_handler.cpp @@ -338,7 +338,7 @@ void ControllerOutput::AddUpdate(bool pressed, u32 param) { } } void ControllerOutput::FinalizeUpdate() { - if(!state_changed || (old_button_state == new_button_state && old_param == new_param)) { + if (!state_changed || (old_button_state == new_button_state && old_param == new_param)) { return; } old_button_state = new_button_state; @@ -434,10 +434,10 @@ bool IsInputActive(const InputBinding& i) { // Search for the current key in pressed_keys starting from the last checked position while (pressed_it != pressed_end && pressed_it->first <= key) { if (pressed_it->first == key) { - + key_found = true; flags_to_set.push_back(&pressed_it->second); - + ++pressed_it; // Move to the next key in pressed_keys break; } @@ -455,7 +455,7 @@ bool IsInputActive(const InputBinding& i) { for (bool* flag : flags_to_set) { is_fully_blocked &= *flag; } - if(is_fully_blocked) { + if (is_fully_blocked) { return false; } for (bool* flag : flags_to_set) { @@ -467,7 +467,7 @@ bool IsInputActive(const InputBinding& i) { } void ActivateOutputsFromInputs() { - + for (auto& it : pressed_keys) { it.second = false; } diff --git a/src/qt_gui/kbm_help_dialog.h b/src/qt_gui/kbm_help_dialog.h index b6bc6e086..f09a268f0 100644 --- a/src/qt_gui/kbm_help_dialog.h +++ b/src/qt_gui/kbm_help_dialog.h @@ -48,7 +48,7 @@ This project started out because I didn't like the original unchangeable keybind QString faq() { return R"(Q: What are the emulator-wide keybinds? -A: -F12: Triggers Rdoc capture +A: -F12: Triggers Renderdoc capture -F11: Toggles fullscreen -F10: Toggles FPS counter -Ctrl F10: Open the debug menu @@ -57,7 +57,7 @@ A: -F12: Triggers Rdoc capture -F7: Toggles mouse capture and mouse input Q: How do I change between mouse and controller joystick input, and why is it even required? -A: You can switch between them with F9, and it is required, because mouse input is done with polling, which means mouse movement is checked every frame, and if it didn't move, the code manually sets the emulator's virtual controller to 0 (back to the center), even if other input devices would update it. +A: You can switch between them with F7, and it is required, because mouse input is done with polling, which means mouse movement is checked every frame, and if it didn't move, the code manually sets the emulator's virtual controller to 0 (back to the center), even if other input devices would update it. Q: What happens if I accidentally make a typo in the config? A: The code recognises the line as wrong, and skip it, so the rest of the file will get parsed, but that line in question will be treated like a comment line. @@ -69,7 +69,7 @@ A: Some keys are intentionally omitted, but if you read the bindings through, an QString syntax() { return R"(This is the full list of currently supported mouse and keyboard inputs, and how to use them. -Emulator-reserved keys: F1 through F12, Insert, PrintScreen, Delete, Home, End, PgUp, PgDown +Emulator-reserved keys: F1 through F12 Syntax (aka how a line can look like): #Comment line @@ -87,7 +87,7 @@ axis_left_y_minus = w; You can make a comment line by putting # as the first character. Whitespace doesn't matter,