diff options
| author | 2019-05-26 20:36:54 -0400 | |
|---|---|---|
| committer | 2019-05-26 20:37:13 -0400 | |
| commit | 52b80d231cb3e1b234f1fcfe00cc1577d42cb966 (patch) | |
| tree | 3a65edec3227263505f810ac53cf274e7fb21379 /src/core | |
| parent | ncm: Implement LR OpenRegisteredLocationResolver (1) (diff) | |
| download | yuzu-52b80d231cb3e1b234f1fcfe00cc1577d42cb966.tar.gz yuzu-52b80d231cb3e1b234f1fcfe00cc1577d42cb966.tar.xz yuzu-52b80d231cb3e1b234f1fcfe00cc1577d42cb966.zip | |
ncm: Implement LR OpenAddOnContentLocationResolver (2)
Returns an object of type IAddOnContentLocationResolver for the provided StorageId.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/ncm/ncm.cpp | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp index c59bcc2a7..b405a4b66 100644 --- a/src/core/hle/service/ncm/ncm.cpp +++ b/src/core/hle/service/ncm/ncm.cpp | |||
| @@ -4,17 +4,19 @@ | |||
| 4 | 4 | ||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | 6 | ||
| 7 | #include "core/file_sys/romfs_factory.h" | ||
| 8 | #include "core/hle/ipc_helpers.h" | ||
| 7 | #include "core/hle/service/ncm/ncm.h" | 9 | #include "core/hle/service/ncm/ncm.h" |
| 8 | #include "core/hle/service/service.h" | 10 | #include "core/hle/service/service.h" |
| 9 | #include "core/hle/service/sm/sm.h" | 11 | #include "core/hle/service/sm/sm.h" |
| 10 | 12 | ||
| 11 | namespace Service::NCM { | 13 | namespace Service::NCM { |
| 12 | 14 | ||
| 13 | class LocationResolver final : public ServiceFramework<LocationResolver> { | ||
| 14 | class ILocationResolver final : public ServiceFramework<ILocationResolver> { | 15 | class ILocationResolver final : public ServiceFramework<ILocationResolver> { |
| 15 | public: | 16 | public: |
| 16 | explicit ILocationResolver(FileSys::StorageId id) | 17 | explicit ILocationResolver(FileSys::StorageId id) |
| 17 | : ServiceFramework{"ILocationResolver"}, storage(id) { | 18 | : ServiceFramework{"ILocationResolver"}, storage(id) { |
| 19 | // clang-format off | ||
| 18 | static const FunctionInfo functions[] = { | 20 | static const FunctionInfo functions[] = { |
| 19 | {0, nullptr, "ResolveProgramPath"}, | 21 | {0, nullptr, "ResolveProgramPath"}, |
| 20 | {1, nullptr, "RedirectProgramPath"}, | 22 | {1, nullptr, "RedirectProgramPath"}, |
| @@ -37,6 +39,7 @@ public: | |||
| 37 | {18, nullptr, ""}, | 39 | {18, nullptr, ""}, |
| 38 | {19, nullptr, ""}, | 40 | {19, nullptr, ""}, |
| 39 | }; | 41 | }; |
| 42 | // clang-format on | ||
| 40 | 43 | ||
| 41 | RegisterHandlers(functions); | 44 | RegisterHandlers(functions); |
| 42 | } | 45 | } |
| @@ -48,6 +51,7 @@ private: | |||
| 48 | class IRegisteredLocationResolver final : public ServiceFramework<IRegisteredLocationResolver> { | 51 | class IRegisteredLocationResolver final : public ServiceFramework<IRegisteredLocationResolver> { |
| 49 | public: | 52 | public: |
| 50 | explicit IRegisteredLocationResolver() : ServiceFramework{"IRegisteredLocationResolver"} { | 53 | explicit IRegisteredLocationResolver() : ServiceFramework{"IRegisteredLocationResolver"} { |
| 54 | // clang-format off | ||
| 51 | static const FunctionInfo functions[] = { | 55 | static const FunctionInfo functions[] = { |
| 52 | {0, nullptr, "ResolveProgramPath"}, | 56 | {0, nullptr, "ResolveProgramPath"}, |
| 53 | {1, nullptr, "RegisterProgramPath"}, | 57 | {1, nullptr, "RegisterProgramPath"}, |
| @@ -59,13 +63,27 @@ public: | |||
| 59 | {7, nullptr, "RedirectHtmlDocumentPath"}, | 63 | {7, nullptr, "RedirectHtmlDocumentPath"}, |
| 60 | {8, nullptr, ""}, | 64 | {8, nullptr, ""}, |
| 61 | }; | 65 | }; |
| 66 | // clang-format on | ||
| 62 | 67 | ||
| 63 | RegisterHandlers(functions); | 68 | RegisterHandlers(functions); |
| 64 | } | 69 | } |
| 65 | }; | 70 | }; |
| 66 | 71 | ||
| 72 | class IAddOnContentLocationResolver final : public ServiceFramework<IAddOnContentLocationResolver> { | ||
| 67 | public: | 73 | public: |
| 68 | explicit LocationResolver() : ServiceFramework{"lr"} { | 74 | explicit IAddOnContentLocationResolver() : ServiceFramework{"IAddOnContentLocationResolver"} { |
| 75 | // clang-format off | ||
| 76 | static const FunctionInfo functions[] = { | ||
| 77 | {0, nullptr, "ResolveAddOnContentPath"}, | ||
| 78 | {1, nullptr, "RegisterAddOnContentStorage"}, | ||
| 79 | {2, nullptr, "UnregisterAllAddOnContentPath"}, | ||
| 80 | }; | ||
| 81 | // clang-format on | ||
| 82 | |||
| 83 | RegisterHandlers(functions); | ||
| 84 | } | ||
| 85 | }; | ||
| 86 | |||
| 69 | class LR final : public ServiceFramework<LR> { | 87 | class LR final : public ServiceFramework<LR> { |
| 70 | public: | 88 | public: |
| 71 | explicit LR() : ServiceFramework{"lr"} { | 89 | explicit LR() : ServiceFramework{"lr"} { |
| @@ -80,27 +98,6 @@ public: | |||
| 80 | 98 | ||
| 81 | RegisterHandlers(functions); | 99 | RegisterHandlers(functions); |
| 82 | } | 100 | } |
| 83 | |||
| 84 | private: | ||
| 85 | void OpenLocationResolver(Kernel::HLERequestContext& ctx) { | ||
| 86 | IPC::RequestParser rp{ctx}; | ||
| 87 | const auto id = rp.PopRaw<FileSys::StorageId>(); | ||
| 88 | |||
| 89 | LOG_DEBUG(Service_NCM, "called, id={:02X}", static_cast<u8>(id)); | ||
| 90 | |||
| 91 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 92 | rb.Push(RESULT_SUCCESS); | ||
| 93 | rb.PushIpcInterface(std::make_shared<ILocationResolver>(id)); | ||
| 94 | } | ||
| 95 | |||
| 96 | void OpenRegisteredLocationResolver(Kernel::HLERequestContext& ctx) { | ||
| 97 | LOG_DEBUG(Service_NCM, "called"); | ||
| 98 | |||
| 99 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 100 | rb.Push(RESULT_SUCCESS); | ||
| 101 | rb.PushIpcInterface(std::make_shared<IRegisteredLocationResolver>()); | ||
| 102 | } | ||
| 103 | |||
| 104 | }; | 101 | }; |
| 105 | 102 | ||
| 106 | class NCM final : public ServiceFramework<NCM> { | 103 | class NCM final : public ServiceFramework<NCM> { |
| @@ -129,7 +126,7 @@ public: | |||
| 129 | }; | 126 | }; |
| 130 | 127 | ||
| 131 | void InstallInterfaces(SM::ServiceManager& sm) { | 128 | void InstallInterfaces(SM::ServiceManager& sm) { |
| 132 | std::make_shared<LocationResolver>()->InstallAsService(sm); | 129 | std::make_shared<LR>()->InstallAsService(sm); |
| 133 | std::make_shared<NCM>()->InstallAsService(sm); | 130 | std::make_shared<NCM>()->InstallAsService(sm); |
| 134 | } | 131 | } |
| 135 | 132 | ||