diff options
Diffstat (limited to 'src')
31 files changed, 193 insertions, 105 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/debugger/gdbstub.cpp b/src/core/debugger/gdbstub.cpp index a64a9ac64..9c02b7b31 100644 --- a/src/core/debugger/gdbstub.cpp +++ b/src/core/debugger/gdbstub.cpp | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "common/hex_util.h" | 11 | #include "common/hex_util.h" |
| 12 | #include "common/logging/log.h" | 12 | #include "common/logging/log.h" |
| 13 | #include "common/scope_exit.h" | 13 | #include "common/scope_exit.h" |
| 14 | #include "common/settings.h" | ||
| 14 | #include "core/arm/arm_interface.h" | 15 | #include "core/arm/arm_interface.h" |
| 15 | #include "core/core.h" | 16 | #include "core/core.h" |
| 16 | #include "core/debugger/gdbstub.h" | 17 | #include "core/debugger/gdbstub.h" |
| @@ -731,7 +732,25 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) { | |||
| 731 | auto* process = system.CurrentProcess(); | 732 | auto* process = system.CurrentProcess(); |
| 732 | auto& page_table = process->PageTable(); | 733 | auto& page_table = process->PageTable(); |
| 733 | 734 | ||
| 734 | if (command_str == "get info") { | 735 | const char* commands = "Commands:\n" |
| 736 | " get fastmem\n" | ||
| 737 | " get info\n" | ||
| 738 | " get mappings\n"; | ||
| 739 | |||
| 740 | if (command_str == "get fastmem") { | ||
| 741 | if (Settings::IsFastmemEnabled()) { | ||
| 742 | const auto& impl = page_table.PageTableImpl(); | ||
| 743 | const auto region = reinterpret_cast<uintptr_t>(impl.fastmem_arena); | ||
| 744 | const auto region_bits = impl.current_address_space_width_in_bits; | ||
| 745 | const auto region_size = 1ULL << region_bits; | ||
| 746 | |||
| 747 | reply = fmt::format("Region bits: {}\n" | ||
| 748 | "Host address: {:#x} - {:#x}\n", | ||
| 749 | region_bits, region, region + region_size - 1); | ||
| 750 | } else { | ||
| 751 | reply = "Fastmem is not enabled.\n"; | ||
| 752 | } | ||
| 753 | } else if (command_str == "get info") { | ||
| 735 | Loader::AppLoader::Modules modules; | 754 | Loader::AppLoader::Modules modules; |
| 736 | system.GetAppLoader().ReadNSOModules(modules); | 755 | system.GetAppLoader().ReadNSOModules(modules); |
| 737 | 756 | ||
| @@ -787,9 +806,10 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) { | |||
| 787 | cur_addr = next_address; | 806 | cur_addr = next_address; |
| 788 | } | 807 | } |
| 789 | } else if (command_str == "help") { | 808 | } else if (command_str == "help") { |
| 790 | reply = "Commands:\n get info\n get mappings\n"; | 809 | reply = commands; |
| 791 | } else { | 810 | } else { |
| 792 | reply = "Unknown command.\nCommands:\n get info\n get mappings\n"; | 811 | reply = "Unknown command.\n"; |
| 812 | reply += commands; | ||
| 793 | } | 813 | } |
| 794 | 814 | ||
| 795 | std::span<const u8> reply_span{reinterpret_cast<u8*>(&reply.front()), reply.size()}; | 815 | std::span<const u8> reply_span{reinterpret_cast<u8*>(&reply.front()), reply.size()}; |
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 0e06468da..6e9812e6e 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace Core::HID { | 12 | namespace Core::HID { |
| 13 | constexpr s32 HID_JOYSTICK_MAX = 0x7fff; | 13 | constexpr s32 HID_JOYSTICK_MAX = 0x7fff; |
| 14 | constexpr s32 HID_JOYSTICK_MIN = 0x7ffe; | ||
| 14 | constexpr s32 HID_TRIGGER_MAX = 0x7fff; | 15 | constexpr s32 HID_TRIGGER_MAX = 0x7fff; |
| 15 | // Use a common UUID for TAS and Virtual Gamepad | 16 | // Use a common UUID for TAS and Virtual Gamepad |
| 16 | constexpr Common::UUID TAS_UUID = | 17 | constexpr Common::UUID TAS_UUID = |
| @@ -863,9 +864,16 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, | |||
| 863 | return; | 864 | return; |
| 864 | } | 865 | } |
| 865 | 866 | ||
| 867 | const auto FloatToShort = [](float a) { | ||
| 868 | if (a > 0) { | ||
| 869 | return static_cast<s32>(a * HID_JOYSTICK_MAX); | ||
| 870 | } | ||
| 871 | return static_cast<s32>(a * HID_JOYSTICK_MIN); | ||
| 872 | }; | ||
| 873 | |||
| 866 | const AnalogStickState stick{ | 874 | const AnalogStickState stick{ |
| 867 | .x = static_cast<s32>(controller.stick_values[index].x.value * HID_JOYSTICK_MAX), | 875 | .x = FloatToShort(controller.stick_values[index].x.value), |
| 868 | .y = static_cast<s32>(controller.stick_values[index].y.value * HID_JOYSTICK_MAX), | 876 | .y = FloatToShort(controller.stick_values[index].y.value), |
| 869 | }; | 877 | }; |
| 870 | 878 | ||
| 871 | switch (index) { | 879 | switch (index) { |
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index a0103edde..d975eb815 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp | |||
| @@ -40,25 +40,26 @@ public: | |||
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | void EnableMotion() { | 42 | void EnableMotion() { |
| 43 | if (sdl_controller) { | 43 | if (!sdl_controller) { |
| 44 | SDL_GameController* controller = sdl_controller.get(); | 44 | return; |
| 45 | has_accel = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) == SDL_TRUE; | 45 | } |
| 46 | has_gyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO) == SDL_TRUE; | 46 | SDL_GameController* controller = sdl_controller.get(); |
| 47 | if (has_accel) { | 47 | if (HasMotion()) { |
| 48 | SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE); | 48 | SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_FALSE); |
| 49 | } | 49 | SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_GYRO, SDL_FALSE); |
| 50 | if (has_gyro) { | 50 | } |
| 51 | SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_GYRO, SDL_TRUE); | 51 | has_accel = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) == SDL_TRUE; |
| 52 | } | 52 | has_gyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO) == SDL_TRUE; |
| 53 | if (has_accel) { | ||
| 54 | SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE); | ||
| 55 | } | ||
| 56 | if (has_gyro) { | ||
| 57 | SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_GYRO, SDL_TRUE); | ||
| 53 | } | 58 | } |
| 54 | } | 59 | } |
| 55 | 60 | ||
| 56 | bool HasGyro() const { | 61 | bool HasMotion() const { |
| 57 | return has_gyro; | 62 | return has_gyro || has_accel; |
| 58 | } | ||
| 59 | |||
| 60 | bool HasAccel() const { | ||
| 61 | return has_accel; | ||
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | bool UpdateMotion(SDL_ControllerSensorEvent event) { | 65 | bool UpdateMotion(SDL_ControllerSensorEvent event) { |
| @@ -85,6 +86,20 @@ public: | |||
| 85 | if (time_difference == 0) { | 86 | if (time_difference == 0) { |
| 86 | return false; | 87 | return false; |
| 87 | } | 88 | } |
| 89 | |||
| 90 | // Motion data is invalid | ||
| 91 | if (motion.accel_x == 0 && motion.gyro_x == 0 && motion.accel_y == 0 && | ||
| 92 | motion.gyro_y == 0 && motion.accel_z == 0 && motion.gyro_z == 0) { | ||
| 93 | if (motion_error_count++ < 200) { | ||
| 94 | return false; | ||
| 95 | } | ||
| 96 | // Try restarting the sensor | ||
| 97 | motion_error_count = 0; | ||
| 98 | EnableMotion(); | ||
| 99 | return false; | ||
| 100 | } | ||
| 101 | |||
| 102 | motion_error_count = 0; | ||
| 88 | motion.delta_timestamp = time_difference * 1000; | 103 | motion.delta_timestamp = time_difference * 1000; |
| 89 | return true; | 104 | return true; |
| 90 | } | 105 | } |
| @@ -250,6 +265,7 @@ private: | |||
| 250 | mutable std::mutex mutex; | 265 | mutable std::mutex mutex; |
| 251 | 266 | ||
| 252 | u64 last_motion_update{}; | 267 | u64 last_motion_update{}; |
| 268 | std::size_t motion_error_count{}; | ||
| 253 | bool has_gyro{false}; | 269 | bool has_gyro{false}; |
| 254 | bool has_accel{false}; | 270 | bool has_accel{false}; |
| 255 | bool has_vibration{false}; | 271 | bool has_vibration{false}; |
| @@ -955,18 +971,18 @@ MotionMapping SDLDriver::GetMotionMappingForDevice(const Common::ParamPackage& p | |||
| 955 | MotionMapping mapping = {}; | 971 | MotionMapping mapping = {}; |
| 956 | joystick->EnableMotion(); | 972 | joystick->EnableMotion(); |
| 957 | 973 | ||
| 958 | if (joystick->HasGyro() || joystick->HasAccel()) { | 974 | if (joystick->HasMotion()) { |
| 959 | mapping.insert_or_assign(Settings::NativeMotion::MotionRight, | 975 | mapping.insert_or_assign(Settings::NativeMotion::MotionRight, |
| 960 | BuildMotionParam(joystick->GetPort(), joystick->GetGUID())); | 976 | BuildMotionParam(joystick->GetPort(), joystick->GetGUID())); |
| 961 | } | 977 | } |
| 962 | if (params.Has("guid2")) { | 978 | if (params.Has("guid2")) { |
| 963 | joystick2->EnableMotion(); | 979 | joystick2->EnableMotion(); |
| 964 | if (joystick2->HasGyro() || joystick2->HasAccel()) { | 980 | if (joystick2->HasMotion()) { |
| 965 | mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, | 981 | mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, |
| 966 | BuildMotionParam(joystick2->GetPort(), joystick2->GetGUID())); | 982 | BuildMotionParam(joystick2->GetPort(), joystick2->GetGUID())); |
| 967 | } | 983 | } |
| 968 | } else { | 984 | } else { |
| 969 | if (joystick->HasGyro() || joystick->HasAccel()) { | 985 | if (joystick->HasMotion()) { |
| 970 | mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, | 986 | mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, |
| 971 | BuildMotionParam(joystick->GetPort(), joystick->GetGUID())); | 987 | BuildMotionParam(joystick->GetPort(), joystick->GetGUID())); |
| 972 | } | 988 | } |
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 9b65e79cb..ae84408bc 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt | |||
| @@ -14,7 +14,6 @@ add_executable(tests | |||
| 14 | core/core_timing.cpp | 14 | core/core_timing.cpp |
| 15 | core/internal_network/network.cpp | 15 | core/internal_network/network.cpp |
| 16 | precompiled_headers.h | 16 | precompiled_headers.h |
| 17 | tests.cpp | ||
| 18 | video_core/buffer_base.cpp | 17 | video_core/buffer_base.cpp |
| 19 | input_common/calibration_configuration_job.cpp | 18 | input_common/calibration_configuration_job.cpp |
| 20 | ) | 19 | ) |
| @@ -22,7 +21,7 @@ add_executable(tests | |||
| 22 | create_target_directory_groups(tests) | 21 | create_target_directory_groups(tests) |
| 23 | 22 | ||
| 24 | target_link_libraries(tests PRIVATE common core input_common) | 23 | target_link_libraries(tests PRIVATE common core input_common) |
| 25 | target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2 Threads::Threads) | 24 | target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2WithMain Threads::Threads) |
| 26 | 25 | ||
| 27 | add_test(NAME tests COMMAND tests) | 26 | add_test(NAME tests COMMAND tests) |
| 28 | 27 | ||
diff --git a/src/tests/common/bit_field.cpp b/src/tests/common/bit_field.cpp index 0071ae52e..75e990ecd 100644 --- a/src/tests/common/bit_field.cpp +++ b/src/tests/common/bit_field.cpp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include <array> | 4 | #include <array> |
| 5 | #include <cstring> | 5 | #include <cstring> |
| 6 | #include <type_traits> | 6 | #include <type_traits> |
| 7 | #include <catch2/catch.hpp> | 7 | #include <catch2/catch_test_macros.hpp> |
| 8 | #include "common/bit_field.h" | 8 | #include "common/bit_field.h" |
| 9 | 9 | ||
| 10 | TEST_CASE("BitField", "[common]") { | 10 | TEST_CASE("BitField", "[common]") { |
diff --git a/src/tests/common/cityhash.cpp b/src/tests/common/cityhash.cpp index 05942eadb..2a391dff1 100644 --- a/src/tests/common/cityhash.cpp +++ b/src/tests/common/cityhash.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <catch2/catch.hpp> | 4 | #include <catch2/catch_test_macros.hpp> |
| 5 | 5 | ||
| 6 | #include "common/cityhash.h" | 6 | #include "common/cityhash.h" |
| 7 | 7 | ||
diff --git a/src/tests/common/fibers.cpp b/src/tests/common/fibers.cpp index 4e29f9199..ecad7583f 100644 --- a/src/tests/common/fibers.cpp +++ b/src/tests/common/fibers.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include <unordered_map> | 11 | #include <unordered_map> |
| 12 | #include <vector> | 12 | #include <vector> |
| 13 | 13 | ||
| 14 | #include <catch2/catch.hpp> | 14 | #include <catch2/catch_test_macros.hpp> |
| 15 | 15 | ||
| 16 | #include "common/common_types.h" | 16 | #include "common/common_types.h" |
| 17 | #include "common/fiber.h" | 17 | #include "common/fiber.h" |
diff --git a/src/tests/common/host_memory.cpp b/src/tests/common/host_memory.cpp index e49d0a09f..1b014b632 100644 --- a/src/tests/common/host_memory.cpp +++ b/src/tests/common/host_memory.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <catch2/catch.hpp> | 4 | #include <catch2/catch_test_macros.hpp> |
| 5 | 5 | ||
| 6 | #include "common/host_memory.h" | 6 | #include "common/host_memory.h" |
| 7 | #include "common/literals.h" | 7 | #include "common/literals.h" |
diff --git a/src/tests/common/param_package.cpp b/src/tests/common/param_package.cpp index d036cc83a..41575def4 100644 --- a/src/tests/common/param_package.cpp +++ b/src/tests/common/param_package.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2017 Citra Emulator Project | 1 | // SPDX-FileCopyrightText: 2017 Citra Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <catch2/catch.hpp> | 4 | #include <catch2/catch_test_macros.hpp> |
| 5 | #include <math.h> | 5 | #include <math.h> |
| 6 | #include "common/logging/backend.h" | 6 | #include "common/logging/backend.h" |
| 7 | #include "common/param_package.h" | 7 | #include "common/param_package.h" |
diff --git a/src/tests/common/range_map.cpp b/src/tests/common/range_map.cpp index 5a4630a38..d301ac5f6 100644 --- a/src/tests/common/range_map.cpp +++ b/src/tests/common/range_map.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <stdexcept> | 4 | #include <stdexcept> |
| 5 | 5 | ||
| 6 | #include <catch2/catch.hpp> | 6 | #include <catch2/catch_test_macros.hpp> |
| 7 | 7 | ||
| 8 | #include "common/range_map.h" | 8 | #include "common/range_map.h" |
| 9 | 9 | ||
diff --git a/src/tests/common/ring_buffer.cpp b/src/tests/common/ring_buffer.cpp index 4f81b6e5e..7dee988c8 100644 --- a/src/tests/common/ring_buffer.cpp +++ b/src/tests/common/ring_buffer.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <numeric> | 7 | #include <numeric> |
| 8 | #include <thread> | 8 | #include <thread> |
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | #include <catch2/catch.hpp> | 10 | #include <catch2/catch_test_macros.hpp> |
| 11 | #include "common/ring_buffer.h" | 11 | #include "common/ring_buffer.h" |
| 12 | 12 | ||
| 13 | namespace Common { | 13 | namespace Common { |
diff --git a/src/tests/common/scratch_buffer.cpp b/src/tests/common/scratch_buffer.cpp index f6e50da4a..132f139fa 100644 --- a/src/tests/common/scratch_buffer.cpp +++ b/src/tests/common/scratch_buffer.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #include <array> | 5 | #include <array> |
| 6 | #include <cstring> | 6 | #include <cstring> |
| 7 | #include <span> | 7 | #include <span> |
| 8 | #include <catch2/catch.hpp> | 8 | #include <catch2/catch_test_macros.hpp> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "common/scratch_buffer.h" | 10 | #include "common/scratch_buffer.h" |
| 11 | 11 | ||
diff --git a/src/tests/common/unique_function.cpp b/src/tests/common/unique_function.cpp index 311272506..f7a23e876 100644 --- a/src/tests/common/unique_function.cpp +++ b/src/tests/common/unique_function.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <string> | 4 | #include <string> |
| 5 | 5 | ||
| 6 | #include <catch2/catch.hpp> | 6 | #include <catch2/catch_test_macros.hpp> |
| 7 | 7 | ||
| 8 | #include "common/unique_function.h" | 8 | #include "common/unique_function.h" |
| 9 | 9 | ||
diff --git a/src/tests/core/core_timing.cpp b/src/tests/core/core_timing.cpp index 284b2ae66..f08afbf9a 100644 --- a/src/tests/core/core_timing.cpp +++ b/src/tests/core/core_timing.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2016 Dolphin Emulator Project | 1 | // SPDX-FileCopyrightText: 2016 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <catch2/catch.hpp> | 4 | #include <catch2/catch_test_macros.hpp> |
| 5 | 5 | ||
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <bitset> | 7 | #include <bitset> |
diff --git a/src/tests/core/internal_network/network.cpp b/src/tests/core/internal_network/network.cpp index 164b0ff24..10ddd8b42 100644 --- a/src/tests/core/internal_network/network.cpp +++ b/src/tests/core/internal_network/network.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <catch2/catch.hpp> | 4 | #include <catch2/catch_test_macros.hpp> |
| 5 | 5 | ||
| 6 | #include "core/internal_network/network.h" | 6 | #include "core/internal_network/network.h" |
| 7 | #include "core/internal_network/sockets.h" | 7 | #include "core/internal_network/sockets.h" |
diff --git a/src/tests/input_common/calibration_configuration_job.cpp b/src/tests/input_common/calibration_configuration_job.cpp index e5f698886..516ff1b30 100644 --- a/src/tests/input_common/calibration_configuration_job.cpp +++ b/src/tests/input_common/calibration_configuration_job.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include <thread> | 6 | #include <thread> |
| 7 | #include <boost/asio.hpp> | 7 | #include <boost/asio.hpp> |
| 8 | #include <boost/crc.hpp> | 8 | #include <boost/crc.hpp> |
| 9 | #include <catch2/catch.hpp> | 9 | #include <catch2/catch_test_macros.hpp> |
| 10 | 10 | ||
| 11 | #include "input_common/drivers/udp_client.h" | 11 | #include "input_common/drivers/udp_client.h" |
| 12 | #include "input_common/helpers/udp_protocol.h" | 12 | #include "input_common/helpers/udp_protocol.h" |
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp deleted file mode 100644 index 3f905c05c..000000000 --- a/src/tests/tests.cpp +++ /dev/null | |||
| @@ -1,8 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2016 Citra Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #define CATCH_CONFIG_MAIN | ||
| 5 | #include <catch2/catch.hpp> | ||
| 6 | |||
| 7 | // Catch provides the main function since we've given it the | ||
| 8 | // CATCH_CONFIG_MAIN preprocessor directive. | ||
diff --git a/src/tests/video_core/buffer_base.cpp b/src/tests/video_core/buffer_base.cpp index 5cd0628f2..1275cca24 100644 --- a/src/tests/video_core/buffer_base.cpp +++ b/src/tests/video_core/buffer_base.cpp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include <stdexcept> | 4 | #include <stdexcept> |
| 5 | #include <unordered_map> | 5 | #include <unordered_map> |
| 6 | 6 | ||
| 7 | #include <catch2/catch.hpp> | 7 | #include <catch2/catch_test_macros.hpp> |
| 8 | 8 | ||
| 9 | #include "common/alignment.h" | 9 | #include "common/alignment.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
diff --git a/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp b/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp index 85f1d13e0..5fa0d9620 100644 --- a/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp +++ b/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp | |||
| @@ -57,7 +57,7 @@ NsightAftermathTracker::NsightAftermathTracker() { | |||
| 57 | if (!GFSDK_Aftermath_SUCCEED(GFSDK_Aftermath_EnableGpuCrashDumps( | 57 | if (!GFSDK_Aftermath_SUCCEED(GFSDK_Aftermath_EnableGpuCrashDumps( |
| 58 | GFSDK_Aftermath_Version_API, GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags_Vulkan, | 58 | GFSDK_Aftermath_Version_API, GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags_Vulkan, |
| 59 | GFSDK_Aftermath_GpuCrashDumpFeatureFlags_Default, GpuCrashDumpCallback, | 59 | GFSDK_Aftermath_GpuCrashDumpFeatureFlags_Default, GpuCrashDumpCallback, |
| 60 | ShaderDebugInfoCallback, CrashDumpDescriptionCallback, this))) { | 60 | ShaderDebugInfoCallback, CrashDumpDescriptionCallback, nullptr, this))) { |
| 61 | LOG_ERROR(Render_Vulkan, "GFSDK_Aftermath_EnableGpuCrashDumps failed"); | 61 | LOG_ERROR(Render_Vulkan, "GFSDK_Aftermath_EnableGpuCrashDumps failed"); |
| 62 | return; | 62 | return; |
| 63 | } | 63 | } |
| @@ -83,7 +83,7 @@ void NsightAftermathTracker::SaveShader(std::span<const u32> spirv) const { | |||
| 83 | 83 | ||
| 84 | std::scoped_lock lock{mutex}; | 84 | std::scoped_lock lock{mutex}; |
| 85 | 85 | ||
| 86 | GFSDK_Aftermath_ShaderHash hash; | 86 | GFSDK_Aftermath_ShaderBinaryHash hash; |
| 87 | if (!GFSDK_Aftermath_SUCCEED( | 87 | if (!GFSDK_Aftermath_SUCCEED( |
| 88 | GFSDK_Aftermath_GetShaderHashSpirv(GFSDK_Aftermath_Version_API, &shader, &hash))) { | 88 | GFSDK_Aftermath_GetShaderHashSpirv(GFSDK_Aftermath_Version_API, &shader, &hash))) { |
| 89 | LOG_ERROR(Render_Vulkan, "Failed to hash SPIR-V module"); | 89 | LOG_ERROR(Render_Vulkan, "Failed to hash SPIR-V module"); |
| @@ -121,8 +121,8 @@ void NsightAftermathTracker::OnGpuCrashDumpCallback(const void* gpu_crash_dump, | |||
| 121 | u32 json_size = 0; | 121 | u32 json_size = 0; |
| 122 | if (!GFSDK_Aftermath_SUCCEED(GFSDK_Aftermath_GpuCrashDump_GenerateJSON( | 122 | if (!GFSDK_Aftermath_SUCCEED(GFSDK_Aftermath_GpuCrashDump_GenerateJSON( |
| 123 | decoder, GFSDK_Aftermath_GpuCrashDumpDecoderFlags_ALL_INFO, | 123 | decoder, GFSDK_Aftermath_GpuCrashDumpDecoderFlags_ALL_INFO, |
| 124 | GFSDK_Aftermath_GpuCrashDumpFormatterFlags_NONE, nullptr, nullptr, nullptr, nullptr, | 124 | GFSDK_Aftermath_GpuCrashDumpFormatterFlags_NONE, nullptr, nullptr, nullptr, this, |
| 125 | this, &json_size))) { | 125 | &json_size))) { |
| 126 | LOG_ERROR(Render_Vulkan, "Failed to generate JSON"); | 126 | LOG_ERROR(Render_Vulkan, "Failed to generate JSON"); |
| 127 | return; | 127 | return; |
| 128 | } | 128 | } |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index d8b26ebd8..35fef506a 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 | ||
| @@ -748,7 +748,7 @@ void Config::ReadShortcutValues() { | |||
| 748 | for (const auto& [name, group, shortcut] : default_hotkeys) { | 748 | for (const auto& [name, group, shortcut] : default_hotkeys) { |
| 749 | qt_config->beginGroup(group); | 749 | qt_config->beginGroup(group); |
| 750 | qt_config->beginGroup(name); | 750 | qt_config->beginGroup(name); |
| 751 | // No longer using ReadSetting for shortcut.second as it innacurately returns a value of 1 | 751 | // No longer using ReadSetting for shortcut.second as it inaccurately returns a value of 1 |
| 752 | // for WidgetWithChildrenShortcut which is a value of 3. Needed to fix shortcuts the open | 752 | // for WidgetWithChildrenShortcut which is a value of 3. Needed to fix shortcuts the open |
| 753 | // a file dialog in windowed mode | 753 | // a file dialog in windowed mode |
| 754 | UISettings::values.shortcuts.push_back( | 754 | UISettings::values.shortcuts.push_back( |
| @@ -757,7 +757,7 @@ void Config::ReadShortcutValues() { | |||
| 757 | {ReadSetting(QStringLiteral("KeySeq"), shortcut.keyseq).toString(), | 757 | {ReadSetting(QStringLiteral("KeySeq"), shortcut.keyseq).toString(), |
| 758 | ReadSetting(QStringLiteral("Controller_KeySeq"), shortcut.controller_keyseq) | 758 | ReadSetting(QStringLiteral("Controller_KeySeq"), shortcut.controller_keyseq) |
| 759 | .toString(), | 759 | .toString(), |
| 760 | shortcut.context}}); | 760 | shortcut.context, ReadSetting(QStringLiteral("Repeat"), shortcut.repeat).toBool()}}); |
| 761 | qt_config->endGroup(); | 761 | qt_config->endGroup(); |
| 762 | qt_config->endGroup(); | 762 | qt_config->endGroup(); |
| 763 | } | 763 | } |
| @@ -1395,6 +1395,7 @@ void Config::SaveShortcutValues() { | |||
| 1395 | WriteSetting(QStringLiteral("Controller_KeySeq"), shortcut.controller_keyseq, | 1395 | WriteSetting(QStringLiteral("Controller_KeySeq"), shortcut.controller_keyseq, |
| 1396 | default_hotkey.controller_keyseq); | 1396 | default_hotkey.controller_keyseq); |
| 1397 | WriteSetting(QStringLiteral("Context"), shortcut.context, default_hotkey.context); | 1397 | WriteSetting(QStringLiteral("Context"), shortcut.context, default_hotkey.context); |
| 1398 | WriteSetting(QStringLiteral("Repeat"), shortcut.repeat, default_hotkey.repeat); | ||
| 1398 | qt_config->endGroup(); | 1399 | qt_config->endGroup(); |
| 1399 | qt_config->endGroup(); | 1400 | qt_config->endGroup(); |
| 1400 | } | 1401 | } |
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 97fb664bf..ac42cc7fc 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp | |||
| @@ -92,3 +92,13 @@ void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, int global_index | |||
| 92 | combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); | 92 | combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); |
| 93 | combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); | 93 | combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); |
| 94 | } | 94 | } |
| 95 | |||
| 96 | int ConfigurationShared::GetComboboxIndex(int global_setting_index, const QComboBox* combobox) { | ||
| 97 | if (Settings::IsConfiguringGlobal()) { | ||
| 98 | return combobox->currentIndex(); | ||
| 99 | } | ||
| 100 | if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 101 | return global_setting_index; | ||
| 102 | } | ||
| 103 | return combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET; | ||
| 104 | } | ||
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index e597dcdb5..04c88758c 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h | |||
| @@ -69,4 +69,7 @@ void SetColoredComboBox(QComboBox* combobox, QWidget* target, int global); | |||
| 69 | // Adds the "Use Global Configuration" selection and separator to the beginning of a QComboBox | 69 | // Adds the "Use Global Configuration" selection and separator to the beginning of a QComboBox |
| 70 | void InsertGlobalItem(QComboBox* combobox, int global_index); | 70 | void InsertGlobalItem(QComboBox* combobox, int global_index); |
| 71 | 71 | ||
| 72 | // Returns the correct index of a QComboBox taking into account global configuration | ||
| 73 | int GetComboboxIndex(int global_setting_index, const QComboBox* combobox); | ||
| 74 | |||
| 72 | } // namespace ConfigurationShared | 75 | } // namespace ConfigurationShared |
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 94049f2f4..9ea4c02da 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -31,6 +31,9 @@ constexpr std::array<u32, 7> LOCALE_BLOCKLIST{ | |||
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | static bool IsValidLocale(u32 region_index, u32 language_index) { | 33 | static bool IsValidLocale(u32 region_index, u32 language_index) { |
| 34 | if (region_index >= LOCALE_BLOCKLIST.size()) { | ||
| 35 | return false; | ||
| 36 | } | ||
| 34 | return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0; | 37 | return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0; |
| 35 | } | 38 | } |
| 36 | 39 | ||
| @@ -55,8 +58,11 @@ ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) | |||
| 55 | }); | 58 | }); |
| 56 | 59 | ||
| 57 | const auto locale_check = [this](int index) { | 60 | const auto locale_check = [this](int index) { |
| 58 | const bool valid_locale = | 61 | const auto region_index = ConfigurationShared::GetComboboxIndex( |
| 59 | IsValidLocale(ui->combo_region->currentIndex(), ui->combo_language->currentIndex()); | 62 | Settings::values.region_index.GetValue(true), ui->combo_region); |
| 63 | const auto language_index = ConfigurationShared::GetComboboxIndex( | ||
| 64 | Settings::values.language_index.GetValue(true), ui->combo_language); | ||
| 65 | const bool valid_locale = IsValidLocale(region_index, language_index); | ||
| 60 | ui->label_warn_invalid_locale->setVisible(!valid_locale); | 66 | ui->label_warn_invalid_locale->setVisible(!valid_locale); |
| 61 | if (!valid_locale) { | 67 | if (!valid_locale) { |
| 62 | ui->label_warn_invalid_locale->setText( | 68 | ui->label_warn_invalid_locale->setText( |
diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index 8f02880a7..a7f086258 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h | |||
| @@ -42,13 +42,7 @@ private: | |||
| 42 | std::unique_ptr<Ui::ConfigureSystem> ui; | 42 | std::unique_ptr<Ui::ConfigureSystem> ui; |
| 43 | bool enabled = false; | 43 | bool enabled = false; |
| 44 | 44 | ||
| 45 | int language_index = 0; | ||
| 46 | int region_index = 0; | ||
| 47 | int time_zone_index = 0; | ||
| 48 | int sound_index = 0; | ||
| 49 | |||
| 50 | ConfigurationShared::CheckState use_rng_seed; | 45 | ConfigurationShared::CheckState use_rng_seed; |
| 51 | ConfigurationShared::CheckState use_custom_rtc; | ||
| 52 | 46 | ||
| 53 | Core::System& system; | 47 | Core::System& system; |
| 54 | }; | 48 | }; |
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 { |