From 8278bda54ecfbf865076acdc7e771868240acb60 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 15 Aug 2019 18:17:01 +1000 Subject: [PATCH] lr: lr_manager tweaks --- .../stratosphere/ipc/ipc_domain_object.hpp | 4 ++++ stratosphere/ncm/source/impl/lr_manager.cpp | 20 +++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/stratosphere/libstratosphere/include/stratosphere/ipc/ipc_domain_object.hpp b/stratosphere/libstratosphere/include/stratosphere/ipc/ipc_domain_object.hpp index 3cc9cbca2..ba8c25b7a 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ipc/ipc_domain_object.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/ipc/ipc_domain_object.hpp @@ -127,4 +127,8 @@ class Out> : public OutSessionTag { void SetValue(std::shared_ptr &&s) { *this->srv = std::move(s); } + + void SetValue(std::shared_ptr &s) { + *this->srv = s; + } }; diff --git a/stratosphere/ncm/source/impl/lr_manager.cpp b/stratosphere/ncm/source/impl/lr_manager.cpp index 2b8134f41..38144661d 100644 --- a/stratosphere/ncm/source/impl/lr_manager.cpp +++ b/stratosphere/ncm/source/impl/lr_manager.cpp @@ -41,11 +41,10 @@ namespace sts::lr::impl { R_TRY(content_resolver->Refresh()); g_location_resolvers[storage_id] = std::move(content_resolver); } + resolver = g_location_resolvers.Find(storage_id); } - /* Make a copy of the resolver for output. */ - auto tmp_resolver = g_location_resolvers[storage_id]; - out.SetValue(std::move(tmp_resolver)); + out.SetValue(*resolver); return ResultSuccess; } @@ -55,10 +54,8 @@ namespace sts::lr::impl { if (!g_registered_location_resolver) { g_registered_location_resolver = std::make_shared(); } - - /* Make a copy of the resolver for output. */ - auto tmp_resolver = g_registered_location_resolver; - out.SetValue(std::move(tmp_resolver)); + + out.SetValue(g_registered_location_resolver); return ResultSuccess; } @@ -70,7 +67,10 @@ namespace sts::lr::impl { return ResultLrUnknownStorageId; } - (*resolver)->Refresh(); + if (storage_id != ncm::StorageId::Host) { + (*resolver)->Refresh(); + } + return ResultSuccess; } @@ -81,9 +81,7 @@ namespace sts::lr::impl { g_add_on_content_location_resolver = std::make_shared(); } - /* Make a copy of the resolver for output. */ - auto tmp_resolver = g_add_on_content_location_resolver; - out.SetValue(std::move(tmp_resolver)); + out.SetValue(g_add_on_content_location_resolver); return ResultSuccess; }