From e11d86e0810560552061c36b7d0975011191b459 Mon Sep 17 00:00:00 2001 From: bdm110 Date: Fri, 5 Jun 2026 12:09:59 +0800 Subject: [PATCH] service/aoc: refresh add-on content list before queries --- src/core/hle/service/aoc/addon_content_manager.cpp | 13 +++++++++++-- src/core/hle/service/aoc/addon_content_manager.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/aoc/addon_content_manager.cpp b/src/core/hle/service/aoc/addon_content_manager.cpp index 4d3e640bb3..25eabd515f 100644 --- a/src/core/hle/service/aoc/addon_content_manager.cpp +++ b/src/core/hle/service/aoc/addon_content_manager.cpp @@ -42,8 +42,9 @@ static std::vector AccumulateAOCTitleIDs(Core::System& system) { std::remove_if( add_on_content.begin(), add_on_content.end(), [&rcu](u64 tid) { - return rcu.GetEntry(tid, FileSys::ContentRecordType::Data)->GetStatus() != - Loader::ResultStatus::Success; + auto entry = rcu.GetEntry(tid, FileSys::ContentRecordType::Data); + return entry == nullptr || + entry->GetStatus() != Loader::ResultStatus::Success; }), add_on_content.end()); return add_on_content; @@ -88,9 +89,15 @@ IAddOnContentManager::~IAddOnContentManager() { service_context.CloseEvent(aoc_change_event); } +void IAddOnContentManager::RefreshAddOnContentList() { + add_on_content = AccumulateAOCTitleIDs(system); +} + Result IAddOnContentManager::CountAddOnContent(Out out_count, ClientProcessId process_id) { LOG_DEBUG(Service_AOC, "called. process_id={}", process_id.pid); + RefreshAddOnContentList(); + const auto current = system.GetApplicationProcessProgramID(); const auto& disabled = Settings::values.disabled_addons[current]; @@ -112,6 +119,8 @@ Result IAddOnContentManager::ListAddOnContent(Out out_count, LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count, process_id.pid); + RefreshAddOnContentList(); + const auto current = FileSys::GetBaseTitleID(system.GetApplicationProcessProgramID()); std::vector out; diff --git a/src/core/hle/service/aoc/addon_content_manager.h b/src/core/hle/service/aoc/addon_content_manager.h index 91857df4c7..1b5913a9e1 100644 --- a/src/core/hle/service/aoc/addon_content_manager.h +++ b/src/core/hle/service/aoc/addon_content_manager.h @@ -40,6 +40,7 @@ public: OutInterface out_interface); private: + void RefreshAddOnContentList(); std::vector add_on_content; KernelHelpers::ServiceContext service_context;