diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/common/demangle.cpp | 35 | ||||
| -rw-r--r-- | src/common/demangle.h | 12 | ||||
| -rw-r--r-- | src/common/input.h | 68 | ||||
| -rw-r--r-- | src/common/settings.h | 1 |
5 files changed, 92 insertions, 28 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 45332cf95..9884a4a0b 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 LLVM::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..3310faf86 --- /dev/null +++ b/src/common/demangle.cpp | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include <llvm/Demangle/Demangle.h> | ||
| 5 | |||
| 6 | #include "common/demangle.h" | ||
| 7 | #include "common/scope_exit.h" | ||
| 8 | |||
| 9 | namespace Common { | ||
| 10 | |||
| 11 | std::string DemangleSymbol(const std::string& mangled) { | ||
| 12 | auto is_itanium = [](const std::string& name) -> bool { | ||
| 13 | // A valid Itanium encoding requires 1-4 leading underscores, followed by 'Z'. | ||
| 14 | auto pos = name.find_first_not_of('_'); | ||
| 15 | return pos > 0 && pos <= 4 && pos < name.size() && name[pos] == 'Z'; | ||
| 16 | }; | ||
| 17 | |||
| 18 | if (mangled.empty()) { | ||
| 19 | return mangled; | ||
| 20 | } | ||
| 21 | |||
| 22 | char* demangled = nullptr; | ||
| 23 | SCOPE_EXIT({ std::free(demangled); }); | ||
| 24 | |||
| 25 | if (is_itanium(mangled)) { | ||
| 26 | demangled = llvm::itaniumDemangle(mangled.c_str(), nullptr, nullptr, nullptr); | ||
| 27 | } | ||
| 28 | |||
| 29 | if (!demangled) { | ||
| 30 | return mangled; | ||
| 31 | } | ||
| 32 | return demangled; | ||
| 33 | } | ||
| 34 | |||
| 35 | } // 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/common/input.h b/src/common/input.h index d27b1d772..d61cd7ca8 100644 --- a/src/common/input.h +++ b/src/common/input.h | |||
| @@ -51,6 +51,8 @@ enum class PollingMode { | |||
| 51 | NFC, | 51 | NFC, |
| 52 | // Enable infrared camera polling | 52 | // Enable infrared camera polling |
| 53 | IR, | 53 | IR, |
| 54 | // Enable ring controller polling | ||
| 55 | Ring, | ||
| 54 | }; | 56 | }; |
| 55 | 57 | ||
| 56 | enum class CameraFormat { | 58 | enum class CameraFormat { |
| @@ -62,21 +64,22 @@ enum class CameraFormat { | |||
| 62 | None, | 64 | None, |
| 63 | }; | 65 | }; |
| 64 | 66 | ||
| 65 | // Vibration reply from the controller | 67 | // Different results that can happen from a device request |
| 66 | enum class VibrationError { | 68 | enum class DriverResult { |
| 67 | None, | 69 | Success, |
| 70 | WrongReply, | ||
| 71 | Timeout, | ||
| 72 | UnsupportedControllerType, | ||
| 73 | HandleInUse, | ||
| 74 | ErrorReadingData, | ||
| 75 | ErrorWritingData, | ||
| 76 | NoDeviceDetected, | ||
| 77 | InvalidHandle, | ||
| 68 | NotSupported, | 78 | NotSupported, |
| 69 | Disabled, | 79 | Disabled, |
| 70 | Unknown, | 80 | Unknown, |
| 71 | }; | 81 | }; |
| 72 | 82 | ||
| 73 | // Polling mode reply from the controller | ||
| 74 | enum class PollingError { | ||
| 75 | None, | ||
| 76 | NotSupported, | ||
| 77 | Unknown, | ||
| 78 | }; | ||
| 79 | |||
| 80 | // Nfc reply from the controller | 83 | // Nfc reply from the controller |
| 81 | enum class NfcState { | 84 | enum class NfcState { |
| 82 | Success, | 85 | Success, |
| @@ -90,13 +93,6 @@ enum class NfcState { | |||
| 90 | Unknown, | 93 | Unknown, |
| 91 | }; | 94 | }; |
| 92 | 95 | ||
| 93 | // Ir camera reply from the controller | ||
| 94 | enum class CameraError { | ||
| 95 | None, | ||
| 96 | NotSupported, | ||
| 97 | Unknown, | ||
| 98 | }; | ||
| 99 | |||
| 100 | // Hint for amplification curve to be used | 96 | // Hint for amplification curve to be used |
| 101 | enum class VibrationAmplificationType { | 97 | enum class VibrationAmplificationType { |
| 102 | Linear, | 98 | Linear, |
| @@ -190,6 +186,8 @@ struct TouchStatus { | |||
| 190 | struct BodyColorStatus { | 186 | struct BodyColorStatus { |
| 191 | u32 body{}; | 187 | u32 body{}; |
| 192 | u32 buttons{}; | 188 | u32 buttons{}; |
| 189 | u32 left_grip{}; | ||
| 190 | u32 right_grip{}; | ||
| 193 | }; | 191 | }; |
| 194 | 192 | ||
| 195 | // HD rumble data | 193 | // HD rumble data |
| @@ -228,17 +226,31 @@ enum class ButtonNames { | |||
| 228 | Engine, | 226 | Engine, |
| 229 | // This will display the button by value instead of the button name | 227 | // This will display the button by value instead of the button name |
| 230 | Value, | 228 | Value, |
| 229 | |||
| 230 | // Joycon button names | ||
| 231 | ButtonLeft, | 231 | ButtonLeft, |
| 232 | ButtonRight, | 232 | ButtonRight, |
| 233 | ButtonDown, | 233 | ButtonDown, |
| 234 | ButtonUp, | 234 | ButtonUp, |
| 235 | TriggerZ, | ||
| 236 | TriggerR, | ||
| 237 | TriggerL, | ||
| 238 | ButtonA, | 235 | ButtonA, |
| 239 | ButtonB, | 236 | ButtonB, |
| 240 | ButtonX, | 237 | ButtonX, |
| 241 | ButtonY, | 238 | ButtonY, |
| 239 | ButtonPlus, | ||
| 240 | ButtonMinus, | ||
| 241 | ButtonHome, | ||
| 242 | ButtonCapture, | ||
| 243 | ButtonStickL, | ||
| 244 | ButtonStickR, | ||
| 245 | TriggerL, | ||
| 246 | TriggerZL, | ||
| 247 | TriggerSL, | ||
| 248 | TriggerR, | ||
| 249 | TriggerZR, | ||
| 250 | TriggerSR, | ||
| 251 | |||
| 252 | // GC button names | ||
| 253 | TriggerZ, | ||
| 242 | ButtonStart, | 254 | ButtonStart, |
| 243 | 255 | ||
| 244 | // DS4 button names | 256 | // DS4 button names |
| @@ -316,22 +328,24 @@ class OutputDevice { | |||
| 316 | public: | 328 | public: |
| 317 | virtual ~OutputDevice() = default; | 329 | virtual ~OutputDevice() = default; |
| 318 | 330 | ||
| 319 | virtual void SetLED([[maybe_unused]] const LedStatus& led_status) {} | 331 | virtual DriverResult SetLED([[maybe_unused]] const LedStatus& led_status) { |
| 332 | return DriverResult::NotSupported; | ||
| 333 | } | ||
| 320 | 334 | ||
| 321 | virtual VibrationError SetVibration([[maybe_unused]] const VibrationStatus& vibration_status) { | 335 | virtual DriverResult SetVibration([[maybe_unused]] const VibrationStatus& vibration_status) { |
| 322 | return VibrationError::NotSupported; | 336 | return DriverResult::NotSupported; |
| 323 | } | 337 | } |
| 324 | 338 | ||
| 325 | virtual bool IsVibrationEnabled() { | 339 | virtual bool IsVibrationEnabled() { |
| 326 | return false; | 340 | return false; |
| 327 | } | 341 | } |
| 328 | 342 | ||
| 329 | virtual PollingError SetPollingMode([[maybe_unused]] PollingMode polling_mode) { | 343 | virtual DriverResult SetPollingMode([[maybe_unused]] PollingMode polling_mode) { |
| 330 | return PollingError::NotSupported; | 344 | return DriverResult::NotSupported; |
| 331 | } | 345 | } |
| 332 | 346 | ||
| 333 | virtual CameraError SetCameraFormat([[maybe_unused]] CameraFormat camera_format) { | 347 | virtual DriverResult SetCameraFormat([[maybe_unused]] CameraFormat camera_format) { |
| 334 | return CameraError::NotSupported; | 348 | return DriverResult::NotSupported; |
| 335 | } | 349 | } |
| 336 | 350 | ||
| 337 | virtual NfcState SupportsNfc() const { | 351 | virtual NfcState SupportsNfc() const { |
diff --git a/src/common/settings.h b/src/common/settings.h index 80b2eeabc..4b4da4da2 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -483,6 +483,7 @@ struct Values { | |||
| 483 | 483 | ||
| 484 | Setting<bool> enable_raw_input{false, "enable_raw_input"}; | 484 | Setting<bool> enable_raw_input{false, "enable_raw_input"}; |
| 485 | Setting<bool> controller_navigation{true, "controller_navigation"}; | 485 | Setting<bool> controller_navigation{true, "controller_navigation"}; |
| 486 | Setting<bool> enable_joycon_driver{true, "enable_joycon_driver"}; | ||
| 486 | 487 | ||
| 487 | SwitchableSetting<bool> vibration_enabled{true, "vibration_enabled"}; | 488 | SwitchableSetting<bool> vibration_enabled{true, "vibration_enabled"}; |
| 488 | SwitchableSetting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"}; | 489 | SwitchableSetting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"}; |