From 5a87b5c4005aa344b56ef9cd7eeb2d11d8c03d93 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Fri, 9 Feb 2024 05:47:18 +0100 Subject: [PATCH] early-access version 4124 --- README.md | 2 +- src/android/app/build.gradle.kts | 11 +++++++++-- src/core/hle/service/cmif_types.h | 2 +- src/core/hle/service/hid/hid_system_server.cpp | 9 +-------- src/hid_core/resource_manager.cpp | 2 ++ src/hid_core/resources/npad/npad.cpp | 4 ++++ src/hid_core/resources/npad/npad.h | 2 ++ src/hid_core/resources/npad/npad_resource.cpp | 10 +++++++--- src/hid_core/resources/npad/npad_resource.h | 2 +- 9 files changed, 28 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 0bfd8d3c3..c164deec9 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 4123. +This is the source code for early-access 4124. ## Legal Notice diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts index d44bb4c74..cb026211c 100755 --- a/src/android/app/build.gradle.kts +++ b/src/android/app/build.gradle.kts @@ -259,13 +259,20 @@ fun runGitCommand(command: List): String { } fun getGitVersion(): String { - val gitVersion = runGitCommand(listOf("git", "describe", "--always", "--long")) + val gitVersion = runGitCommand( + listOf( + "git", + "describe", + "--always", + "--long" + ) + ).replace(Regex("(-0)?-[^-]+$"), "") val versionName = if (System.getenv("GITHUB_ACTIONS") != null) { System.getenv("GIT_TAG_NAME") ?: gitVersion } else { gitVersion } - return versionName.replace(Regex("(-0)?-[^-]+$"), "").ifEmpty { "0.0" } + return versionName.ifEmpty { "0.0" } } fun getGitHash(): String = diff --git a/src/core/hle/service/cmif_types.h b/src/core/hle/service/cmif_types.h index db5a013c7..dad358b87 100755 --- a/src/core/hle/service/cmif_types.h +++ b/src/core/hle/service/cmif_types.h @@ -270,7 +270,7 @@ class OutLargeData { public: static_assert(std::is_trivially_copyable_v, "LargeData type must be trivially copyable"); static_assert((A & BufferAttr_In) == 0, "OutLargeData attr must not be In"); - static constexpr BufferAttr Attr = static_cast(A | BufferAttr_In | BufferAttr_FixedSize); + static constexpr BufferAttr Attr = static_cast(A | BufferAttr_Out | BufferAttr_FixedSize); using Type = T; /* implicit */ OutLargeData(const OutLargeData& t) : raw(t.raw) {} diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index 22471e9e2..7126a1dcd 100755 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -508,13 +508,8 @@ void IHidSystemServer::RegisterAppletResourceUserId(HLERequestContext& ctx) { Result result = GetResourceManager()->RegisterAppletResourceUserId( parameters.applet_resource_user_id, parameters.enable_input); - if (result.IsSuccess()) { - // result = GetResourceManager()->GetNpad()->RegisterAppletResourceUserId( - // parameters.applet_resource_user_id); - } - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); + rb.Push(result); } void IHidSystemServer::UnregisterAppletResourceUserId(HLERequestContext& ctx) { @@ -524,8 +519,6 @@ void IHidSystemServer::UnregisterAppletResourceUserId(HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); GetResourceManager()->UnregisterAppletResourceUserId(applet_resource_user_id); - // GetResourceManager()->GetNpad()->UnregisterAppletResourceUserId(applet_resource_user_id); - // GetResourceManager()->GetPalma()->UnregisterAppletResourceUserId(applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); diff --git a/src/hid_core/resource_manager.cpp b/src/hid_core/resource_manager.cpp index 245da582e..01261ba97 100755 --- a/src/hid_core/resource_manager.cpp +++ b/src/hid_core/resource_manager.cpp @@ -314,6 +314,7 @@ void ResourceManager::UnregisterAppletResourceUserId(u64 aruid) { std::scoped_lock lock{shared_mutex}; applet_resource->UnregisterAppletResourceUserId(aruid); npad->UnregisterAppletResourceUserId(aruid); + // palma->UnregisterAppletResourceUserId(aruid); } Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) { @@ -324,6 +325,7 @@ Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle void ResourceManager::FreeAppletResourceId(u64 aruid) { std::scoped_lock lock{shared_mutex}; applet_resource->FreeAppletResourceId(aruid); + npad->FreeAppletResourceId(aruid); } void ResourceManager::EnableInput(u64 aruid, bool is_enabled) { diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index 053625b55..e10e97e1c 100755 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -117,6 +117,10 @@ Result NPad::ActivateNpadResource(u64 aruid) { return npad_resource.Activate(aruid); } +void NPad::FreeAppletResourceId(u64 aruid) { + return npad_resource.FreeAppletResourceId(aruid); +} + void NPad::ControllerUpdate(Core::HID::ControllerTriggerType type, std::size_t controller_idx) { if (type == Core::HID::ControllerTriggerType::All) { ControllerUpdate(Core::HID::ControllerTriggerType::Connected, controller_idx); diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h index c63488346..99e761127 100755 --- a/src/hid_core/resources/npad/npad.h +++ b/src/hid_core/resources/npad/npad.h @@ -58,6 +58,8 @@ public: Result ActivateNpadResource(); Result ActivateNpadResource(u64 aruid); + void FreeAppletResourceId(u64 aruid); + // When the controller is requesting an update for the shared memory void OnUpdate(const Core::Timing::CoreTiming& core_timing); diff --git a/src/hid_core/resources/npad/npad_resource.cpp b/src/hid_core/resources/npad/npad_resource.cpp index 8dd86b58e..79f7d74c0 100755 --- a/src/hid_core/resources/npad/npad_resource.cpp +++ b/src/hid_core/resources/npad/npad_resource.cpp @@ -67,7 +67,7 @@ Result NPadResource::RegisterAppletResourceUserId(u64 aruid) { void NPadResource::UnregisterAppletResourceUserId(u64 aruid) { const u64 aruid_index = GetIndexFromAruid(aruid); - DestroyStyleSetUpdateEvents(aruid); + FreeAppletResourceId(aruid); if (aruid_index < AruidIndexMax) { state[aruid_index] = {}; registration_list.flag[aruid_index] = RegistrationStatus::PendingDelete; @@ -80,14 +80,18 @@ void NPadResource::UnregisterAppletResourceUserId(u64 aruid) { } } -void NPadResource::DestroyStyleSetUpdateEvents(u64 aruid) { +void NPadResource::FreeAppletResourceId(u64 aruid) { const u64 aruid_index = GetIndexFromAruid(aruid); if (aruid_index >= AruidIndexMax) { return; } - for (auto& controller_state : state[aruid_index].controller_state) { + auto& aruid_data = state[aruid_index]; + + aruid_data.flag.is_assigned.Assign(false); + + for (auto& controller_state : aruid_data.controller_state) { if (!controller_state.is_styleset_update_event_initialized) { continue; } diff --git a/src/hid_core/resources/npad/npad_resource.h b/src/hid_core/resources/npad/npad_resource.h index aed89eec6..8ee5702fd 100755 --- a/src/hid_core/resources/npad/npad_resource.h +++ b/src/hid_core/resources/npad/npad_resource.h @@ -55,7 +55,7 @@ public: Result RegisterAppletResourceUserId(u64 aruid); void UnregisterAppletResourceUserId(u64 aruid); - void DestroyStyleSetUpdateEvents(u64 aruid); + void FreeAppletResourceId(u64 aruid); Result Activate(u64 aruid); Result Activate();