diff --git a/src/input/input_handler.h b/src/input/input_handler.h index 745906620..daef22f21 100644 --- a/src/input/input_handler.h +++ b/src/input/input_handler.h @@ -177,38 +177,38 @@ const std::map string_to_keyboard_key_map = { {"9", SDLK_9}, // symbols - {"`", SDLK_GRAVE}, - {"~", SDLK_TILDE}, - {"!", SDLK_EXCLAIM}, - {"@", SDLK_AT}, - {"#", SDLK_HASH}, - {"$", SDLK_DOLLAR}, - {"%", SDLK_PERCENT}, - {"^", SDLK_CARET}, - {"&", SDLK_AMPERSAND}, - {"*", SDLK_ASTERISK}, - {"(", SDLK_LEFTPAREN}, - {")", SDLK_RIGHTPAREN}, - {"-", SDLK_MINUS}, - {"_", SDLK_UNDERSCORE}, - {"=", SDLK_EQUALS}, - {"+", SDLK_PLUS}, - {"[", SDLK_LEFTBRACKET}, - {"]", SDLK_RIGHTBRACKET}, - {"{", SDLK_LEFTBRACE}, - {"}", SDLK_RIGHTBRACE}, - {"\\", SDLK_BACKSLASH}, - {"|", SDLK_PIPE}, - {";", SDLK_SEMICOLON}, - {":", SDLK_COLON}, - {"'", SDLK_APOSTROPHE}, - {"\"", SDLK_DBLAPOSTROPHE}, - {",", SDLK_COMMA}, - {"<", SDLK_LESS}, - {".", SDLK_PERIOD}, - {">", SDLK_GREATER}, - {"/", SDLK_SLASH}, - {"?", SDLK_QUESTION}, + {"grave", SDLK_GRAVE}, + {"tilde", SDLK_TILDE}, + {"exclamation", SDLK_EXCLAIM}, + {"at", SDLK_AT}, + {"hash", SDLK_HASH}, + {"dollar", SDLK_DOLLAR}, + {"percent", SDLK_PERCENT}, + {"caret", SDLK_CARET}, + {"ampersand", SDLK_AMPERSAND}, + {"asterisk", SDLK_ASTERISK}, + {"lparen", SDLK_LEFTPAREN}, + {"rparen", SDLK_RIGHTPAREN}, + {"minus", SDLK_MINUS}, + {"underscore", SDLK_UNDERSCORE}, + {"equals", SDLK_EQUALS}, + {"plus", SDLK_PLUS}, + {"lbracket", SDLK_LEFTBRACKET}, + {"rbracket", SDLK_RIGHTBRACKET}, + {"lbrace", SDLK_LEFTBRACE}, + {"rbrace", SDLK_RIGHTBRACE}, + {"backslash", SDLK_BACKSLASH}, + {"pipe", SDLK_PIPE}, + {"semicolon", SDLK_SEMICOLON}, + {"colon", SDLK_COLON}, + {"apostrophe", SDLK_APOSTROPHE}, + {"quote", SDLK_DBLAPOSTROPHE}, + {"comma", SDLK_COMMA}, + {"less", SDLK_LESS}, + {"period", SDLK_PERIOD}, + {"greater", SDLK_GREATER}, + {"slash", SDLK_SLASH}, + {"question", SDLK_QUESTION}, // special keys {"escape", SDLK_ESCAPE}, @@ -252,13 +252,13 @@ const std::map string_to_keyboard_key_map = { {"kp7", SDLK_KP_7}, {"kp8", SDLK_KP_8}, {"kp9", SDLK_KP_9}, - {"kp.", SDLK_KP_PERIOD}, - {"kp,", SDLK_KP_COMMA}, - {"kp/", SDLK_KP_DIVIDE}, - {"kp*", SDLK_KP_MULTIPLY}, - {"kp-", SDLK_KP_MINUS}, - {"kp+", SDLK_KP_PLUS}, - {"kp=", SDLK_KP_EQUALS}, + {"kpperiod", SDLK_KP_PERIOD}, + {"kpcomma", SDLK_KP_COMMA}, + {"kpslash", SDLK_KP_DIVIDE}, + {"kpasterisk", SDLK_KP_MULTIPLY}, + {"kpminus", SDLK_KP_MINUS}, + {"kpplus", SDLK_KP_PLUS}, + {"kpequals", SDLK_KP_EQUALS}, {"kpenter", SDLK_KP_ENTER}, // mouse diff --git a/src/qt_gui/kbm_gui.cpp b/src/qt_gui/kbm_gui.cpp index 1f7743412..4cc3c16db 100644 --- a/src/qt_gui/kbm_gui.cpp +++ b/src/qt_gui/kbm_gui.cpp @@ -711,92 +711,98 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) { break; // symbols + case Qt::Key_QuoteLeft: + pressedKeys.insert("grave"); + break; + case Qt::Key_AsciiTilde: + pressedKeys.insert("tilde"); + break; case Qt::Key_Exclam: - pressedKeys.insert("!"); + pressedKeys.insert("exclamation"); break; case Qt::Key_At: - pressedKeys.insert("@"); + pressedKeys.insert("at"); break; case Qt::Key_NumberSign: - pressedKeys.insert("#"); + pressedKeys.insert("hash"); break; case Qt::Key_Dollar: - pressedKeys.insert("$"); + pressedKeys.insert("dollar"); break; case Qt::Key_Percent: - pressedKeys.insert("%"); + pressedKeys.insert("percent"); break; case Qt::Key_AsciiCircum: - pressedKeys.insert("^"); + pressedKeys.insert("caret"); break; case Qt::Key_Ampersand: - pressedKeys.insert("&"); + pressedKeys.insert("ampersand"); break; case Qt::Key_Asterisk: - pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp*", "*")); + pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kpasterisk", "asterisk")); break; case Qt::Key_ParenLeft: - pressedKeys.insert("("); + pressedKeys.insert("lparen"); break; case Qt::Key_ParenRight: - pressedKeys.insert(")"); + pressedKeys.insert("rparen"); break; case Qt::Key_Minus: - pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp-", "-")); + pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kpminus", "minus")); break; case Qt::Key_Underscore: - pressedKeys.insert("_"); + pressedKeys.insert("underscore"); break; case Qt::Key_Equal: - pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp=", "=")); + pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kpequals", "equals")); break; case Qt::Key_Plus: - pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp+", "+")); + pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kpplus", "plus")); break; case Qt::Key_BracketLeft: - pressedKeys.insert("["); + pressedKeys.insert("lbracket"); break; case Qt::Key_BracketRight: - pressedKeys.insert("]"); + pressedKeys.insert("rbracket"); break; case Qt::Key_BraceLeft: - pressedKeys.insert("{"); + pressedKeys.insert("lbrace"); break; case Qt::Key_BraceRight: - pressedKeys.insert("}"); + pressedKeys.insert("rbrace"); break; case Qt::Key_Backslash: - pressedKeys.insert("\\"); + pressedKeys.insert("backslash"); break; case Qt::Key_Bar: - pressedKeys.insert("|"); + pressedKeys.insert("pipe"); break; case Qt::Key_Semicolon: - pressedKeys.insert(";"); + pressedKeys.insert("semicolon"); break; case Qt::Key_Colon: - pressedKeys.insert(":"); + pressedKeys.insert("colon"); break; case Qt::Key_Apostrophe: - pressedKeys.insert("'"); + pressedKeys.insert("apostrophe"); break; case Qt::Key_QuoteDbl: - pressedKeys.insert("\""); + pressedKeys.insert("quote"); break; case Qt::Key_Comma: - pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp,", ",")); + pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kpcomma", "comma")); break; case Qt::Key_Less: - pressedKeys.insert("<"); + pressedKeys.insert("less"); break; case Qt::Key_Period: - pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp.", ".")); + pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kpperiod", "period")); break; case Qt::Key_Greater: - pressedKeys.insert(">"); + pressedKeys.insert("greater"); break; case Qt::Key_Slash: - pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp/", "/")); + pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kpslash", "slash")); break; case Qt::Key_Question: pressedKeys.insert("question"); diff --git a/src/qt_gui/kbm_help_dialog.cpp b/src/qt_gui/kbm_help_dialog.cpp index 1c40c6c4d..b9055222c 100644 --- a/src/qt_gui/kbm_help_dialog.cpp +++ b/src/qt_gui/kbm_help_dialog.cpp @@ -121,35 +121,6 @@ To view the config file's syntax, check out the Syntax tab, for keybind names, v This project began because I disliked the original, unchangeable keybinds. Rather than waiting for someone else to do it, I implemented this myself. From the default keybinds, you can clearly tell this was a project built for Bloodborne, but obviously, you can make adjustments however you like.)"; } -QString HelpDialog::faq() { - return R"( -Q: What are the emulator-wide keybinds? -A: --F12: Triggers Renderdoc capture --F11: Toggles fullscreen --F10: Toggles FPS counter --Ctrl+F10: Open the debug menu --F9: Pauses the emulator if the debug menu is open --F8: Reparses the config file while in-game --F7: Toggles mouse capture and mouse input --F6: Toggles mouse-to-gyro emulation - -Q: How do I switch between mouse and controller joystick input? Why is it even required? -A: Pressing F7 toggles between mouse and controller joystick input. It is required because the program polls the mouse input, which means it checks mouse movement every frame. If it didn't move, the code would manually set the emulator's virtual controller to 0 (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 skips it, so the rest of the file will get parsed, but that line in question will be treated like a comment line. You can find these lines in the log if you search for 'input_handler'. - -Q: I want to bind to , but your code doesn't support ! -A: Some keys are intentionally omitted, but if you read the bindings through, and you're sure it is not there and isn't one of the intentionally disabled ones, open an issue on https://github.com/shadps4-emu/shadPS4. - -Q: What does default.ini do? -A: If you're using per-game configs, it's the base from which all new games generate their config file. If you use the unified config, then default.ini is used for every game directly instead. - -Q: What does the use Per-game Config checkbox do? -A: It controls whether the config is loaded from CUSAXXXXX.ini for a game or from default.ini. This way, if you only want to manage one set of bindings, you can do so, but if you want to use a different setup for every game, that's possible as well.)"; -} - QString HelpDialog::syntax() { return R"( Below is the file format for mouse, keyboard, and controller inputs: @@ -187,13 +158,12 @@ Keyboard: Numbers: '0', '1', ..., '9' Keypad: - 'kp 0', 'kp 1', ..., 'kp 9', - 'kp .', 'kp ,', 'kp /', 'kp *', 'kp -', 'kp +', 'kp =', 'kp enter' + 'kp0', 'kp1', ..., 'kp9', + 'kpperiod', 'kpcomma', 'kpslash', 'kpasterisk', 'kpminus', 'kpplus', 'kpequals', 'kpenter' Symbols: - '`', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '_', '=', '+', '{', '}', '[', ']', '\', '|', - ';', ':', ''', '"', ',', '<', '.', '>', '/', '?' + (See below) Special keys: - 'escape (text editor only)', 'printscreen', 'scrolllock', 'pausebreak', + 'escape' (text editor only), 'printscreen', 'scrolllock', 'pausebreak', 'backspace', 'insert', 'delete', 'home', 'end', 'pgup', 'pgdown', 'tab', 'capslock', 'enter', 'space' Arrow keys: @@ -228,7 +198,38 @@ Controller: 'l2' Invalid Inputs: - 'F1-F12' are reserved for emulator-wide keybinds, and cannot be bound to controller inputs.)"; + 'F1-F12' are reserved for emulator-wide keybinds, and cannot be bound to controller inputs. + +Symbols (expanded): + ` 'grave' + ~ 'tilde' + ! 'exclamation' + @ 'at' + # 'hash' + $ 'dollar' + % 'percent' + ^ 'caret' + & 'ampersand' + * 'asterisk' + ( 'lparen' + - 'minus' + _ 'underscore' + = 'equals' + + 'plus' + [ 'lbracket' + { 'lbrace' + \ 'backslash' + | 'pipe' + ; 'semicolon' + : 'colon' + ' 'apostrophe' + " 'quote' + , 'comma' + < 'less' + . 'period' + > 'greater' + / 'slash' + ? 'question')"; } QString HelpDialog::special() { @@ -267,3 +268,35 @@ You can find these here, with detailed comments, examples, and suggestions for m 'mouse_gyro_roll_mode': Controls whether moving the mouse sideways causes a panning or a rolling motion while mouse-to-gyro emulation is active.)"; } + +QString HelpDialog::faq() { + return R"( +Q: What are the emulator-wide keybinds? +A: +-F12: Triggers Renderdoc capture +-F11: Toggles fullscreen +-F10: Toggles FPS counter +-Ctrl+F10: Open the debug menu +-F9: Pauses the emulator if the debug menu is open +-F8: Reparses the config file while in-game +-F7: Toggles mouse capture and mouse input +-F6: Toggles mouse-to-gyro emulation + +Q: How do I switch between mouse and controller joystick input? Why is it even required? +A: Pressing F7 toggles between mouse and controller joystick input. It is required because the program polls the mouse input, which means it checks mouse movement every frame. If it didn't move, the code would manually set the emulator's virtual controller to 0 (to the center), even if other input devices would update it. + +Q: What in the world is a 'grave' key? +A: (`). It represents one of the many symbols you can bind to a key. You can find the various symbols and their names in the Bindings tab. + +Q: What happens if I accidentally make a typo in the config? +A: The code recognises the line as wrong and skips it, so the rest of the file will get parsed, but that line in question will be treated like a comment line. You can find these lines in the log if you search for 'input_handler'. + +Q: I want to bind to , but your code doesn't support ! +A: Some keys are intentionally omitted, but if you read the bindings through, and you're sure it is not there and isn't one of the intentionally disabled ones, open an issue on https://github.com/shadps4-emu/shadPS4. + +Q: What does default.ini do? +A: If you're using per-game configs, it's the base from which all new games generate their config file. If you use the unified config, then default.ini is used for every game directly instead. + +Q: What does the use Per-game Config checkbox do? +A: It controls whether the config is loaded from CUSAXXXXX.ini for a game or from default.ini. This way, if you only want to manage one set of bindings, you can do so, but if you want to use a different setup for every game, that's possible as well.)"; +} \ No newline at end of file