diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_cp15.cpp | 31 | ||||
| -rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_cp15.h | 2 | ||||
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 30 | ||||
| -rw-r--r-- | src/core/hid/emulated_controller.h | 7 | ||||
| -rw-r--r-- | src/core/hid/hid_types.h | 12 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 77 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_swapchain.cpp | 5 | ||||
| -rw-r--r-- | src/yuzu/CMakeLists.txt | 14 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics_advanced.ui | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_ui.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 14 |
11 files changed, 157 insertions, 38 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp b/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp index e9123c13d..200efe4db 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp | |||
| @@ -8,6 +8,10 @@ | |||
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/core_timing.h" | 9 | #include "core/core_timing.h" |
| 10 | 10 | ||
| 11 | #ifdef _MSC_VER | ||
| 12 | #include <intrin.h> | ||
| 13 | #endif | ||
| 14 | |||
| 11 | using Callback = Dynarmic::A32::Coprocessor::Callback; | 15 | using Callback = Dynarmic::A32::Coprocessor::Callback; |
| 12 | using CallbackOrAccessOneWord = Dynarmic::A32::Coprocessor::CallbackOrAccessOneWord; | 16 | using CallbackOrAccessOneWord = Dynarmic::A32::Coprocessor::CallbackOrAccessOneWord; |
| 13 | using CallbackOrAccessTwoWords = Dynarmic::A32::Coprocessor::CallbackOrAccessTwoWords; | 17 | using CallbackOrAccessTwoWords = Dynarmic::A32::Coprocessor::CallbackOrAccessTwoWords; |
| @@ -47,12 +51,31 @@ CallbackOrAccessOneWord DynarmicCP15::CompileSendOneWord(bool two, unsigned opc1 | |||
| 47 | switch (opc2) { | 51 | switch (opc2) { |
| 48 | case 4: | 52 | case 4: |
| 49 | // CP15_DATA_SYNC_BARRIER | 53 | // CP15_DATA_SYNC_BARRIER |
| 50 | // This is a dummy write, we ignore the value written here. | 54 | return Callback{ |
| 51 | return &dummy_value; | 55 | [](Dynarmic::A32::Jit*, void*, std::uint32_t, std::uint32_t) -> std::uint64_t { |
| 56 | #ifdef _MSC_VER | ||
| 57 | _mm_mfence(); | ||
| 58 | _mm_lfence(); | ||
| 59 | #else | ||
| 60 | asm volatile("mfence\n\tlfence\n\t" : : : "memory"); | ||
| 61 | #endif | ||
| 62 | return 0; | ||
| 63 | }, | ||
| 64 | std::nullopt, | ||
| 65 | }; | ||
| 52 | case 5: | 66 | case 5: |
| 53 | // CP15_DATA_MEMORY_BARRIER | 67 | // CP15_DATA_MEMORY_BARRIER |
| 54 | // This is a dummy write, we ignore the value written here. | 68 | return Callback{ |
| 55 | return &dummy_value; | 69 | [](Dynarmic::A32::Jit*, void*, std::uint32_t, std::uint32_t) -> std::uint64_t { |
| 70 | #ifdef _MSC_VER | ||
| 71 | _mm_mfence(); | ||
| 72 | #else | ||
| 73 | asm volatile("mfence\n\t" : : : "memory"); | ||
| 74 | #endif | ||
| 75 | return 0; | ||
| 76 | }, | ||
| 77 | std::nullopt, | ||
| 78 | }; | ||
| 56 | } | 79 | } |
| 57 | } | 80 | } |
| 58 | 81 | ||
diff --git a/src/core/arm/dynarmic/arm_dynarmic_cp15.h b/src/core/arm/dynarmic/arm_dynarmic_cp15.h index 5b2a51636..d90b3e568 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_cp15.h +++ b/src/core/arm/dynarmic/arm_dynarmic_cp15.h | |||
| @@ -35,6 +35,8 @@ public: | |||
| 35 | ARM_Dynarmic_32& parent; | 35 | ARM_Dynarmic_32& parent; |
| 36 | u32 uprw = 0; | 36 | u32 uprw = 0; |
| 37 | u32 uro = 0; | 37 | u32 uro = 0; |
| 38 | |||
| 39 | friend class ARM_Dynarmic_32; | ||
| 38 | }; | 40 | }; |
| 39 | 41 | ||
| 40 | } // namespace Core | 42 | } // namespace Core |
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 8c3895937..049602e7d 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -1,6 +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 "common/thread.h" | ||
| 4 | #include "core/hid/emulated_controller.h" | 5 | #include "core/hid/emulated_controller.h" |
| 5 | #include "core/hid/input_converter.h" | 6 | #include "core/hid/input_converter.h" |
| 6 | 7 | ||
| @@ -84,18 +85,19 @@ void EmulatedController::ReloadFromSettings() { | |||
| 84 | motion_params[index] = Common::ParamPackage(player.motions[index]); | 85 | motion_params[index] = Common::ParamPackage(player.motions[index]); |
| 85 | } | 86 | } |
| 86 | 87 | ||
| 88 | controller.colors_state.fullkey = { | ||
| 89 | .body = GetNpadColor(player.body_color_left), | ||
| 90 | .button = GetNpadColor(player.button_color_left), | ||
| 91 | }; | ||
| 87 | controller.colors_state.left = { | 92 | controller.colors_state.left = { |
| 88 | .body = player.body_color_left, | 93 | .body = GetNpadColor(player.body_color_left), |
| 89 | .button = player.button_color_left, | 94 | .button = GetNpadColor(player.button_color_left), |
| 90 | }; | 95 | }; |
| 91 | 96 | controller.colors_state.left = { | |
| 92 | controller.colors_state.right = { | 97 | .body = GetNpadColor(player.body_color_right), |
| 93 | .body = player.body_color_right, | 98 | .button = GetNpadColor(player.button_color_right), |
| 94 | .button = player.button_color_right, | ||
| 95 | }; | 99 | }; |
| 96 | 100 | ||
| 97 | controller.colors_state.fullkey = controller.colors_state.left; | ||
| 98 | |||
| 99 | // Other or debug controller should always be a pro controller | 101 | // Other or debug controller should always be a pro controller |
| 100 | if (npad_id_type != NpadIdType::Other) { | 102 | if (npad_id_type != NpadIdType::Other) { |
| 101 | SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type)); | 103 | SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type)); |
| @@ -949,6 +951,9 @@ bool EmulatedController::TestVibration(std::size_t device_index) { | |||
| 949 | // Send a slight vibration to test for rumble support | 951 | // Send a slight vibration to test for rumble support |
| 950 | output_devices[device_index]->SetVibration(test_vibration); | 952 | output_devices[device_index]->SetVibration(test_vibration); |
| 951 | 953 | ||
| 954 | // Wait for about 15ms to ensure the controller is ready for the stop command | ||
| 955 | std::this_thread::sleep_for(std::chrono::milliseconds(15)); | ||
| 956 | |||
| 952 | // Stop any vibration and return the result | 957 | // Stop any vibration and return the result |
| 953 | return output_devices[device_index]->SetVibration(zero_vibration) == | 958 | return output_devices[device_index]->SetVibration(zero_vibration) == |
| 954 | Common::Input::VibrationError::None; | 959 | Common::Input::VibrationError::None; |
| @@ -1310,6 +1315,15 @@ const CameraState& EmulatedController::GetCamera() const { | |||
| 1310 | return controller.camera_state; | 1315 | return controller.camera_state; |
| 1311 | } | 1316 | } |
| 1312 | 1317 | ||
| 1318 | NpadColor EmulatedController::GetNpadColor(u32 color) { | ||
| 1319 | return { | ||
| 1320 | .r = static_cast<u8>((color >> 16) & 0xFF), | ||
| 1321 | .g = static_cast<u8>((color >> 8) & 0xFF), | ||
| 1322 | .b = static_cast<u8>(color & 0xFF), | ||
| 1323 | .a = 0xff, | ||
| 1324 | }; | ||
| 1325 | } | ||
| 1326 | |||
| 1313 | void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_npad_service_update) { | 1327 | void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_npad_service_update) { |
| 1314 | std::scoped_lock lock{callback_mutex}; | 1328 | std::scoped_lock lock{callback_mutex}; |
| 1315 | for (const auto& poller_pair : callback_list) { | 1329 | for (const auto& poller_pair : callback_list) { |
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index 823c1700c..cbd7c26d3 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h | |||
| @@ -425,6 +425,13 @@ private: | |||
| 425 | void SetCamera(const Common::Input::CallbackStatus& callback); | 425 | void SetCamera(const Common::Input::CallbackStatus& callback); |
| 426 | 426 | ||
| 427 | /** | 427 | /** |
| 428 | * Converts a color format from bgra to rgba | ||
| 429 | * @param color in bgra format | ||
| 430 | * @return NpadColor in rgba format | ||
| 431 | */ | ||
| 432 | NpadColor GetNpadColor(u32 color); | ||
| 433 | |||
| 434 | /** | ||
| 428 | * Triggers a callback that something has changed on the controller status | 435 | * Triggers a callback that something has changed on the controller status |
| 429 | * @param type Input type of the event to trigger | 436 | * @param type Input type of the event to trigger |
| 430 | * @param is_service_update indicates if this event should only be sent to HID services | 437 | * @param is_service_update indicates if this event should only be sent to HID services |
diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h index e49223016..e3b1cfbc6 100644 --- a/src/core/hid/hid_types.h +++ b/src/core/hid/hid_types.h | |||
| @@ -327,10 +327,18 @@ struct TouchState { | |||
| 327 | }; | 327 | }; |
| 328 | static_assert(sizeof(TouchState) == 0x28, "Touchstate is an invalid size"); | 328 | static_assert(sizeof(TouchState) == 0x28, "Touchstate is an invalid size"); |
| 329 | 329 | ||
| 330 | struct NpadColor { | ||
| 331 | u8 r{}; | ||
| 332 | u8 g{}; | ||
| 333 | u8 b{}; | ||
| 334 | u8 a{}; | ||
| 335 | }; | ||
| 336 | static_assert(sizeof(NpadColor) == 4, "NpadColor is an invalid size"); | ||
| 337 | |||
| 330 | // This is nn::hid::NpadControllerColor | 338 | // This is nn::hid::NpadControllerColor |
| 331 | struct NpadControllerColor { | 339 | struct NpadControllerColor { |
| 332 | u32 body{}; | 340 | NpadColor body{}; |
| 333 | u32 button{}; | 341 | NpadColor button{}; |
| 334 | }; | 342 | }; |
| 335 | static_assert(sizeof(NpadControllerColor) == 8, "NpadControllerColor is an invalid size"); | 343 | static_assert(sizeof(NpadControllerColor) == 8, "NpadControllerColor is an invalid size"); |
| 336 | 344 | ||
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 3c28dee76..cb29004e8 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -163,28 +163,51 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) { | |||
| 163 | } | 163 | } |
| 164 | LOG_DEBUG(Service_HID, "Npad connected {}", npad_id); | 164 | LOG_DEBUG(Service_HID, "Npad connected {}", npad_id); |
| 165 | const auto controller_type = controller.device->GetNpadStyleIndex(); | 165 | const auto controller_type = controller.device->GetNpadStyleIndex(); |
| 166 | const auto& body_colors = controller.device->GetColors(); | ||
| 167 | const auto& battery_level = controller.device->GetBattery(); | ||
| 166 | auto* shared_memory = controller.shared_memory; | 168 | auto* shared_memory = controller.shared_memory; |
| 167 | if (controller_type == Core::HID::NpadStyleIndex::None) { | 169 | if (controller_type == Core::HID::NpadStyleIndex::None) { |
| 168 | controller.styleset_changed_event->GetWritableEvent().Signal(); | 170 | controller.styleset_changed_event->GetWritableEvent().Signal(); |
| 169 | return; | 171 | return; |
| 170 | } | 172 | } |
| 173 | |||
| 174 | // Reset memory values | ||
| 171 | shared_memory->style_tag.raw = Core::HID::NpadStyleSet::None; | 175 | shared_memory->style_tag.raw = Core::HID::NpadStyleSet::None; |
| 172 | shared_memory->device_type.raw = 0; | 176 | shared_memory->device_type.raw = 0; |
| 173 | shared_memory->system_properties.raw = 0; | 177 | shared_memory->system_properties.raw = 0; |
| 178 | shared_memory->joycon_color.attribute = ColorAttribute::NoController; | ||
| 179 | shared_memory->joycon_color.attribute = ColorAttribute::NoController; | ||
| 180 | shared_memory->fullkey_color = {}; | ||
| 181 | shared_memory->joycon_color.left = {}; | ||
| 182 | shared_memory->joycon_color.right = {}; | ||
| 183 | shared_memory->battery_level_dual = {}; | ||
| 184 | shared_memory->battery_level_left = {}; | ||
| 185 | shared_memory->battery_level_right = {}; | ||
| 186 | |||
| 174 | switch (controller_type) { | 187 | switch (controller_type) { |
| 175 | case Core::HID::NpadStyleIndex::None: | 188 | case Core::HID::NpadStyleIndex::None: |
| 176 | ASSERT(false); | 189 | ASSERT(false); |
| 177 | break; | 190 | break; |
| 178 | case Core::HID::NpadStyleIndex::ProController: | 191 | case Core::HID::NpadStyleIndex::ProController: |
| 192 | shared_memory->fullkey_color.attribute = ColorAttribute::Ok; | ||
| 193 | shared_memory->fullkey_color.fullkey = body_colors.fullkey; | ||
| 194 | shared_memory->battery_level_dual = battery_level.dual.battery_level; | ||
| 179 | shared_memory->style_tag.fullkey.Assign(1); | 195 | shared_memory->style_tag.fullkey.Assign(1); |
| 180 | shared_memory->device_type.fullkey.Assign(1); | 196 | shared_memory->device_type.fullkey.Assign(1); |
| 181 | shared_memory->system_properties.is_vertical.Assign(1); | 197 | shared_memory->system_properties.is_vertical.Assign(1); |
| 182 | shared_memory->system_properties.use_plus.Assign(1); | 198 | shared_memory->system_properties.use_plus.Assign(1); |
| 183 | shared_memory->system_properties.use_minus.Assign(1); | 199 | shared_memory->system_properties.use_minus.Assign(1); |
| 200 | shared_memory->system_properties.is_charging_joy_dual.Assign( | ||
| 201 | battery_level.dual.is_charging); | ||
| 184 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::SwitchProController; | 202 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::SwitchProController; |
| 185 | shared_memory->sixaxis_fullkey_properties.is_newly_assigned.Assign(1); | 203 | shared_memory->sixaxis_fullkey_properties.is_newly_assigned.Assign(1); |
| 186 | break; | 204 | break; |
| 187 | case Core::HID::NpadStyleIndex::Handheld: | 205 | case Core::HID::NpadStyleIndex::Handheld: |
| 206 | shared_memory->fullkey_color.attribute = ColorAttribute::Ok; | ||
| 207 | shared_memory->joycon_color.attribute = ColorAttribute::Ok; | ||
| 208 | shared_memory->fullkey_color.fullkey = body_colors.fullkey; | ||
| 209 | shared_memory->joycon_color.left = body_colors.left; | ||
| 210 | shared_memory->joycon_color.right = body_colors.right; | ||
| 188 | shared_memory->style_tag.handheld.Assign(1); | 211 | shared_memory->style_tag.handheld.Assign(1); |
| 189 | shared_memory->device_type.handheld_left.Assign(1); | 212 | shared_memory->device_type.handheld_left.Assign(1); |
| 190 | shared_memory->device_type.handheld_right.Assign(1); | 213 | shared_memory->device_type.handheld_right.Assign(1); |
| @@ -192,47 +215,86 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) { | |||
| 192 | shared_memory->system_properties.use_plus.Assign(1); | 215 | shared_memory->system_properties.use_plus.Assign(1); |
| 193 | shared_memory->system_properties.use_minus.Assign(1); | 216 | shared_memory->system_properties.use_minus.Assign(1); |
| 194 | shared_memory->system_properties.use_directional_buttons.Assign(1); | 217 | shared_memory->system_properties.use_directional_buttons.Assign(1); |
| 218 | shared_memory->system_properties.is_charging_joy_dual.Assign( | ||
| 219 | battery_level.left.is_charging); | ||
| 220 | shared_memory->system_properties.is_charging_joy_left.Assign( | ||
| 221 | battery_level.left.is_charging); | ||
| 222 | shared_memory->system_properties.is_charging_joy_right.Assign( | ||
| 223 | battery_level.right.is_charging); | ||
| 195 | shared_memory->assignment_mode = NpadJoyAssignmentMode::Dual; | 224 | shared_memory->assignment_mode = NpadJoyAssignmentMode::Dual; |
| 196 | shared_memory->applet_nfc_xcd.applet_footer.type = | 225 | shared_memory->applet_nfc_xcd.applet_footer.type = |
| 197 | AppletFooterUiType::HandheldJoyConLeftJoyConRight; | 226 | AppletFooterUiType::HandheldJoyConLeftJoyConRight; |
| 198 | shared_memory->sixaxis_handheld_properties.is_newly_assigned.Assign(1); | 227 | shared_memory->sixaxis_handheld_properties.is_newly_assigned.Assign(1); |
| 199 | break; | 228 | break; |
| 200 | case Core::HID::NpadStyleIndex::JoyconDual: | 229 | case Core::HID::NpadStyleIndex::JoyconDual: |
| 230 | shared_memory->fullkey_color.attribute = ColorAttribute::Ok; | ||
| 231 | shared_memory->joycon_color.attribute = ColorAttribute::Ok; | ||
| 201 | shared_memory->style_tag.joycon_dual.Assign(1); | 232 | shared_memory->style_tag.joycon_dual.Assign(1); |
| 202 | if (controller.is_dual_left_connected) { | 233 | if (controller.is_dual_left_connected) { |
| 234 | shared_memory->joycon_color.left = body_colors.left; | ||
| 235 | shared_memory->battery_level_left = battery_level.left.battery_level; | ||
| 203 | shared_memory->device_type.joycon_left.Assign(1); | 236 | shared_memory->device_type.joycon_left.Assign(1); |
| 204 | shared_memory->system_properties.use_minus.Assign(1); | 237 | shared_memory->system_properties.use_minus.Assign(1); |
| 238 | shared_memory->system_properties.is_charging_joy_left.Assign( | ||
| 239 | battery_level.left.is_charging); | ||
| 205 | shared_memory->sixaxis_dual_left_properties.is_newly_assigned.Assign(1); | 240 | shared_memory->sixaxis_dual_left_properties.is_newly_assigned.Assign(1); |
| 206 | } | 241 | } |
| 207 | if (controller.is_dual_right_connected) { | 242 | if (controller.is_dual_right_connected) { |
| 243 | shared_memory->joycon_color.right = body_colors.right; | ||
| 244 | shared_memory->battery_level_right = battery_level.right.battery_level; | ||
| 208 | shared_memory->device_type.joycon_right.Assign(1); | 245 | shared_memory->device_type.joycon_right.Assign(1); |
| 209 | shared_memory->system_properties.use_plus.Assign(1); | 246 | shared_memory->system_properties.use_plus.Assign(1); |
| 247 | shared_memory->system_properties.is_charging_joy_right.Assign( | ||
| 248 | battery_level.right.is_charging); | ||
| 210 | shared_memory->sixaxis_dual_right_properties.is_newly_assigned.Assign(1); | 249 | shared_memory->sixaxis_dual_right_properties.is_newly_assigned.Assign(1); |
| 211 | } | 250 | } |
| 212 | shared_memory->system_properties.use_directional_buttons.Assign(1); | 251 | shared_memory->system_properties.use_directional_buttons.Assign(1); |
| 213 | shared_memory->system_properties.is_vertical.Assign(1); | 252 | shared_memory->system_properties.is_vertical.Assign(1); |
| 214 | shared_memory->assignment_mode = NpadJoyAssignmentMode::Dual; | 253 | shared_memory->assignment_mode = NpadJoyAssignmentMode::Dual; |
| 254 | |||
| 215 | if (controller.is_dual_left_connected && controller.is_dual_right_connected) { | 255 | if (controller.is_dual_left_connected && controller.is_dual_right_connected) { |
| 216 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::JoyDual; | 256 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::JoyDual; |
| 257 | shared_memory->fullkey_color.fullkey = body_colors.left; | ||
| 258 | shared_memory->battery_level_dual = battery_level.left.battery_level; | ||
| 259 | shared_memory->system_properties.is_charging_joy_dual.Assign( | ||
| 260 | battery_level.left.is_charging); | ||
| 217 | } else if (controller.is_dual_left_connected) { | 261 | } else if (controller.is_dual_left_connected) { |
| 218 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::JoyDualLeftOnly; | 262 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::JoyDualLeftOnly; |
| 263 | shared_memory->fullkey_color.fullkey = body_colors.left; | ||
| 264 | shared_memory->battery_level_dual = battery_level.left.battery_level; | ||
| 265 | shared_memory->system_properties.is_charging_joy_dual.Assign( | ||
| 266 | battery_level.left.is_charging); | ||
| 219 | } else { | 267 | } else { |
| 220 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::JoyDualRightOnly; | 268 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::JoyDualRightOnly; |
| 269 | shared_memory->fullkey_color.fullkey = body_colors.right; | ||
| 270 | shared_memory->battery_level_dual = battery_level.right.battery_level; | ||
| 271 | shared_memory->system_properties.is_charging_joy_dual.Assign( | ||
| 272 | battery_level.right.is_charging); | ||
| 221 | } | 273 | } |
| 222 | break; | 274 | break; |
| 223 | case Core::HID::NpadStyleIndex::JoyconLeft: | 275 | case Core::HID::NpadStyleIndex::JoyconLeft: |
| 276 | shared_memory->joycon_color.attribute = ColorAttribute::Ok; | ||
| 277 | shared_memory->joycon_color.left = body_colors.left; | ||
| 278 | shared_memory->battery_level_dual = battery_level.left.battery_level; | ||
| 224 | shared_memory->style_tag.joycon_left.Assign(1); | 279 | shared_memory->style_tag.joycon_left.Assign(1); |
| 225 | shared_memory->device_type.joycon_left.Assign(1); | 280 | shared_memory->device_type.joycon_left.Assign(1); |
| 226 | shared_memory->system_properties.is_horizontal.Assign(1); | 281 | shared_memory->system_properties.is_horizontal.Assign(1); |
| 227 | shared_memory->system_properties.use_minus.Assign(1); | 282 | shared_memory->system_properties.use_minus.Assign(1); |
| 283 | shared_memory->system_properties.is_charging_joy_left.Assign( | ||
| 284 | battery_level.left.is_charging); | ||
| 228 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::JoyLeftHorizontal; | 285 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::JoyLeftHorizontal; |
| 229 | shared_memory->sixaxis_left_properties.is_newly_assigned.Assign(1); | 286 | shared_memory->sixaxis_left_properties.is_newly_assigned.Assign(1); |
| 230 | break; | 287 | break; |
| 231 | case Core::HID::NpadStyleIndex::JoyconRight: | 288 | case Core::HID::NpadStyleIndex::JoyconRight: |
| 289 | shared_memory->joycon_color.attribute = ColorAttribute::Ok; | ||
| 290 | shared_memory->joycon_color.right = body_colors.right; | ||
| 291 | shared_memory->battery_level_right = battery_level.right.battery_level; | ||
| 232 | shared_memory->style_tag.joycon_right.Assign(1); | 292 | shared_memory->style_tag.joycon_right.Assign(1); |
| 233 | shared_memory->device_type.joycon_right.Assign(1); | 293 | shared_memory->device_type.joycon_right.Assign(1); |
| 234 | shared_memory->system_properties.is_horizontal.Assign(1); | 294 | shared_memory->system_properties.is_horizontal.Assign(1); |
| 235 | shared_memory->system_properties.use_plus.Assign(1); | 295 | shared_memory->system_properties.use_plus.Assign(1); |
| 296 | shared_memory->system_properties.is_charging_joy_right.Assign( | ||
| 297 | battery_level.right.is_charging); | ||
| 236 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::JoyRightHorizontal; | 298 | shared_memory->applet_nfc_xcd.applet_footer.type = AppletFooterUiType::JoyRightHorizontal; |
| 237 | shared_memory->sixaxis_right_properties.is_newly_assigned.Assign(1); | 299 | shared_memory->sixaxis_right_properties.is_newly_assigned.Assign(1); |
| 238 | break; | 300 | break; |
| @@ -269,21 +331,6 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) { | |||
| 269 | break; | 331 | break; |
| 270 | } | 332 | } |
| 271 | 333 | ||
| 272 | const auto& body_colors = controller.device->GetColors(); | ||
| 273 | |||
| 274 | shared_memory->fullkey_color.attribute = ColorAttribute::Ok; | ||
| 275 | shared_memory->fullkey_color.fullkey = body_colors.fullkey; | ||
| 276 | |||
| 277 | shared_memory->joycon_color.attribute = ColorAttribute::Ok; | ||
| 278 | shared_memory->joycon_color.left = body_colors.left; | ||
| 279 | shared_memory->joycon_color.right = body_colors.right; | ||
| 280 | |||
| 281 | // TODO: Investigate when we should report all batery types | ||
| 282 | const auto& battery_level = controller.device->GetBattery(); | ||
| 283 | shared_memory->battery_level_dual = battery_level.dual.battery_level; | ||
| 284 | shared_memory->battery_level_left = battery_level.left.battery_level; | ||
| 285 | shared_memory->battery_level_right = battery_level.right.battery_level; | ||
| 286 | |||
| 287 | controller.is_connected = true; | 334 | controller.is_connected = true; |
| 288 | controller.device->Connect(); | 335 | controller.device->Connect(); |
| 289 | SignalStyleSetChangedEvent(npad_id); | 336 | SignalStyleSetChangedEvent(npad_id); |
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index fa8efd22e..a69ae7725 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp | |||
| @@ -33,9 +33,10 @@ VkSurfaceFormatKHR ChooseSwapSurfaceFormat(vk::Span<VkSurfaceFormatKHR> formats) | |||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | VkPresentModeKHR ChooseSwapPresentMode(vk::Span<VkPresentModeKHR> modes) { | 35 | VkPresentModeKHR ChooseSwapPresentMode(vk::Span<VkPresentModeKHR> modes) { |
| 36 | // Mailbox doesn't lock the application like fifo (vsync), prefer it | 36 | // Mailbox (triple buffering) doesn't lock the application like fifo (vsync), |
| 37 | // prefer it if vsync option is not selected | ||
| 37 | const auto found_mailbox = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_MAILBOX_KHR); | 38 | const auto found_mailbox = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_MAILBOX_KHR); |
| 38 | if (found_mailbox != modes.end()) { | 39 | if (found_mailbox != modes.end() && !Settings::values.use_vsync.GetValue()) { |
| 39 | return VK_PRESENT_MODE_MAILBOX_KHR; | 40 | return VK_PRESENT_MODE_MAILBOX_KHR; |
| 40 | } | 41 | } |
| 41 | if (!Settings::values.use_speed_limit.GetValue()) { | 42 | if (!Settings::values.use_speed_limit.GetValue()) { |
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index f6b389ede..50007338f 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt | |||
| @@ -221,6 +221,9 @@ if (ENABLE_QT_TRANSLATION) | |||
| 221 | # Update source TS file if enabled | 221 | # Update source TS file if enabled |
| 222 | if (GENERATE_QT_TRANSLATION) | 222 | if (GENERATE_QT_TRANSLATION) |
| 223 | get_target_property(SRCS yuzu SOURCES) | 223 | get_target_property(SRCS yuzu SOURCES) |
| 224 | # these calls to qt_create_translation also creates a rule to generate en.qm which conflicts with providing english plurals | ||
| 225 | # so we have to set a OUTPUT_LOCATION so that we don't have multiple rules to generate en.qm | ||
| 226 | set_source_files_properties(${YUZU_QT_LANGUAGES}/en.ts PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/translations") | ||
| 224 | qt_create_translation(QM_FILES | 227 | qt_create_translation(QM_FILES |
| 225 | ${SRCS} | 228 | ${SRCS} |
| 226 | ${UIS} | 229 | ${UIS} |
| @@ -229,7 +232,13 @@ if (ENABLE_QT_TRANSLATION) | |||
| 229 | -source-language en_US | 232 | -source-language en_US |
| 230 | -target-language en_US | 233 | -target-language en_US |
| 231 | ) | 234 | ) |
| 232 | add_custom_target(translation ALL DEPENDS ${YUZU_QT_LANGUAGES}/en.ts) | 235 | |
| 236 | # Generate plurals into dist/english_plurals/generated_en.ts so it can be used to revise dist/english_plurals/en.ts | ||
| 237 | set(GENERATED_PLURALS_FILE ${PROJECT_SOURCE_DIR}/dist/english_plurals/generated_en.ts) | ||
| 238 | set_source_files_properties(${GENERATED_PLURALS_FILE} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/plurals") | ||
| 239 | qt_create_translation(QM_FILES ${SRCS} ${UIS} ${GENERATED_PLURALS_FILE} OPTIONS -pluralonly -source-language en_US -target-language en_US) | ||
| 240 | |||
| 241 | add_custom_target(translation ALL DEPENDS ${YUZU_QT_LANGUAGES}/en.ts ${GENERATED_PLURALS_FILE}) | ||
| 233 | endif() | 242 | endif() |
| 234 | 243 | ||
| 235 | # Find all TS files except en.ts | 244 | # Find all TS files except en.ts |
| @@ -239,6 +248,9 @@ if (ENABLE_QT_TRANSLATION) | |||
| 239 | # Compile TS files to QM files | 248 | # Compile TS files to QM files |
| 240 | qt_add_translation(LANGUAGES_QM ${LANGUAGES_TS}) | 249 | qt_add_translation(LANGUAGES_QM ${LANGUAGES_TS}) |
| 241 | 250 | ||
| 251 | # Compile english plurals TS file to en.qm | ||
| 252 | qt_add_translation(LANGUAGES_QM ${PROJECT_SOURCE_DIR}/dist/english_plurals/en.ts) | ||
| 253 | |||
| 242 | # Build a QRC file from the QM file list | 254 | # Build a QRC file from the QM file list |
| 243 | set(LANGUAGES_QRC ${CMAKE_CURRENT_BINARY_DIR}/languages.qrc) | 255 | set(LANGUAGES_QRC ${CMAKE_CURRENT_BINARY_DIR}/languages.qrc) |
| 244 | file(WRITE ${LANGUAGES_QRC} "<RCC><qresource prefix=\"languages\">\n") | 256 | file(WRITE ${LANGUAGES_QRC} "<RCC><qresource prefix=\"languages\">\n") |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.ui b/src/yuzu/configuration/configure_graphics_advanced.ui index 96de0b3d1..d6d819364 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.ui +++ b/src/yuzu/configuration/configure_graphics_advanced.ui | |||
| @@ -75,7 +75,7 @@ | |||
| 75 | <string>VSync prevents the screen from tearing, but some graphics cards have lower performance with VSync enabled. Keep it enabled if you don't notice a performance difference.</string> | 75 | <string>VSync prevents the screen from tearing, but some graphics cards have lower performance with VSync enabled. Keep it enabled if you don't notice a performance difference.</string> |
| 76 | </property> | 76 | </property> |
| 77 | <property name="text"> | 77 | <property name="text"> |
| 78 | <string>Use VSync (OpenGL only)</string> | 78 | <string>Use VSync</string> |
| 79 | </property> | 79 | </property> |
| 80 | </widget> | 80 | </widget> |
| 81 | </item> | 81 | </item> |
diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 2e98ede8e..48f71b53c 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp | |||
| @@ -219,6 +219,7 @@ void ConfigureUi::InitializeLanguageComboBox() { | |||
| 219 | for (const auto& lang : languages) { | 219 | for (const auto& lang : languages) { |
| 220 | if (QString::fromLatin1(lang.id) == QStringLiteral("en")) { | 220 | if (QString::fromLatin1(lang.id) == QStringLiteral("en")) { |
| 221 | ui->language_combobox->addItem(lang.name, QStringLiteral("en")); | 221 | ui->language_combobox->addItem(lang.name, QStringLiteral("en")); |
| 222 | language_files.removeOne(QStringLiteral("en.qm")); | ||
| 222 | continue; | 223 | continue; |
| 223 | } | 224 | } |
| 224 | for (int i = 0; i < language_files.size(); ++i) { | 225 | for (int i = 0; i < language_files.size(); ++i) { |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 653280642..f82bec3b7 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -3980,11 +3980,6 @@ void GMainWindow::UpdateUITheme() { | |||
| 3980 | } | 3980 | } |
| 3981 | 3981 | ||
| 3982 | void GMainWindow::LoadTranslation() { | 3982 | void GMainWindow::LoadTranslation() { |
| 3983 | // If the selected language is English, no need to install any translation | ||
| 3984 | if (UISettings::values.language == QStringLiteral("en")) { | ||
| 3985 | return; | ||
| 3986 | } | ||
| 3987 | |||
| 3988 | bool loaded; | 3983 | bool loaded; |
| 3989 | 3984 | ||
| 3990 | if (UISettings::values.language.isEmpty()) { | 3985 | if (UISettings::values.language.isEmpty()) { |
| @@ -4072,6 +4067,15 @@ int main(int argc, char* argv[]) { | |||
| 4072 | QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity); | 4067 | QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity); |
| 4073 | QApplication app(argc, argv); | 4068 | QApplication app(argc, argv); |
| 4074 | 4069 | ||
| 4070 | // Workaround for QTBUG-85409, for Suzhou numerals the number 1 is actually \u3021 | ||
| 4071 | // so we can see if we get \u3008 instead | ||
| 4072 | // TL;DR all other number formats are consecutive in unicode code points | ||
| 4073 | // This bug is fixed in Qt6, specifically 6.0.0-alpha1 | ||
| 4074 | const QLocale locale = QLocale::system(); | ||
| 4075 | if (QStringLiteral("\u3008") == locale.toString(1)) { | ||
| 4076 | QLocale::setDefault(QLocale::system().name()); | ||
| 4077 | } | ||
| 4078 | |||
| 4075 | // Qt changes the locale and causes issues in float conversion using std::to_string() when | 4079 | // Qt changes the locale and causes issues in float conversion using std::to_string() when |
| 4076 | // generating shaders | 4080 | // generating shaders |
| 4077 | setlocale(LC_ALL, "C"); | 4081 | setlocale(LC_ALL, "C"); |