diff options
author | Lioncash <mathew1800@gmail.com> | 2020-11-18 13:53:10 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-11-18 15:36:48 +0100 |
commit | 6f8a06bac58790d20dae3c1adb4de3b441f07b30 (patch) | |
tree | ef5e2942aa0aacbebb683da91ee6d4bd19ec15e9 /src/core/hle/service/ns | |
parent | Merge pull request #4866 from Morph1984/mjolnir-p3-prod (diff) | |
download | yuzu-6f8a06bac58790d20dae3c1adb4de3b441f07b30.tar yuzu-6f8a06bac58790d20dae3c1adb4de3b441f07b30.tar.gz yuzu-6f8a06bac58790d20dae3c1adb4de3b441f07b30.tar.bz2 yuzu-6f8a06bac58790d20dae3c1adb4de3b441f07b30.tar.lz yuzu-6f8a06bac58790d20dae3c1adb4de3b441f07b30.tar.xz yuzu-6f8a06bac58790d20dae3c1adb4de3b441f07b30.tar.zst yuzu-6f8a06bac58790d20dae3c1adb4de3b441f07b30.zip |
Diffstat (limited to 'src/core/hle/service/ns')
-rw-r--r-- | src/core/hle/service/ns/ns.cpp | 24 | ||||
-rw-r--r-- | src/core/hle/service/ns/ns.h | 28 |
2 files changed, 35 insertions, 17 deletions
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 58ee1f712..2594e6839 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "common/logging/log.h" +#include "core/core.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/patch_manager.h" #include "core/file_sys/vfs.h" @@ -29,8 +30,8 @@ IAccountProxyInterface::IAccountProxyInterface() : ServiceFramework{"IAccountPro IAccountProxyInterface::~IAccountProxyInterface() = default; -IApplicationManagerInterface::IApplicationManagerInterface() - : ServiceFramework{"IApplicationManagerInterface"} { +IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_) + : ServiceFramework{"IApplicationManagerInterface"}, system{system_} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "ListApplicationRecord"}, @@ -298,7 +299,8 @@ void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestC const auto size = ctx.GetWriteBufferSize(); - const FileSys::PatchManager pm{title_id}; + const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), + system.GetContentProvider()}; const auto control = pm.GetControlMetadata(); std::vector<u8> out; @@ -538,14 +540,14 @@ IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface() IFactoryResetInterface::~IFactoryResetInterface() = default; -NS::NS(const char* name) : ServiceFramework{name} { +NS::NS(const char* name, Core::System& system_) : ServiceFramework{name}, system{system_} { // clang-format off static const FunctionInfo functions[] = { {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"}, {7995, &NS::PushInterface<IAccountProxyInterface>, "GetAccountProxyInterface"}, - {7996, &NS::PushInterface<IApplicationManagerInterface>, "GetApplicationManagerInterface"}, + {7996, &NS::PushIApplicationManagerInterface, "GetApplicationManagerInterface"}, {7997, &NS::PushInterface<IDownloadTaskInterface>, "GetDownloadTaskInterface"}, {7998, &NS::PushInterface<IContentManagementInterface>, "GetContentManagementInterface"}, {7999, &NS::PushInterface<IDocumentInterface>, "GetDocumentInterface"}, @@ -558,7 +560,7 @@ NS::NS(const char* name) : ServiceFramework{name} { NS::~NS() = default; std::shared_ptr<IApplicationManagerInterface> NS::GetApplicationManagerInterface() const { - return GetInterface<IApplicationManagerInterface>(); + return GetInterface<IApplicationManagerInterface>(system); } class NS_DEV final : public ServiceFramework<NS_DEV> { @@ -678,11 +680,11 @@ public: void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { - std::make_shared<NS>("ns:am2")->InstallAsService(service_manager); - std::make_shared<NS>("ns:ec")->InstallAsService(service_manager); - std::make_shared<NS>("ns:rid")->InstallAsService(service_manager); - std::make_shared<NS>("ns:rt")->InstallAsService(service_manager); - std::make_shared<NS>("ns:web")->InstallAsService(service_manager); + std::make_shared<NS>("ns:am2", system)->InstallAsService(service_manager); + std::make_shared<NS>("ns:ec", system)->InstallAsService(service_manager); + std::make_shared<NS>("ns:rid", system)->InstallAsService(service_manager); + std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager); + std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager); std::make_shared<NS_DEV>()->InstallAsService(service_manager); std::make_shared<NS_SU>()->InstallAsService(service_manager); diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index c2554b878..c90ccd755 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h @@ -6,6 +6,10 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Service { namespace FileSystem { @@ -22,7 +26,7 @@ public: class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> { public: - explicit IApplicationManagerInterface(); + explicit IApplicationManagerInterface(Core::System& system_); ~IApplicationManagerInterface() override; ResultVal<u8> GetApplicationDesiredLanguage(u32 supported_languages); @@ -32,6 +36,8 @@ private: void GetApplicationControlData(Kernel::HLERequestContext& ctx); void GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx); void ConvertApplicationLanguageToLanguageCode(Kernel::HLERequestContext& ctx); + + Core::System& system; }; class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> { @@ -72,13 +78,13 @@ public: class NS final : public ServiceFramework<NS> { public: - explicit NS(const char* name); + explicit NS(const char* name, Core::System& system_); ~NS() override; std::shared_ptr<IApplicationManagerInterface> GetApplicationManagerInterface() const; private: - template <typename T> + template <typename T, typename... Args> void PushInterface(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called"); @@ -87,13 +93,23 @@ private: rb.PushIpcInterface<T>(); } - template <typename T> - std::shared_ptr<T> GetInterface() const { + void PushIApplicationManagerInterface(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_NS, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface<IApplicationManagerInterface>(system); + } + + template <typename T, typename... Args> + std::shared_ptr<T> GetInterface(Args&&... args) const { static_assert(std::is_base_of_v<Kernel::SessionRequestHandler, T>, "Not a base of ServiceFrameworkBase"); - return std::make_shared<T>(); + return std::make_shared<T>(std::forward<Args>(args)...); } + + Core::System& system; }; /// Registers all NS services with the specified service manager. |