diff options
| -rw-r--r-- | src/core/hid/emulated_console.cpp | 2 | ||||
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_scheduler.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 23 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 3 | ||||
| -rw-r--r-- | src/input_common/drivers/mouse.cpp | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 6 | ||||
| -rw-r--r-- | src/input_common/input_engine.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/host_shaders/astc_decoder.comp | 80 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 11 | ||||
| -rw-r--r-- | src/yuzu/uisettings.h | 9 |
11 files changed, 86 insertions, 56 deletions
diff --git a/src/core/hid/emulated_console.cpp b/src/core/hid/emulated_console.cpp index 08f8af551..eef0ff493 100644 --- a/src/core/hid/emulated_console.cpp +++ b/src/core/hid/emulated_console.cpp | |||
| @@ -158,7 +158,7 @@ void EmulatedConsole::SetMotion(const Common::Input::CallbackStatus& callback) { | |||
| 158 | auto& motion = console.motion_state; | 158 | auto& motion = console.motion_state; |
| 159 | motion.accel = emulated.GetAcceleration(); | 159 | motion.accel = emulated.GetAcceleration(); |
| 160 | motion.gyro = emulated.GetGyroscope(); | 160 | motion.gyro = emulated.GetGyroscope(); |
| 161 | motion.rotation = emulated.GetGyroscope(); | 161 | motion.rotation = emulated.GetRotations(); |
| 162 | motion.orientation = emulated.GetOrientation(); | 162 | motion.orientation = emulated.GetOrientation(); |
| 163 | motion.quaternion = emulated.GetQuaternion(); | 163 | motion.quaternion = emulated.GetQuaternion(); |
| 164 | motion.gyro_bias = emulated.GetGyroBias(); | 164 | motion.gyro_bias = emulated.GetGyroBias(); |
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 13edb7332..d12037b11 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -145,7 +145,7 @@ void EmulatedController::LoadDevices() { | |||
| 145 | motion_devices.begin(), Common::Input::CreateDevice<Common::Input::InputDevice>); | 145 | motion_devices.begin(), Common::Input::CreateDevice<Common::Input::InputDevice>); |
| 146 | std::transform(trigger_params.begin(), trigger_params.end(), trigger_devices.begin(), | 146 | std::transform(trigger_params.begin(), trigger_params.end(), trigger_devices.begin(), |
| 147 | Common::Input::CreateDevice<Common::Input::InputDevice>); | 147 | Common::Input::CreateDevice<Common::Input::InputDevice>); |
| 148 | std::transform(battery_params.begin(), battery_params.begin(), battery_devices.end(), | 148 | std::transform(battery_params.begin(), battery_params.end(), battery_devices.begin(), |
| 149 | Common::Input::CreateDevice<Common::Input::InputDevice>); | 149 | Common::Input::CreateDevice<Common::Input::InputDevice>); |
| 150 | std::transform(output_params.begin(), output_params.end(), output_devices.begin(), | 150 | std::transform(output_params.begin(), output_params.end(), output_devices.begin(), |
| 151 | Common::Input::CreateDevice<Common::Input::OutputDevice>); | 151 | Common::Input::CreateDevice<Common::Input::OutputDevice>); |
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp index 31cec990e..f900b2e7a 100644 --- a/src/core/hle/kernel/k_scheduler.cpp +++ b/src/core/hle/kernel/k_scheduler.cpp | |||
| @@ -49,8 +49,6 @@ void KScheduler::RescheduleCores(KernelCore& kernel, u64 cores_pending_reschedul | |||
| 49 | if (!must_context_switch || core != current_core) { | 49 | if (!must_context_switch || core != current_core) { |
| 50 | auto& phys_core = kernel.PhysicalCore(core); | 50 | auto& phys_core = kernel.PhysicalCore(core); |
| 51 | phys_core.Interrupt(); | 51 | phys_core.Interrupt(); |
| 52 | } else { | ||
| 53 | must_context_switch = true; | ||
| 54 | } | 52 | } |
| 55 | cores_pending_reschedule &= ~(1ULL << core); | 53 | cores_pending_reschedule &= ~(1ULL << core); |
| 56 | } | 54 | } |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 93c0cdaee..e5cf9abb3 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -52,7 +52,8 @@ namespace Kernel { | |||
| 52 | 52 | ||
| 53 | struct KernelCore::Impl { | 53 | struct KernelCore::Impl { |
| 54 | explicit Impl(Core::System& system_, KernelCore& kernel_) | 54 | explicit Impl(Core::System& system_, KernelCore& kernel_) |
| 55 | : time_manager{system_}, object_list_container{kernel_}, system{system_} {} | 55 | : time_manager{system_}, object_list_container{kernel_}, |
| 56 | service_threads_manager{1, "yuzu:ServiceThreadsManager"}, system{system_} {} | ||
| 56 | 57 | ||
| 57 | void SetMulticore(bool is_multi) { | 58 | void SetMulticore(bool is_multi) { |
| 58 | is_multicore = is_multi; | 59 | is_multicore = is_multi; |
| @@ -708,24 +709,22 @@ struct KernelCore::Impl { | |||
| 708 | std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(KernelCore& kernel, | 709 | std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(KernelCore& kernel, |
| 709 | const std::string& name) { | 710 | const std::string& name) { |
| 710 | auto service_thread = std::make_shared<Kernel::ServiceThread>(kernel, 1, name); | 711 | auto service_thread = std::make_shared<Kernel::ServiceThread>(kernel, 1, name); |
| 711 | { | 712 | |
| 712 | std::lock_guard lk(service_threads_lock); | 713 | service_threads_manager.QueueWork( |
| 713 | service_threads.emplace(service_thread); | 714 | [this, service_thread]() { service_threads.emplace(service_thread); }); |
| 714 | } | 715 | |
| 715 | return service_thread; | 716 | return service_thread; |
| 716 | } | 717 | } |
| 717 | 718 | ||
| 718 | void ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread) { | 719 | void ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread) { |
| 719 | auto strong_ptr = service_thread.lock(); | 720 | if (auto strong_ptr = service_thread.lock()) { |
| 720 | { | 721 | service_threads_manager.QueueWork( |
| 721 | std::lock_guard lk(service_threads_lock); | 722 | [this, strong_ptr{std::move(strong_ptr)}]() { service_threads.erase(strong_ptr); }); |
| 722 | service_threads.erase(strong_ptr); | ||
| 723 | } | 723 | } |
| 724 | } | 724 | } |
| 725 | 725 | ||
| 726 | void ClearServiceThreads() { | 726 | void ClearServiceThreads() { |
| 727 | std::lock_guard lk(service_threads_lock); | 727 | service_threads_manager.QueueWork([this]() { service_threads.clear(); }); |
| 728 | service_threads.clear(); | ||
| 729 | } | 728 | } |
| 730 | 729 | ||
| 731 | std::mutex server_ports_lock; | 730 | std::mutex server_ports_lock; |
| @@ -733,7 +732,6 @@ struct KernelCore::Impl { | |||
| 733 | std::mutex registered_objects_lock; | 732 | std::mutex registered_objects_lock; |
| 734 | std::mutex registered_in_use_objects_lock; | 733 | std::mutex registered_in_use_objects_lock; |
| 735 | std::mutex dummy_thread_lock; | 734 | std::mutex dummy_thread_lock; |
| 736 | std::mutex service_threads_lock; | ||
| 737 | 735 | ||
| 738 | std::atomic<u32> next_object_id{0}; | 736 | std::atomic<u32> next_object_id{0}; |
| 739 | std::atomic<u64> next_kernel_process_id{KProcess::InitialKIPIDMin}; | 737 | std::atomic<u64> next_kernel_process_id{KProcess::InitialKIPIDMin}; |
| @@ -784,6 +782,7 @@ struct KernelCore::Impl { | |||
| 784 | 782 | ||
| 785 | // Threads used for services | 783 | // Threads used for services |
| 786 | std::unordered_set<std::shared_ptr<Kernel::ServiceThread>> service_threads; | 784 | std::unordered_set<std::shared_ptr<Kernel::ServiceThread>> service_threads; |
| 785 | Common::ThreadWorker service_threads_manager; | ||
| 787 | 786 | ||
| 788 | std::array<KThread*, Core::Hardware::NUM_CPU_CORES> suspend_threads; | 787 | std::array<KThread*, Core::Hardware::NUM_CPU_CORES> suspend_threads; |
| 789 | std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES> interrupts{}; | 788 | std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES> interrupts{}; |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 6e12381fb..84da38b3b 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -37,7 +37,8 @@ namespace Service::HID { | |||
| 37 | // Period time is obtained by measuring the number of samples in a second on HW using a homebrew | 37 | // Period time is obtained by measuring the number of samples in a second on HW using a homebrew |
| 38 | constexpr auto pad_update_ns = std::chrono::nanoseconds{4 * 1000 * 1000}; // (4ms, 250Hz) | 38 | constexpr auto pad_update_ns = std::chrono::nanoseconds{4 * 1000 * 1000}; // (4ms, 250Hz) |
| 39 | constexpr auto mouse_keyboard_update_ns = std::chrono::nanoseconds{8 * 1000 * 1000}; // (8ms, 125Hz) | 39 | constexpr auto mouse_keyboard_update_ns = std::chrono::nanoseconds{8 * 1000 * 1000}; // (8ms, 125Hz) |
| 40 | constexpr auto motion_update_ns = std::chrono::nanoseconds{5 * 1000 * 1000}; // (5ms, 200Hz) | 40 | // TODO: Correct update rate for motion is 5ms. Check why some games don't behave at that speed |
| 41 | constexpr auto motion_update_ns = std::chrono::nanoseconds{10 * 1000 * 1000}; // (10ms, 100Hz) | ||
| 41 | constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000; | 42 | constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000; |
| 42 | 43 | ||
| 43 | IAppletResource::IAppletResource(Core::System& system_, | 44 | IAppletResource::IAppletResource(Core::System& system_, |
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index aa69216c8..ac61591b0 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp | |||
| @@ -31,7 +31,7 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_)) | |||
| 31 | PreSetAxis(identifier, wheel_axis_x); | 31 | PreSetAxis(identifier, wheel_axis_x); |
| 32 | PreSetAxis(identifier, wheel_axis_y); | 32 | PreSetAxis(identifier, wheel_axis_y); |
| 33 | PreSetAxis(identifier, touch_axis_x); | 33 | PreSetAxis(identifier, touch_axis_x); |
| 34 | PreSetAxis(identifier, touch_axis_x); | 34 | PreSetAxis(identifier, touch_axis_y); |
| 35 | update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); }); | 35 | update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); }); |
| 36 | } | 36 | } |
| 37 | 37 | ||
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 757117f2b..41701e24d 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp | |||
| @@ -201,6 +201,12 @@ public: | |||
| 201 | return "XBox 360 Controller"; | 201 | return "XBox 360 Controller"; |
| 202 | case SDL_CONTROLLER_TYPE_XBOXONE: | 202 | case SDL_CONTROLLER_TYPE_XBOXONE: |
| 203 | return "XBox One Controller"; | 203 | return "XBox One Controller"; |
| 204 | case SDL_CONTROLLER_TYPE_PS3: | ||
| 205 | return "DualShock 3 Controller"; | ||
| 206 | case SDL_CONTROLLER_TYPE_PS4: | ||
| 207 | return "DualShock 4 Controller"; | ||
| 208 | case SDL_CONTROLLER_TYPE_PS5: | ||
| 209 | return "DualSense Controller"; | ||
| 204 | default: | 210 | default: |
| 205 | break; | 211 | break; |
| 206 | } | 212 | } |
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp index b57330e51..0508b408d 100644 --- a/src/input_common/input_engine.cpp +++ b/src/input_common/input_engine.cpp | |||
| @@ -173,7 +173,7 @@ void InputEngine::ResetButtonState() { | |||
| 173 | SetButton(controller.first, button.first, false); | 173 | SetButton(controller.first, button.first, false); |
| 174 | } | 174 | } |
| 175 | for (const auto& button : controller.second.hat_buttons) { | 175 | for (const auto& button : controller.second.hat_buttons) { |
| 176 | SetHatButton(controller.first, button.first, false); | 176 | SetHatButton(controller.first, button.first, 0); |
| 177 | } | 177 | } |
| 178 | } | 178 | } |
| 179 | } | 179 | } |
diff --git a/src/video_core/host_shaders/astc_decoder.comp b/src/video_core/host_shaders/astc_decoder.comp index f34c5f5d9..3a10578cb 100644 --- a/src/video_core/host_shaders/astc_decoder.comp +++ b/src/video_core/host_shaders/astc_decoder.comp | |||
| @@ -155,9 +155,6 @@ uint SwizzleOffset(uvec2 pos) { | |||
| 155 | // Replicates low num_bits such that [(to_bit - 1):(to_bit - 1 - from_bit)] | 155 | // Replicates low num_bits such that [(to_bit - 1):(to_bit - 1 - from_bit)] |
| 156 | // is the same as [(num_bits - 1):0] and repeats all the way down. | 156 | // is the same as [(num_bits - 1):0] and repeats all the way down. |
| 157 | uint Replicate(uint val, uint num_bits, uint to_bit) { | 157 | uint Replicate(uint val, uint num_bits, uint to_bit) { |
| 158 | if (num_bits == 0 || to_bit == 0) { | ||
| 159 | return 0; | ||
| 160 | } | ||
| 161 | const uint v = val & uint((1 << num_bits) - 1); | 158 | const uint v = val & uint((1 << num_bits) - 1); |
| 162 | uint res = v; | 159 | uint res = v; |
| 163 | uint reslen = num_bits; | 160 | uint reslen = num_bits; |
| @@ -187,42 +184,57 @@ uint ReplicateBitTo9(uint value) { | |||
| 187 | return REPLICATE_1_BIT_TO_9_TABLE[value]; | 184 | return REPLICATE_1_BIT_TO_9_TABLE[value]; |
| 188 | } | 185 | } |
| 189 | 186 | ||
| 190 | uint FastReplicateTo8(uint value, uint num_bits) { | 187 | uint FastReplicate(uint value, uint num_bits, uint to_bit) { |
| 191 | switch (num_bits) { | 188 | if (num_bits == 0) { |
| 192 | case 1: | 189 | return 0; |
| 193 | return REPLICATE_1_BIT_TO_8_TABLE[value]; | 190 | } |
| 194 | case 2: | 191 | if (num_bits == to_bit) { |
| 195 | return REPLICATE_2_BIT_TO_8_TABLE[value]; | ||
| 196 | case 3: | ||
| 197 | return REPLICATE_3_BIT_TO_8_TABLE[value]; | ||
| 198 | case 4: | ||
| 199 | return REPLICATE_4_BIT_TO_8_TABLE[value]; | ||
| 200 | case 5: | ||
| 201 | return REPLICATE_5_BIT_TO_8_TABLE[value]; | ||
| 202 | case 6: | ||
| 203 | return REPLICATE_6_BIT_TO_8_TABLE[value]; | ||
| 204 | case 7: | ||
| 205 | return REPLICATE_7_BIT_TO_8_TABLE[value]; | ||
| 206 | case 8: | ||
| 207 | return value; | 192 | return value; |
| 208 | } | 193 | } |
| 209 | return Replicate(value, num_bits, 8); | 194 | if (to_bit == 6) { |
| 195 | switch (num_bits) { | ||
| 196 | case 1: | ||
| 197 | return REPLICATE_1_BIT_TO_6_TABLE[value]; | ||
| 198 | case 2: | ||
| 199 | return REPLICATE_2_BIT_TO_6_TABLE[value]; | ||
| 200 | case 3: | ||
| 201 | return REPLICATE_3_BIT_TO_6_TABLE[value]; | ||
| 202 | case 4: | ||
| 203 | return REPLICATE_4_BIT_TO_6_TABLE[value]; | ||
| 204 | case 5: | ||
| 205 | return REPLICATE_5_BIT_TO_6_TABLE[value]; | ||
| 206 | default: | ||
| 207 | break; | ||
| 208 | } | ||
| 209 | } else { /* if (to_bit == 8) */ | ||
| 210 | switch (num_bits) { | ||
| 211 | case 1: | ||
| 212 | return REPLICATE_1_BIT_TO_8_TABLE[value]; | ||
| 213 | case 2: | ||
| 214 | return REPLICATE_2_BIT_TO_8_TABLE[value]; | ||
| 215 | case 3: | ||
| 216 | return REPLICATE_3_BIT_TO_8_TABLE[value]; | ||
| 217 | case 4: | ||
| 218 | return REPLICATE_4_BIT_TO_8_TABLE[value]; | ||
| 219 | case 5: | ||
| 220 | return REPLICATE_5_BIT_TO_8_TABLE[value]; | ||
| 221 | case 6: | ||
| 222 | return REPLICATE_6_BIT_TO_8_TABLE[value]; | ||
| 223 | case 7: | ||
| 224 | return REPLICATE_7_BIT_TO_8_TABLE[value]; | ||
| 225 | default: | ||
| 226 | break; | ||
| 227 | } | ||
| 228 | } | ||
| 229 | return Replicate(value, num_bits, to_bit); | ||
| 230 | } | ||
| 231 | |||
| 232 | uint FastReplicateTo8(uint value, uint num_bits) { | ||
| 233 | return FastReplicate(value, num_bits, 8); | ||
| 210 | } | 234 | } |
| 211 | 235 | ||
| 212 | uint FastReplicateTo6(uint value, uint num_bits) { | 236 | uint FastReplicateTo6(uint value, uint num_bits) { |
| 213 | switch (num_bits) { | 237 | return FastReplicate(value, num_bits, 6); |
| 214 | case 1: | ||
| 215 | return REPLICATE_1_BIT_TO_6_TABLE[value]; | ||
| 216 | case 2: | ||
| 217 | return REPLICATE_2_BIT_TO_6_TABLE[value]; | ||
| 218 | case 3: | ||
| 219 | return REPLICATE_3_BIT_TO_6_TABLE[value]; | ||
| 220 | case 4: | ||
| 221 | return REPLICATE_4_BIT_TO_6_TABLE[value]; | ||
| 222 | case 5: | ||
| 223 | return REPLICATE_5_BIT_TO_6_TABLE[value]; | ||
| 224 | } | ||
| 225 | return Replicate(value, num_bits, 6); | ||
| 226 | } | 238 | } |
| 227 | 239 | ||
| 228 | uint Div3Floor(uint v) { | 240 | uint Div3Floor(uint v) { |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 99a7397fc..33d50667a 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -743,7 +743,10 @@ void Config::ReadUIValues() { | |||
| 743 | qt_config->beginGroup(QStringLiteral("UI")); | 743 | qt_config->beginGroup(QStringLiteral("UI")); |
| 744 | 744 | ||
| 745 | UISettings::values.theme = | 745 | UISettings::values.theme = |
| 746 | ReadSetting(QStringLiteral("theme"), QString::fromUtf8(UISettings::themes[0].second)) | 746 | ReadSetting( |
| 747 | QStringLiteral("theme"), | ||
| 748 | QString::fromUtf8( | ||
| 749 | UISettings::themes[static_cast<size_t>(UISettings::Theme::DarkColorful)].second)) | ||
| 747 | .toString(); | 750 | .toString(); |
| 748 | ReadBasicSetting(UISettings::values.enable_discord_presence); | 751 | ReadBasicSetting(UISettings::values.enable_discord_presence); |
| 749 | ReadBasicSetting(UISettings::values.select_user_on_boot); | 752 | ReadBasicSetting(UISettings::values.select_user_on_boot); |
| @@ -1270,8 +1273,10 @@ void Config::SaveSystemValues() { | |||
| 1270 | void Config::SaveUIValues() { | 1273 | void Config::SaveUIValues() { |
| 1271 | qt_config->beginGroup(QStringLiteral("UI")); | 1274 | qt_config->beginGroup(QStringLiteral("UI")); |
| 1272 | 1275 | ||
| 1273 | WriteSetting(QStringLiteral("theme"), UISettings::values.theme, | 1276 | WriteSetting( |
| 1274 | QString::fromUtf8(UISettings::themes[0].second)); | 1277 | QStringLiteral("theme"), UISettings::values.theme, |
| 1278 | QString::fromUtf8( | ||
| 1279 | UISettings::themes[static_cast<size_t>(UISettings::Theme::DarkColorful)].second)); | ||
| 1275 | WriteBasicSetting(UISettings::values.enable_discord_presence); | 1280 | WriteBasicSetting(UISettings::values.enable_discord_presence); |
| 1276 | WriteBasicSetting(UISettings::values.select_user_on_boot); | 1281 | WriteBasicSetting(UISettings::values.select_user_on_boot); |
| 1277 | 1282 | ||
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 402c4556d..f7298ddad 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -29,6 +29,15 @@ struct Shortcut { | |||
| 29 | ContextualShortcut shortcut; | 29 | ContextualShortcut shortcut; |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | enum class Theme { | ||
| 33 | Default, | ||
| 34 | DefaultColorful, | ||
| 35 | Dark, | ||
| 36 | DarkColorful, | ||
| 37 | MidnightBlue, | ||
| 38 | MidnightBlueColorful, | ||
| 39 | }; | ||
| 40 | |||
| 32 | using Themes = std::array<std::pair<const char*, const char*>, 6>; | 41 | using Themes = std::array<std::pair<const char*, const char*>, 6>; |
| 33 | extern const Themes themes; | 42 | extern const Themes themes; |
| 34 | 43 | ||