Skip to content

Commit

Permalink
Update Help text, default config, and clang
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaposfos13 committed Nov 16, 2024
1 parent 3466de0 commit 3261674
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 87 deletions.
113 changes: 38 additions & 75 deletions src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#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)
#This is a mapping for Bloodborne, inspired by other Souls titles on PC.
#Specifies which joystick the mouse movement controls.
mouse_to_joystick = right;
#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;
#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;
#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;
#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;
return R"(#Feeling lost? Check out the Help section!
triangle = f
circle = space
cross = e
square = r
up = w, lalt
up = mousewheelup
down = s, lalt
down = mousewheeldown
left = a, lalt
left = mousewheelleft
right = d, lalt
right = mousewheelright
l1 = rightbutton, lshift
r1 = leftbutton
l2 = rightbutton
r2 = leftbutton, lshift
l3 = x
r3 = q
r3 = middlebutton
key_toggle = i, lalt
options = escape
touchpad = g
mouse_to_joystick = right
mouse_movement_params = 1, 0.5, 0.125
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) {
Expand Down
10 changes: 5 additions & 5 deletions src/input/input_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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) {
Expand All @@ -467,7 +467,7 @@ bool IsInputActive(const InputBinding& i) {
}

void ActivateOutputsFromInputs() {

for (auto& it : pressed_keys) {
it.second = false;
}
Expand Down
8 changes: 4 additions & 4 deletions src/qt_gui/kbm_help_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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, <button>=<key>; is just as valid as <button> = <key>;
';' at the ends of lines is also optional.d
';' at the ends of lines is also optional.
)";
}
QString bindings() {
Expand Down
6 changes: 3 additions & 3 deletions src/qt_gui/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <QDockWidget>
#include <QKeyEvent>
#include <QProgressDialog>
#include <QPlainTextEdit>
#include <QProgressDialog>

#include "about_dialog.h"
#include "cheats_patches.h"
Expand Down Expand Up @@ -266,8 +266,8 @@ void MainWindow::CreateConnects() {

// this is the editor for kbm keybinds
connect(ui->controllerButton, &QPushButton::clicked, this, [this]() {
EditorDialog *editorWindow = new EditorDialog(this);
editorWindow->exec(); // Show the editor window modally
EditorDialog* editorWindow = new EditorDialog(this);
editorWindow->exec(); // Show the editor window modally
});

#ifdef ENABLE_UPDATER
Expand Down

0 comments on commit 3261674

Please sign in to comment.