From ce80dbf58605f349161a2a47204f6e1a694f1090 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sun, 7 Jan 2024 06:02:55 +0100 Subject: [PATCH] early-access version 4048 --- README.md | 2 +- .../hle/service/hid/hid_system_server.cpp | 60 +++++++++++++++++-- src/core/hle/service/hid/hid_system_server.h | 6 ++ src/hid_core/resource_manager.cpp | 1 + src/hid_core/resources/applet_resource.cpp | 34 +++++------ src/hid_core/resources/npad/npad_resource.cpp | 4 +- 6 files changed, 79 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index c24c78a7f..b7502d935 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 4047. +This is the source code for early-access 4048. ## Legal Notice diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index 027c56025..2a65615e8 100755 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -81,7 +81,7 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr IHidSystemServer::GetResourceManager() { resource_manager->Initialize(); return resource_manager; diff --git a/src/core/hle/service/hid/hid_system_server.h b/src/core/hle/service/hid/hid_system_server.h index 1e623dfc2..f467e2aa8 100755 --- a/src/core/hle/service/hid/hid_system_server.h +++ b/src/core/hle/service/hid/hid_system_server.h @@ -44,6 +44,7 @@ private: void EnableAppletToGetSixAxisSensor(HLERequestContext& ctx); void EnableAppletToGetPadInput(HLERequestContext& ctx); void EnableAppletToGetTouchScreen(HLERequestContext& ctx); + void IsJoyConAttachedOnAllRail(HLERequestContext& ctx); void AcquireConnectionTriggerTimeoutEvent(HLERequestContext& ctx); void AcquireDeviceRegisteredEventForControllerSupport(HLERequestContext& ctx); void GetRegisteredDevices(HLERequestContext& ctx); @@ -53,8 +54,13 @@ private: void IsUsbFullKeyControllerEnabled(HLERequestContext& ctx); void IsHandheldButtonPressedOnConsoleMode(HLERequestContext& ctx); void InitializeFirmwareUpdate(HLERequestContext& ctx); + void CheckFirmwareUpdateRequired(HLERequestContext& ctx); + void SetFirmwareHotfixUpdateSkipEnabled(HLERequestContext& ctx); + void InitializeUsbFirmwareUpdate(HLERequestContext& ctx); + void FinalizeUsbFirmwareUpdate(HLERequestContext& ctx); void InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx); void GetTouchScreenDefaultConfiguration(HLERequestContext& ctx); + void IsUsingCustomButtonConfig(HLERequestContext& ctx); std::shared_ptr GetResourceManager(); diff --git a/src/hid_core/resource_manager.cpp b/src/hid_core/resource_manager.cpp index 17dacef6e..2c5fe6d51 100755 --- a/src/hid_core/resource_manager.cpp +++ b/src/hid_core/resource_manager.cpp @@ -224,6 +224,7 @@ Result ResourceManager::RegisterAppletResourceUserId(u64 aruid, bool bool_value) void ResourceManager::UnregisterAppletResourceUserId(u64 aruid) { std::scoped_lock lock{shared_mutex}; applet_resource->UnregisterAppletResourceUserId(aruid); + npad->UnregisterAppletResourceUserId(aruid); } Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) { diff --git a/src/hid_core/resources/applet_resource.cpp b/src/hid_core/resources/applet_resource.cpp index d16cff1a4..d09a525c6 100755 --- a/src/hid_core/resources/applet_resource.cpp +++ b/src/hid_core/resources/applet_resource.cpp @@ -87,7 +87,9 @@ Result AppletResource::RegisterAppletResourceUserId(u64 aruid, bool enable_input data_index = i; break; } - if (registration_list.flag[i] == RegistrationStatus::None) { + // TODO: Don't Handle pending delete here + if (registration_list.flag[i] == RegistrationStatus::None || + registration_list.flag[i] == RegistrationStatus::PendingDelete) { data_index = i; break; } @@ -104,30 +106,22 @@ Result AppletResource::RegisterAppletResourceUserId(u64 aruid, bool enable_input } void AppletResource::UnregisterAppletResourceUserId(u64 aruid) { - u64 index = GetIndexFromAruid(aruid); + const u64 index = GetIndexFromAruid(aruid); - if (index < AruidIndexMax) { - if (data[index].flag.is_assigned) { - data[index].shared_memory_format = nullptr; - data[index].flag.is_assigned.Assign(false); - } + if (index >= AruidIndexMax) { + return; } - index = GetIndexFromAruid(aruid); - if (index < AruidIndexMax) { - DestroySevenSixAxisTransferMemory(); - data[index].flag.raw = 0; - data[index].aruid = 0; + FreeAppletResourceId(aruid); + DestroySevenSixAxisTransferMemory(); + data[index].flag.raw = 0; + data[index].aruid = 0; - index = GetIndexFromAruid(aruid); - if (index < AruidIndexMax) { - registration_list.flag[index] = RegistrationStatus::PendingDelete; - } - } + registration_list.flag[index] = RegistrationStatus::PendingDelete; } void AppletResource::FreeAppletResourceId(u64 aruid) { - u64 index = GetIndexFromAruid(aruid); + const u64 index = GetIndexFromAruid(aruid); if (index >= AruidIndexMax) { return; } @@ -144,7 +138,7 @@ u64 AppletResource::GetActiveAruid() { } Result AppletResource::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) { - u64 index = GetIndexFromAruid(aruid); + const u64 index = GetIndexFromAruid(aruid); if (index >= AruidIndexMax) { return ResultAruidNotRegistered; } @@ -155,7 +149,7 @@ Result AppletResource::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, Result AppletResource::GetSharedMemoryFormat(SharedMemoryFormat** out_shared_memory_format, u64 aruid) { - u64 index = GetIndexFromAruid(aruid); + const u64 index = GetIndexFromAruid(aruid); if (index >= AruidIndexMax) { return ResultAruidNotRegistered; } diff --git a/src/hid_core/resources/npad/npad_resource.cpp b/src/hid_core/resources/npad/npad_resource.cpp index b0255a05c..ea9fc14ed 100755 --- a/src/hid_core/resources/npad/npad_resource.cpp +++ b/src/hid_core/resources/npad/npad_resource.cpp @@ -46,7 +46,9 @@ Result NPadResource::RegisterAppletResourceUserId(u64 aruid) { data_index = i; break; } - if (registration_list.flag[i] == RegistrationStatus::None) { + // TODO: Don't Handle pending delete here + if (registration_list.flag[i] == RegistrationStatus::None || + registration_list.flag[i] == RegistrationStatus::PendingDelete) { data_index = i; break; }