diff options
Diffstat (limited to '')
-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 |
5 files changed, 15 insertions, 17 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) { auto& motion = console.motion_state; motion.accel = emulated.GetAcceleration(); motion.gyro = emulated.GetGyroscope(); - motion.rotation = emulated.GetGyroscope(); + motion.rotation = emulated.GetRotations(); motion.orientation = emulated.GetOrientation(); motion.quaternion = emulated.GetQuaternion(); 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() { motion_devices.begin(), Common::Input::CreateDevice<Common::Input::InputDevice>); std::transform(trigger_params.begin(), trigger_params.end(), trigger_devices.begin(), Common::Input::CreateDevice<Common::Input::InputDevice>); - std::transform(battery_params.begin(), battery_params.begin(), battery_devices.end(), + std::transform(battery_params.begin(), battery_params.end(), battery_devices.begin(), Common::Input::CreateDevice<Common::Input::InputDevice>); std::transform(output_params.begin(), output_params.end(), output_devices.begin(), 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 if (!must_context_switch || core != current_core) { auto& phys_core = kernel.PhysicalCore(core); phys_core.Interrupt(); - } else { - must_context_switch = true; } cores_pending_reschedule &= ~(1ULL << core); } 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 { struct KernelCore::Impl { explicit Impl(Core::System& system_, KernelCore& kernel_) - : time_manager{system_}, object_list_container{kernel_}, system{system_} {} + : time_manager{system_}, object_list_container{kernel_}, + service_threads_manager{1, "yuzu:ServiceThreadsManager"}, system{system_} {} void SetMulticore(bool is_multi) { is_multicore = is_multi; @@ -708,24 +709,22 @@ struct KernelCore::Impl { std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(KernelCore& kernel, const std::string& name) { auto service_thread = std::make_shared<Kernel::ServiceThread>(kernel, 1, name); - { - std::lock_guard lk(service_threads_lock); - service_threads.emplace(service_thread); - } + + service_threads_manager.QueueWork( + [this, service_thread]() { service_threads.emplace(service_thread); }); + return service_thread; } void ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread) { - auto strong_ptr = service_thread.lock(); - { - std::lock_guard lk(service_threads_lock); - service_threads.erase(strong_ptr); + if (auto strong_ptr = service_thread.lock()) { + service_threads_manager.QueueWork( + [this, strong_ptr{std::move(strong_ptr)}]() { service_threads.erase(strong_ptr); }); } } void ClearServiceThreads() { - std::lock_guard lk(service_threads_lock); - service_threads.clear(); + service_threads_manager.QueueWork([this]() { service_threads.clear(); }); } std::mutex server_ports_lock; @@ -733,7 +732,6 @@ struct KernelCore::Impl { std::mutex registered_objects_lock; std::mutex registered_in_use_objects_lock; std::mutex dummy_thread_lock; - std::mutex service_threads_lock; std::atomic<u32> next_object_id{0}; std::atomic<u64> next_kernel_process_id{KProcess::InitialKIPIDMin}; @@ -784,6 +782,7 @@ struct KernelCore::Impl { // Threads used for services std::unordered_set<std::shared_ptr<Kernel::ServiceThread>> service_threads; + Common::ThreadWorker service_threads_manager; std::array<KThread*, Core::Hardware::NUM_CPU_CORES> suspend_threads; 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 { // Period time is obtained by measuring the number of samples in a second on HW using a homebrew constexpr auto pad_update_ns = std::chrono::nanoseconds{4 * 1000 * 1000}; // (4ms, 250Hz) constexpr auto mouse_keyboard_update_ns = std::chrono::nanoseconds{8 * 1000 * 1000}; // (8ms, 125Hz) -constexpr auto motion_update_ns = std::chrono::nanoseconds{5 * 1000 * 1000}; // (5ms, 200Hz) +// TODO: Correct update rate for motion is 5ms. Check why some games don't behave at that speed +constexpr auto motion_update_ns = std::chrono::nanoseconds{10 * 1000 * 1000}; // (10ms, 100Hz) constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000; IAppletResource::IAppletResource(Core::System& system_, |