From 4565d8fcd8bf8cb1f11ddde057afe510f63f7a89 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Wed, 21 Feb 2024 05:33:37 +0100 Subject: [PATCH] early-access version 4156 --- README.md | 2 +- .../ns/application_manager_interface.cpp | 6 ++-- .../ns/application_manager_interface.h | 2 +- src/core/hle/service/ns/ns_types.h | 5 ++++ src/core/hle/service/ns/query_service.cpp | 5 ++-- src/core/hle/service/ns/query_service.h | 4 +-- src/video_core/texture_cache/texture_cache.h | 30 ++++++++++++++----- 7 files changed, 37 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 9370bfe1e..c733bba80 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 4155. +This is the source code for early-access 4156. ## Legal Notice diff --git a/src/core/hle/service/ns/application_manager_interface.cpp b/src/core/hle/service/ns/application_manager_interface.cpp index 2e3a44c0d..7a91727f9 100755 --- a/src/core/hle/service/ns/application_manager_interface.cpp +++ b/src/core/hle/service/ns/application_manager_interface.cpp @@ -436,14 +436,14 @@ Result IApplicationManagerInterface::GetApplicationViewWithPromotionInfo( Result IApplicationManagerInterface::GetApplicationRightsOnClient( OutArray out_rights, Out out_count, - Common::UUID account_id, u32 flags, u64 application_id) { + u32 flags, u64 application_id, Uid account_id) { LOG_WARNING(Service_NS, "(STUBBED) called, flags={}, application_id={:016X}, account_id={}", - flags, application_id, account_id.FormattedString()); + flags, application_id, account_id.uuid.FormattedString()); if (!out_rights.empty()) { ApplicationRightsOnClient rights{}; rights.application_id = application_id; - rights.uid = account_id; + rights.uid = account_id.uuid; rights.flags = 0; rights.flags2 = 0; diff --git a/src/core/hle/service/ns/application_manager_interface.h b/src/core/hle/service/ns/application_manager_interface.h index 350ec37ce..f33d269b3 100755 --- a/src/core/hle/service/ns/application_manager_interface.h +++ b/src/core/hle/service/ns/application_manager_interface.h @@ -37,7 +37,7 @@ public: InArray application_ids); Result GetApplicationRightsOnClient( OutArray out_rights, Out out_count, - Common::UUID account_id, u32 flags, u64 application_id); + u32 flags, u64 application_id, Uid account_id); Result CheckSdCardMountStatus(); Result GetSdCardMountStatusChangedEvent(OutCopyHandle out_event); Result GetFreeSpaceSize(Out out_free_space_size, FileSys::StorageId storage_id); diff --git a/src/core/hle/service/ns/ns_types.h b/src/core/hle/service/ns/ns_types.h index 38421b0f4..2dd664c4e 100755 --- a/src/core/hle/service/ns/ns_types.h +++ b/src/core/hle/service/ns/ns_types.h @@ -108,4 +108,9 @@ struct ContentPath { }; static_assert(sizeof(ContentPath) == 0x10, "ContentPath has incorrect size."); +struct Uid { + alignas(8) Common::UUID uuid; +}; +static_assert(sizeof(Uid) == 0x10, "Uid has incorrect size."); + } // namespace Service::NS diff --git a/src/core/hle/service/ns/query_service.cpp b/src/core/hle/service/ns/query_service.cpp index 946b7fa23..138400541 100755 --- a/src/core/hle/service/ns/query_service.cpp +++ b/src/core/hle/service/ns/query_service.cpp @@ -41,8 +41,7 @@ IQueryService::IQueryService(Core::System& system_) : ServiceFramework{system_, IQueryService::~IQueryService() = default; Result IQueryService::QueryPlayStatisticsByApplicationIdAndUserAccountId( - Out out_play_statistics, bool unknown, Common::UUID account_id, - u64 application_id) { + Out out_play_statistics, bool unknown, u64 application_id, Uid account_id) { // TODO(German77): Read statistics of the game *out_play_statistics = { .application_id = application_id, @@ -50,7 +49,7 @@ Result IQueryService::QueryPlayStatisticsByApplicationIdAndUserAccountId( }; LOG_WARNING(Service_NS, "(STUBBED) called. unknown={}. application_id={:016X}, account_id={}", - unknown, application_id, account_id.FormattedString()); + unknown, application_id, account_id.uuid.FormattedString()); R_SUCCEED(); } diff --git a/src/core/hle/service/ns/query_service.h b/src/core/hle/service/ns/query_service.h index 6cdbfa277..c4c82b752 100755 --- a/src/core/hle/service/ns/query_service.h +++ b/src/core/hle/service/ns/query_service.h @@ -5,6 +5,7 @@ #include "common/uuid.h" #include "core/hle/service/cmif_types.h" +#include "core/hle/service/ns/ns_types.h" #include "core/hle/service/service.h" namespace Service::NS { @@ -29,8 +30,7 @@ public: private: Result QueryPlayStatisticsByApplicationIdAndUserAccountId( - Out out_play_statistics, bool unknown, Common::UUID account_id, - u64 application_id); + Out out_play_statistics, bool unknown, u64 application_id, Uid account_id); }; } // namespace Service::NS diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index f790897ef..13f056214 100755 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -72,12 +72,19 @@ TextureCache

::TextureCache(Runtime& runtime_, Tegra::MaxwellDeviceMemoryManag template void TextureCache

::RunGarbageCollector() { - bool high_priority_mode = total_used_memory >= expected_memory; - bool aggressive_mode = total_used_memory >= critical_memory; - const u64 ticks_to_destroy = aggressive_mode ? 10ULL : high_priority_mode ? 25ULL : 50ULL; - size_t num_iterations = aggressive_mode ? 40 : (high_priority_mode ? 20 : 10); - const auto clean_up = [this, &num_iterations, &high_priority_mode, - &aggressive_mode](ImageId image_id) { + bool high_priority_mode = false; + bool aggressive_mode = false; + u64 ticks_to_destroy = 0; + size_t num_iterations = 0; + + const auto Configure = [&](bool allow_aggressive) { + high_priority_mode = total_used_memory >= expected_memory; + aggressive_mode = allow_aggressive && total_used_memory >= critical_memory; + ticks_to_destroy = aggressive_mode ? 10ULL : high_priority_mode ? 25ULL : 50ULL; + num_iterations = aggressive_mode ? 40 : (high_priority_mode ? 20 : 10); + }; + const auto Cleanup = [this, &num_iterations, &high_priority_mode, + &aggressive_mode](ImageId image_id) { if (num_iterations == 0) { return true; } @@ -123,7 +130,16 @@ void TextureCache

::RunGarbageCollector() { } return false; }; - lru_cache.ForEachItemBelow(frame_tick - ticks_to_destroy, clean_up); + + // Try to remove anything old enough and not high priority. + Configure(false); + lru_cache.ForEachItemBelow(frame_tick - ticks_to_destroy, Cleanup); + + // If pressure is still too high, prune aggressively. + if (total_used_memory >= critical_memory) { + Configure(true); + lru_cache.ForEachItemBelow(frame_tick - ticks_to_destroy, Cleanup); + } } template