2022-04-23 10:59:50 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-07-27 23:32:45 +02:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
2019-05-27 02:36:54 +02:00
|
|
|
#include "core/file_sys/romfs_factory.h"
|
|
|
|
#include "core/hle/ipc_helpers.h"
|
2018-07-27 23:32:45 +02:00
|
|
|
#include "core/hle/service/ncm/ncm.h"
|
|
|
|
#include "core/hle/service/service.h"
|
|
|
|
#include "core/hle/service/sm/sm.h"
|
|
|
|
|
|
|
|
namespace Service::NCM {
|
|
|
|
|
2019-04-10 20:38:27 +02:00
|
|
|
class ILocationResolver final : public ServiceFramework<ILocationResolver> {
|
|
|
|
public:
|
2020-11-26 21:19:08 +01:00
|
|
|
explicit ILocationResolver(Core::System& system_, FileSys::StorageId id)
|
|
|
|
: ServiceFramework{system_, "ILocationResolver"}, storage{id} {
|
2019-05-27 02:36:54 +02:00
|
|
|
// clang-format off
|
2019-04-10 20:38:27 +02:00
|
|
|
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"},
|
2020-06-27 13:05:22 +02:00
|
|
|
{10, nullptr, "RedirectApplicationProgramPath"},
|
|
|
|
{11, nullptr, "ClearApplicationRedirection"},
|
|
|
|
{12, nullptr, "EraseProgramRedirection"},
|
|
|
|
{13, nullptr, "EraseApplicationControlRedirection"},
|
|
|
|
{14, nullptr, "EraseApplicationHtmlDocumentRedirection"},
|
|
|
|
{15, nullptr, "EraseApplicationLegalInformationRedirection"},
|
|
|
|
{16, nullptr, "ResolveProgramPathForDebug"},
|
|
|
|
{17, nullptr, "RedirectProgramPathForDebug"},
|
|
|
|
{18, nullptr, "RedirectApplicationProgramPathForDebug"},
|
|
|
|
{19, nullptr, "EraseProgramRedirectionForDebug"},
|
2019-04-10 20:38:27 +02:00
|
|
|
};
|
2019-05-27 02:36:54 +02:00
|
|
|
// clang-format on
|
2019-04-10 20:38:27 +02:00
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2020-11-14 23:57:51 +01:00
|
|
|
[[maybe_unused]] FileSys::StorageId storage;
|
2019-04-10 20:38:27 +02:00
|
|
|
};
|
|
|
|
|
2019-04-10 20:40:18 +02:00
|
|
|
class IRegisteredLocationResolver final : public ServiceFramework<IRegisteredLocationResolver> {
|
|
|
|
public:
|
2020-11-26 21:19:08 +01:00
|
|
|
explicit IRegisteredLocationResolver(Core::System& system_)
|
|
|
|
: ServiceFramework{system_, "IRegisteredLocationResolver"} {
|
2019-05-27 02:36:54 +02:00
|
|
|
// clang-format off
|
2019-04-10 20:40:18 +02:00
|
|
|
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"},
|
2019-11-12 14:54:58 +01:00
|
|
|
{8, nullptr, "Refresh"},
|
|
|
|
{9, nullptr, "RefreshExcluding"},
|
2019-04-10 20:40:18 +02:00
|
|
|
};
|
2019-05-27 02:36:54 +02:00
|
|
|
// clang-format on
|
2019-04-10 20:40:18 +02:00
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-05-27 02:36:54 +02:00
|
|
|
class IAddOnContentLocationResolver final : public ServiceFramework<IAddOnContentLocationResolver> {
|
2018-07-27 23:32:45 +02:00
|
|
|
public:
|
2020-11-26 21:19:08 +01:00
|
|
|
explicit IAddOnContentLocationResolver(Core::System& system_)
|
|
|
|
: ServiceFramework{system_, "IAddOnContentLocationResolver"} {
|
2019-05-27 02:36:54 +02:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "ResolveAddOnContentPath"},
|
|
|
|
{1, nullptr, "RegisterAddOnContentStorage"},
|
|
|
|
{2, nullptr, "UnregisterAllAddOnContentPath"},
|
2019-11-12 14:54:58 +01:00
|
|
|
{3, nullptr, "RefreshApplicationAddOnContent"},
|
|
|
|
{4, nullptr, "UnregisterApplicationAddOnContent"},
|
2019-05-27 02:36:54 +02:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-04-10 20:38:27 +02:00
|
|
|
class LR final : public ServiceFramework<LR> {
|
|
|
|
public:
|
2020-11-26 21:19:08 +01:00
|
|
|
explicit LR(Core::System& system_) : ServiceFramework{system_, "lr"} {
|
2018-07-27 23:32:45 +02:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "OpenLocationResolver"},
|
|
|
|
{1, nullptr, "OpenRegisteredLocationResolver"},
|
|
|
|
{2, nullptr, "RefreshLocationResolver"},
|
|
|
|
{3, nullptr, "OpenAddOnContentLocationResolver"},
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class NCM final : public ServiceFramework<NCM> {
|
|
|
|
public:
|
2020-11-26 21:19:08 +01:00
|
|
|
explicit NCM(Core::System& system_) : ServiceFramework{system_, "ncm"} {
|
2018-07-27 23:32:45 +02:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "CreateContentStorage"},
|
|
|
|
{1, nullptr, "CreateContentMetaDatabase"},
|
|
|
|
{2, nullptr, "VerifyContentStorage"},
|
|
|
|
{3, nullptr, "VerifyContentMetaDatabase"},
|
|
|
|
{4, nullptr, "OpenContentStorage"},
|
|
|
|
{5, nullptr, "OpenContentMetaDatabase"},
|
|
|
|
{6, nullptr, "CloseContentStorageForcibly"},
|
|
|
|
{7, nullptr, "CloseContentMetaDatabaseForcibly"},
|
|
|
|
{8, nullptr, "CleanupContentMetaDatabase"},
|
2019-01-30 04:29:07 +01:00
|
|
|
{9, nullptr, "ActivateContentStorage"},
|
|
|
|
{10, nullptr, "InactivateContentStorage"},
|
|
|
|
{11, nullptr, "ActivateContentMetaDatabase"},
|
|
|
|
{12, nullptr, "InactivateContentMetaDatabase"},
|
2019-11-12 14:54:58 +01:00
|
|
|
{13, nullptr, "InvalidateRightsIdCache"},
|
2020-04-20 21:18:23 +02:00
|
|
|
{14, nullptr, "GetMemoryReport"},
|
2018-07-27 23:32:45 +02:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-11-26 21:19:08 +01:00
|
|
|
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
|
|
|
std::make_shared<LR>(system)->InstallAsService(sm);
|
|
|
|
std::make_shared<NCM>(system)->InstallAsService(sm);
|
2018-07-27 23:32:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Service::NCM
|