diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/common/demangle.cpp | 37 | ||||
| -rw-r--r-- | src/common/demangle.h | 12 | ||||
| -rw-r--r-- | src/core/arm/arm_interface.cpp | 22 | ||||
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 12 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 49 | ||||
| -rw-r--r-- | src/yuzu/hotkeys.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/hotkeys.h | 1 | ||||
| -rw-r--r-- | src/yuzu/uisettings.h | 1 |
9 files changed, 96 insertions, 48 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 45332cf95..bd6ac6716 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -38,6 +38,8 @@ add_library(common STATIC | |||
| 38 | common_precompiled_headers.h | 38 | common_precompiled_headers.h |
| 39 | common_types.h | 39 | common_types.h |
| 40 | concepts.h | 40 | concepts.h |
| 41 | demangle.cpp | ||
| 42 | demangle.h | ||
| 41 | div_ceil.h | 43 | div_ceil.h |
| 42 | dynamic_library.cpp | 44 | dynamic_library.cpp |
| 43 | dynamic_library.h | 45 | dynamic_library.h |
| @@ -175,7 +177,7 @@ endif() | |||
| 175 | create_target_directory_groups(common) | 177 | create_target_directory_groups(common) |
| 176 | 178 | ||
| 177 | target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) | 179 | target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) |
| 178 | target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd) | 180 | target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd demangle) |
| 179 | 181 | ||
| 180 | if (YUZU_USE_PRECOMPILED_HEADERS) | 182 | if (YUZU_USE_PRECOMPILED_HEADERS) |
| 181 | target_precompile_headers(common PRIVATE precompiled_headers.h) | 183 | target_precompile_headers(common PRIVATE precompiled_headers.h) |
diff --git a/src/common/demangle.cpp b/src/common/demangle.cpp new file mode 100644 index 000000000..f4246f666 --- /dev/null +++ b/src/common/demangle.cpp | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "common/demangle.h" | ||
| 5 | #include "common/scope_exit.h" | ||
| 6 | |||
| 7 | namespace llvm { | ||
| 8 | char* itaniumDemangle(const char* mangled_name, char* buf, size_t* n, int* status); | ||
| 9 | } | ||
| 10 | |||
| 11 | namespace Common { | ||
| 12 | |||
| 13 | std::string DemangleSymbol(const std::string& mangled) { | ||
| 14 | auto is_itanium = [](const std::string& name) -> bool { | ||
| 15 | // A valid Itanium encoding requires 1-4 leading underscores, followed by 'Z'. | ||
| 16 | auto pos = name.find_first_not_of('_'); | ||
| 17 | return pos > 0 && pos <= 4 && pos < name.size() && name[pos] == 'Z'; | ||
| 18 | }; | ||
| 19 | |||
| 20 | if (mangled.empty()) { | ||
| 21 | return mangled; | ||
| 22 | } | ||
| 23 | |||
| 24 | char* demangled = nullptr; | ||
| 25 | SCOPE_EXIT({ std::free(demangled); }); | ||
| 26 | |||
| 27 | if (is_itanium(mangled)) { | ||
| 28 | demangled = llvm::itaniumDemangle(mangled.c_str(), nullptr, nullptr, nullptr); | ||
| 29 | } | ||
| 30 | |||
| 31 | if (!demangled) { | ||
| 32 | return mangled; | ||
| 33 | } | ||
| 34 | return demangled; | ||
| 35 | } | ||
| 36 | |||
| 37 | } // namespace Common | ||
diff --git a/src/common/demangle.h b/src/common/demangle.h new file mode 100644 index 000000000..f072d22f3 --- /dev/null +++ b/src/common/demangle.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <string> | ||
| 7 | |||
| 8 | namespace Common { | ||
| 9 | |||
| 10 | std::string DemangleSymbol(const std::string& mangled); | ||
| 11 | |||
| 12 | } // namespace Common | ||
diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp index 2df7b0ee8..8aa7b9641 100644 --- a/src/core/arm/arm_interface.cpp +++ b/src/core/arm/arm_interface.cpp | |||
| @@ -1,14 +1,12 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #ifndef _MSC_VER | ||
| 5 | #include <cxxabi.h> | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #include <map> | 4 | #include <map> |
| 9 | #include <optional> | 5 | #include <optional> |
| 6 | |||
| 10 | #include "common/bit_field.h" | 7 | #include "common/bit_field.h" |
| 11 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "common/demangle.h" | ||
| 12 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 13 | #include "core/arm/arm_interface.h" | 11 | #include "core/arm/arm_interface.h" |
| 14 | #include "core/arm/symbols.h" | 12 | #include "core/arm/symbols.h" |
| @@ -71,20 +69,8 @@ void ARM_Interface::SymbolicateBacktrace(Core::System& system, std::vector<Backt | |||
| 71 | const auto symbol_set = symbols.find(entry.module); | 69 | const auto symbol_set = symbols.find(entry.module); |
| 72 | if (symbol_set != symbols.end()) { | 70 | if (symbol_set != symbols.end()) { |
| 73 | const auto symbol = Symbols::GetSymbolName(symbol_set->second, entry.offset); | 71 | const auto symbol = Symbols::GetSymbolName(symbol_set->second, entry.offset); |
| 74 | if (symbol.has_value()) { | 72 | if (symbol) { |
| 75 | #ifdef _MSC_VER | 73 | entry.name = Common::DemangleSymbol(*symbol); |
| 76 | // TODO(DarkLordZach): Add demangling of symbol names. | ||
| 77 | entry.name = *symbol; | ||
| 78 | #else | ||
| 79 | int status{-1}; | ||
| 80 | char* demangled{abi::__cxa_demangle(symbol->c_str(), nullptr, nullptr, &status)}; | ||
| 81 | if (status == 0 && demangled != nullptr) { | ||
| 82 | entry.name = demangled; | ||
| 83 | std::free(demangled); | ||
| 84 | } else { | ||
| 85 | entry.name = *symbol; | ||
| 86 | } | ||
| 87 | #endif | ||
| 88 | } | 74 | } |
| 89 | } | 75 | } |
| 90 | } | 76 | } |
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 7a01f3f4c..a959c9db9 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | namespace Core::HID { | 11 | namespace Core::HID { |
| 12 | constexpr s32 HID_JOYSTICK_MAX = 0x7fff; | 12 | constexpr s32 HID_JOYSTICK_MAX = 0x7fff; |
| 13 | constexpr s32 HID_JOYSTICK_MIN = 0x7ffe; | ||
| 13 | constexpr s32 HID_TRIGGER_MAX = 0x7fff; | 14 | constexpr s32 HID_TRIGGER_MAX = 0x7fff; |
| 14 | // Use a common UUID for TAS and Virtual Gamepad | 15 | // Use a common UUID for TAS and Virtual Gamepad |
| 15 | constexpr Common::UUID TAS_UUID = | 16 | constexpr Common::UUID TAS_UUID = |
| @@ -798,9 +799,16 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, | |||
| 798 | return; | 799 | return; |
| 799 | } | 800 | } |
| 800 | 801 | ||
| 802 | const auto FloatToShort = [](float a) { | ||
| 803 | if (a > 0) { | ||
| 804 | return static_cast<s32>(a * HID_JOYSTICK_MAX); | ||
| 805 | } | ||
| 806 | return static_cast<s32>(a * HID_JOYSTICK_MIN); | ||
| 807 | }; | ||
| 808 | |||
| 801 | const AnalogStickState stick{ | 809 | const AnalogStickState stick{ |
| 802 | .x = static_cast<s32>(controller.stick_values[index].x.value * HID_JOYSTICK_MAX), | 810 | .x = FloatToShort(controller.stick_values[index].x.value), |
| 803 | .y = static_cast<s32>(controller.stick_values[index].y.value * HID_JOYSTICK_MAX), | 811 | .y = FloatToShort(controller.stick_values[index].y.value), |
| 804 | }; | 812 | }; |
| 805 | 813 | ||
| 806 | switch (index) { | 814 | switch (index) { |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 0db62baa3..fd3bb30e1 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -70,28 +70,28 @@ const std::array<int, 2> Config::default_ringcon_analogs{{ | |||
| 70 | // UISetting::values.shortcuts, which is alphabetically ordered. | 70 | // UISetting::values.shortcuts, which is alphabetically ordered. |
| 71 | // clang-format off | 71 | // clang-format off |
| 72 | const std::array<UISettings::Shortcut, 22> Config::default_hotkeys{{ | 72 | const std::array<UISettings::Shortcut, 22> Config::default_hotkeys{{ |
| 73 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Mute/Unmute")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+M"), QStringLiteral("Home+Dpad_Right"), Qt::WindowShortcut}}, | 73 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Mute/Unmute")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+M"), QStringLiteral("Home+Dpad_Right"), Qt::WindowShortcut, false}}, |
| 74 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Volume Down")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("-"), QStringLiteral("Home+Dpad_Down"), Qt::ApplicationShortcut}}, | 74 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Volume Down")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("-"), QStringLiteral("Home+Dpad_Down"), Qt::ApplicationShortcut, true}}, |
| 75 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Volume Up")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("="), QStringLiteral("Home+Dpad_Up"), Qt::ApplicationShortcut}}, | 75 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Volume Up")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("="), QStringLiteral("Home+Dpad_Up"), Qt::ApplicationShortcut, true}}, |
| 76 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Capture Screenshot")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+P"), QStringLiteral("Screenshot"), Qt::WidgetWithChildrenShortcut}}, | 76 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Capture Screenshot")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+P"), QStringLiteral("Screenshot"), Qt::WidgetWithChildrenShortcut, false}}, |
| 77 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change Adapting Filter")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F8"), QStringLiteral("Home+L"), Qt::ApplicationShortcut}}, | 77 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change Adapting Filter")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F8"), QStringLiteral("Home+L"), Qt::ApplicationShortcut, false}}, |
| 78 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change Docked Mode")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F10"), QStringLiteral("Home+X"), Qt::ApplicationShortcut}}, | 78 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change Docked Mode")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F10"), QStringLiteral("Home+X"), Qt::ApplicationShortcut, false}}, |
| 79 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change GPU Accuracy")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F9"), QStringLiteral("Home+R"), Qt::ApplicationShortcut}}, | 79 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change GPU Accuracy")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F9"), QStringLiteral("Home+R"), Qt::ApplicationShortcut, false}}, |
| 80 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Continue/Pause Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F4"), QStringLiteral("Home+Plus"), Qt::WindowShortcut}}, | 80 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Continue/Pause Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F4"), QStringLiteral("Home+Plus"), Qt::WindowShortcut, false}}, |
| 81 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Exit Fullscreen")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Esc"), QStringLiteral(""), Qt::WindowShortcut}}, | 81 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Exit Fullscreen")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Esc"), QStringLiteral(""), Qt::WindowShortcut, false}}, |
| 82 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Exit yuzu")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+Q"), QStringLiteral("Home+Minus"), Qt::WindowShortcut}}, | 82 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Exit yuzu")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+Q"), QStringLiteral("Home+Minus"), Qt::WindowShortcut, false}}, |
| 83 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Fullscreen")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F11"), QStringLiteral("Home+B"), Qt::WindowShortcut}}, | 83 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Fullscreen")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F11"), QStringLiteral("Home+B"), Qt::WindowShortcut, false}}, |
| 84 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load File")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+O"), QStringLiteral(""), Qt::WidgetWithChildrenShortcut}}, | 84 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load File")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+O"), QStringLiteral(""), Qt::WidgetWithChildrenShortcut, false}}, |
| 85 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load/Remove Amiibo")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F2"), QStringLiteral("Home+A"), Qt::WidgetWithChildrenShortcut}}, | 85 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load/Remove Amiibo")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F2"), QStringLiteral("Home+A"), Qt::WidgetWithChildrenShortcut, false}}, |
| 86 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Restart Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F6"), QStringLiteral(""), Qt::WindowShortcut}}, | 86 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Restart Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F6"), QStringLiteral(""), Qt::WindowShortcut, false}}, |
| 87 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Stop Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F5"), QStringLiteral(""), Qt::WindowShortcut}}, | 87 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Stop Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F5"), QStringLiteral(""), Qt::WindowShortcut, false}}, |
| 88 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Record")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F7"), QStringLiteral(""), Qt::ApplicationShortcut}}, | 88 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Record")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F7"), QStringLiteral(""), Qt::ApplicationShortcut, false}}, |
| 89 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Reset")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F6"), QStringLiteral(""), Qt::ApplicationShortcut}}, | 89 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Reset")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F6"), QStringLiteral(""), Qt::ApplicationShortcut, false}}, |
| 90 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Start/Stop")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F5"), QStringLiteral(""), Qt::ApplicationShortcut}}, | 90 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Start/Stop")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F5"), QStringLiteral(""), Qt::ApplicationShortcut, false}}, |
| 91 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Filter Bar")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F"), QStringLiteral(""), Qt::WindowShortcut}}, | 91 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Filter Bar")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F"), QStringLiteral(""), Qt::WindowShortcut, false}}, |
| 92 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Framerate Limit")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+U"), QStringLiteral("Home+Y"), Qt::ApplicationShortcut}}, | 92 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Framerate Limit")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+U"), QStringLiteral("Home+Y"), Qt::ApplicationShortcut, false}}, |
| 93 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Mouse Panning")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F9"), QStringLiteral(""), Qt::ApplicationShortcut}}, | 93 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Mouse Panning")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F9"), QStringLiteral(""), Qt::ApplicationShortcut, false}}, |
| 94 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Status Bar")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+S"), QStringLiteral(""), Qt::WindowShortcut}}, | 94 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Status Bar")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+S"), QStringLiteral(""), Qt::WindowShortcut, false}}, |
| 95 | }}; | 95 | }}; |
| 96 | // clang-format on | 96 | // clang-format on |
| 97 | 97 | ||
| @@ -747,7 +747,7 @@ void Config::ReadShortcutValues() { | |||
| 747 | for (const auto& [name, group, shortcut] : default_hotkeys) { | 747 | for (const auto& [name, group, shortcut] : default_hotkeys) { |
| 748 | qt_config->beginGroup(group); | 748 | qt_config->beginGroup(group); |
| 749 | qt_config->beginGroup(name); | 749 | qt_config->beginGroup(name); |
| 750 | // No longer using ReadSetting for shortcut.second as it innacurately returns a value of 1 | 750 | // No longer using ReadSetting for shortcut.second as it inaccurately returns a value of 1 |
| 751 | // for WidgetWithChildrenShortcut which is a value of 3. Needed to fix shortcuts the open | 751 | // for WidgetWithChildrenShortcut which is a value of 3. Needed to fix shortcuts the open |
| 752 | // a file dialog in windowed mode | 752 | // a file dialog in windowed mode |
| 753 | UISettings::values.shortcuts.push_back( | 753 | UISettings::values.shortcuts.push_back( |
| @@ -756,7 +756,7 @@ void Config::ReadShortcutValues() { | |||
| 756 | {ReadSetting(QStringLiteral("KeySeq"), shortcut.keyseq).toString(), | 756 | {ReadSetting(QStringLiteral("KeySeq"), shortcut.keyseq).toString(), |
| 757 | ReadSetting(QStringLiteral("Controller_KeySeq"), shortcut.controller_keyseq) | 757 | ReadSetting(QStringLiteral("Controller_KeySeq"), shortcut.controller_keyseq) |
| 758 | .toString(), | 758 | .toString(), |
| 759 | shortcut.context}}); | 759 | shortcut.context, ReadSetting(QStringLiteral("Repeat"), shortcut.repeat).toBool()}}); |
| 760 | qt_config->endGroup(); | 760 | qt_config->endGroup(); |
| 761 | qt_config->endGroup(); | 761 | qt_config->endGroup(); |
| 762 | } | 762 | } |
| @@ -1393,6 +1393,7 @@ void Config::SaveShortcutValues() { | |||
| 1393 | WriteSetting(QStringLiteral("Controller_KeySeq"), shortcut.controller_keyseq, | 1393 | WriteSetting(QStringLiteral("Controller_KeySeq"), shortcut.controller_keyseq, |
| 1394 | default_hotkey.controller_keyseq); | 1394 | default_hotkey.controller_keyseq); |
| 1395 | WriteSetting(QStringLiteral("Context"), shortcut.context, default_hotkey.context); | 1395 | WriteSetting(QStringLiteral("Context"), shortcut.context, default_hotkey.context); |
| 1396 | WriteSetting(QStringLiteral("Repeat"), shortcut.repeat, default_hotkey.repeat); | ||
| 1396 | qt_config->endGroup(); | 1397 | qt_config->endGroup(); |
| 1397 | qt_config->endGroup(); | 1398 | qt_config->endGroup(); |
| 1398 | } | 1399 | } |
diff --git a/src/yuzu/hotkeys.cpp b/src/yuzu/hotkeys.cpp index 13723f6e5..6530186c1 100644 --- a/src/yuzu/hotkeys.cpp +++ b/src/yuzu/hotkeys.cpp | |||
| @@ -21,7 +21,7 @@ void HotkeyRegistry::SaveHotkeys() { | |||
| 21 | {hotkey.first, group.first, | 21 | {hotkey.first, group.first, |
| 22 | UISettings::ContextualShortcut({hotkey.second.keyseq.toString(), | 22 | UISettings::ContextualShortcut({hotkey.second.keyseq.toString(), |
| 23 | hotkey.second.controller_keyseq, | 23 | hotkey.second.controller_keyseq, |
| 24 | hotkey.second.context})}); | 24 | hotkey.second.context, hotkey.second.repeat})}); |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| @@ -47,6 +47,7 @@ void HotkeyRegistry::LoadHotkeys() { | |||
| 47 | hk.controller_shortcut->disconnect(); | 47 | hk.controller_shortcut->disconnect(); |
| 48 | hk.controller_shortcut->SetKey(hk.controller_keyseq); | 48 | hk.controller_shortcut->SetKey(hk.controller_keyseq); |
| 49 | } | 49 | } |
| 50 | hk.repeat = shortcut.shortcut.repeat; | ||
| 50 | } | 51 | } |
| 51 | } | 52 | } |
| 52 | 53 | ||
| @@ -57,8 +58,7 @@ QShortcut* HotkeyRegistry::GetHotkey(const QString& group, const QString& action | |||
| 57 | hk.shortcut = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context); | 58 | hk.shortcut = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context); |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | hk.shortcut->setAutoRepeat(false); | 61 | hk.shortcut->setAutoRepeat(hk.repeat); |
| 61 | |||
| 62 | return hk.shortcut; | 62 | return hk.shortcut; |
| 63 | } | 63 | } |
| 64 | 64 | ||
diff --git a/src/yuzu/hotkeys.h b/src/yuzu/hotkeys.h index dc5b7f628..848239c35 100644 --- a/src/yuzu/hotkeys.h +++ b/src/yuzu/hotkeys.h | |||
| @@ -115,6 +115,7 @@ private: | |||
| 115 | QShortcut* shortcut = nullptr; | 115 | QShortcut* shortcut = nullptr; |
| 116 | ControllerShortcut* controller_shortcut = nullptr; | 116 | ControllerShortcut* controller_shortcut = nullptr; |
| 117 | Qt::ShortcutContext context = Qt::WindowShortcut; | 117 | Qt::ShortcutContext context = Qt::WindowShortcut; |
| 118 | bool repeat; | ||
| 118 | }; | 119 | }; |
| 119 | 120 | ||
| 120 | using HotkeyMap = std::map<QString, Hotkey>; | 121 | using HotkeyMap = std::map<QString, Hotkey>; |
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 2006b883e..db43b7033 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -22,6 +22,7 @@ struct ContextualShortcut { | |||
| 22 | QString keyseq; | 22 | QString keyseq; |
| 23 | QString controller_keyseq; | 23 | QString controller_keyseq; |
| 24 | int context; | 24 | int context; |
| 25 | bool repeat; | ||
| 25 | }; | 26 | }; |
| 26 | 27 | ||
| 27 | struct Shortcut { | 28 | struct Shortcut { |