From 33ac193bf6465e782c030d2bcd22ac3fd3f0b02d Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Wed, 10 Apr 2019 14:38:27 -0400 Subject: [PATCH 1/3] ncm: Implement LR OpenLocationResolver (0) Returns an object of type ILocationResolver with the provided StorageId. --- src/core/hle/service/ncm/ncm.cpp | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp index 5d31f638f3..7f775900a6 100644 --- a/src/core/hle/service/ncm/ncm.cpp +++ b/src/core/hle/service/ncm/ncm.cpp @@ -11,8 +11,45 @@ namespace Service::NCM { class LocationResolver final : public ServiceFramework { +class ILocationResolver final : public ServiceFramework { +public: + explicit ILocationResolver(FileSys::StorageId id) + : ServiceFramework{"ILocationResolver"}, storage(id) { + static const FunctionInfo functions[] = { + {0, nullptr, "ResolveProgramPath"}, + {1, nullptr, "RedirectProgramPath"}, + {2, nullptr, "ResolveApplicationControlPath"}, + {3, nullptr, "ResolveApplicationHtmlDocumentPath"}, + {4, nullptr, "ResolveDataPath"}, + {5, nullptr, "RedirectApplicationControlPath"}, + {6, nullptr, "RedirectApplicationHtmlDocumentPath"}, + {7, nullptr, "ResolveApplicationLegalInformationPath"}, + {8, nullptr, "RedirectApplicationLegalInformationPath"}, + {9, nullptr, "Refresh"}, + {10, nullptr, "RedirectProgramPath2"}, + {11, nullptr, "Refresh2"}, + {12, nullptr, "DeleteProgramPath"}, + {13, nullptr, "DeleteApplicationControlPath"}, + {14, nullptr, "DeleteApplicationHtmlDocumentPath"}, + {15, nullptr, "DeleteApplicationLegalInformationPath"}, + {16, nullptr, ""}, + {17, nullptr, ""}, + {18, nullptr, ""}, + {19, nullptr, ""}, + }; + + RegisterHandlers(functions); + } + +private: + FileSys::StorageId storage; +}; + public: explicit LocationResolver() : ServiceFramework{"lr"} { +class LR final : public ServiceFramework { +public: + explicit LR() : ServiceFramework{"lr"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "OpenLocationResolver"}, @@ -24,6 +61,19 @@ public: RegisterHandlers(functions); } + +private: + void OpenLocationResolver(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto id = rp.PopRaw(); + + LOG_DEBUG(Service_NCM, "called, id={:02X}", static_cast(id)); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(std::make_shared(id)); + } + }; class NCM final : public ServiceFramework { From e0920ef4ba5dc9ece5a5a56b735a8573a9d8a390 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Wed, 10 Apr 2019 14:40:18 -0400 Subject: [PATCH 2/3] ncm: Implement LR OpenRegisteredLocationResolver (1) Returns an object of type IRegisteredLocationResolver for the StorageId. --- src/core/hle/service/ncm/ncm.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp index 7f775900a6..c59bcc2a7e 100644 --- a/src/core/hle/service/ncm/ncm.cpp +++ b/src/core/hle/service/ncm/ncm.cpp @@ -45,6 +45,25 @@ private: FileSys::StorageId storage; }; +class IRegisteredLocationResolver final : public ServiceFramework { +public: + explicit IRegisteredLocationResolver() : ServiceFramework{"IRegisteredLocationResolver"} { + static const FunctionInfo functions[] = { + {0, nullptr, "ResolveProgramPath"}, + {1, nullptr, "RegisterProgramPath"}, + {2, nullptr, "UnregisterProgramPath"}, + {3, nullptr, "RedirectProgramPath"}, + {4, nullptr, "ResolveHtmlDocumentPath"}, + {5, nullptr, "RegisterHtmlDocumentPath"}, + {6, nullptr, "UnregisterHtmlDocumentPath"}, + {7, nullptr, "RedirectHtmlDocumentPath"}, + {8, nullptr, ""}, + }; + + RegisterHandlers(functions); + } +}; + public: explicit LocationResolver() : ServiceFramework{"lr"} { class LR final : public ServiceFramework { @@ -74,6 +93,14 @@ private: rb.PushIpcInterface(std::make_shared(id)); } + void OpenRegisteredLocationResolver(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_NCM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(std::make_shared()); + } + }; class NCM final : public ServiceFramework { From 52b80d231cb3e1b234f1fcfe00cc1577d42cb966 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sun, 26 May 2019 20:36:54 -0400 Subject: [PATCH 3/3] ncm: Implement LR OpenAddOnContentLocationResolver (2) Returns an object of type IAddOnContentLocationResolver for the provided StorageId. --- src/core/hle/service/ncm/ncm.cpp | 45 +++++++++++++++----------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp index c59bcc2a7e..b405a4b663 100644 --- a/src/core/hle/service/ncm/ncm.cpp +++ b/src/core/hle/service/ncm/ncm.cpp @@ -4,17 +4,19 @@ #include +#include "core/file_sys/romfs_factory.h" +#include "core/hle/ipc_helpers.h" #include "core/hle/service/ncm/ncm.h" #include "core/hle/service/service.h" #include "core/hle/service/sm/sm.h" namespace Service::NCM { -class LocationResolver final : public ServiceFramework { class ILocationResolver final : public ServiceFramework { public: explicit ILocationResolver(FileSys::StorageId id) : ServiceFramework{"ILocationResolver"}, storage(id) { + // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "ResolveProgramPath"}, {1, nullptr, "RedirectProgramPath"}, @@ -37,6 +39,7 @@ public: {18, nullptr, ""}, {19, nullptr, ""}, }; + // clang-format on RegisterHandlers(functions); } @@ -48,6 +51,7 @@ private: class IRegisteredLocationResolver final : public ServiceFramework { public: explicit IRegisteredLocationResolver() : ServiceFramework{"IRegisteredLocationResolver"} { + // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "ResolveProgramPath"}, {1, nullptr, "RegisterProgramPath"}, @@ -59,13 +63,27 @@ public: {7, nullptr, "RedirectHtmlDocumentPath"}, {8, nullptr, ""}, }; + // clang-format on RegisterHandlers(functions); } }; +class IAddOnContentLocationResolver final : public ServiceFramework { public: - explicit LocationResolver() : ServiceFramework{"lr"} { + explicit IAddOnContentLocationResolver() : ServiceFramework{"IAddOnContentLocationResolver"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ResolveAddOnContentPath"}, + {1, nullptr, "RegisterAddOnContentStorage"}, + {2, nullptr, "UnregisterAllAddOnContentPath"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + class LR final : public ServiceFramework { public: explicit LR() : ServiceFramework{"lr"} { @@ -80,27 +98,6 @@ public: RegisterHandlers(functions); } - -private: - void OpenLocationResolver(Kernel::HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto id = rp.PopRaw(); - - LOG_DEBUG(Service_NCM, "called, id={:02X}", static_cast(id)); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(std::make_shared(id)); - } - - void OpenRegisteredLocationResolver(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_NCM, "called"); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(std::make_shared()); - } - }; class NCM final : public ServiceFramework { @@ -129,7 +126,7 @@ public: }; void InstallInterfaces(SM::ServiceManager& sm) { - std::make_shared()->InstallAsService(sm); + std::make_shared()->InstallAsService(sm); std::make_shared()->InstallAsService(sm); }