From 0a67b1a42bfe97fe6cd4979846d2a34fad1eea30 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Mon, 22 Jan 2024 03:02:41 +0100 Subject: [PATCH] early-access version 4079 --- README.md | 2 +- src/common/settings.h | 2 -- src/core/hle/service/hid/hid_system_server.cpp | 4 ++-- src/hid_core/frontend/emulated_controller.cpp | 9 +++++++-- src/hid_core/resources/npad/npad.cpp | 13 +++++++++++++ src/hid_core/resources/npad/npad.h | 2 ++ 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 14bdb0e06..37d111d6e 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 4078. +This is the source code for early-access 4079. ## Legal Notice diff --git a/src/common/settings.h b/src/common/settings.h index c9ab6ab15..db8606f93 100755 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -422,8 +422,6 @@ struct Values { false, true, &custom_rtc_enabled}; SwitchableSetting custom_rtc_offset{ linkage, 0, "custom_rtc_offset", Category::System, Specialization::Countable, true, true}; - // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` - s64 custom_rtc_differential; SwitchableSetting rng_seed_enabled{ linkage, false, "rng_seed_enabled", Category::System, Specialization::Paired, true, true}; SwitchableSetting rng_seed{ diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index 4466a189b..bf27ddfbf 100755 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -533,7 +533,7 @@ void IHidSystemServer::EnableAppletToGetInput(HLERequestContext& ctx) { parameters.is_enabled, parameters.applet_resource_user_id); GetResourceManager()->EnableInput(parameters.applet_resource_user_id, parameters.is_enabled); - // GetResourceManager()->GetNpad()->EnableInput(parameters.applet_resource_user_id); + GetResourceManager()->GetNpad()->EnableAppletToGetInput(parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); @@ -596,7 +596,7 @@ void IHidSystemServer::EnableAppletToGetPadInput(HLERequestContext& ctx) { parameters.is_enabled, parameters.applet_resource_user_id); GetResourceManager()->EnablePadInput(parameters.applet_resource_user_id, parameters.is_enabled); - // GetResourceManager()->GetNpad()->EnableInput(parameters.applet_resource_user_id); + GetResourceManager()->GetNpad()->EnableAppletToGetInput(parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); diff --git a/src/hid_core/frontend/emulated_controller.cpp b/src/hid_core/frontend/emulated_controller.cpp index f2499502d..e12e5a77e 100755 --- a/src/hid_core/frontend/emulated_controller.cpp +++ b/src/hid_core/frontend/emulated_controller.cpp @@ -1240,12 +1240,17 @@ bool EmulatedController::SetVibration(DeviceIndex device_index, const VibrationV if (!output_devices[index]) { return false; } + + last_vibration_value = vibration; + + if (!Settings::values.vibration_enabled) { + return false; + } + const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type); const auto& player = Settings::values.players.GetValue()[player_index]; const f32 strength = static_cast(player.vibration_strength) / 100.0f; - last_vibration_value = vibration; - if (!player.vibration_enabled) { return false; } diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index 212f01429..d13a489c9 100755 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -480,6 +480,10 @@ void NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) { continue; } + if (!data->flag.enable_pad_input) { + continue; + } + RequestPadStateUpdate(aruid, controller.device->GetNpadIdType()); auto& pad_state = controller.npad_pad_state; auto& libnx_state = controller.npad_libnx_state; @@ -1316,4 +1320,13 @@ void NPad::UpdateHandheldAbstractState() { abstracted_pads[NpadIdTypeToIndex(Core::HID::NpadIdType::Handheld)].Update(); } +void NPad::EnableAppletToGetInput(u64 aruid) { + std::scoped_lock lock{mutex}; + std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex}; + + for (auto& abstract_pad : abstracted_pads) { + abstract_pad.EnableAppletToGetInput(aruid); + } +} + } // namespace Service::HID diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h index 18b25c688..88289fa2b 100755 --- a/src/hid_core/resources/npad/npad.h +++ b/src/hid_core/resources/npad/npad.h @@ -153,6 +153,8 @@ public: void UpdateHandheldAbstractState(); + void EnableAppletToGetInput(u64 aruid); + private: struct NpadControllerData { NpadInternalState* shared_memory = nullptr;