2022-04-23 08:59:50 +00:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-02-15 03:22:41 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "core/hle/service/service.h"
|
|
|
|
|
2020-11-18 12:53:10 +00:00
|
|
|
namespace Core {
|
|
|
|
class System;
|
|
|
|
}
|
|
|
|
|
2019-04-22 21:53:58 +00:00
|
|
|
namespace Service {
|
|
|
|
|
|
|
|
namespace FileSystem {
|
|
|
|
class FileSystemController;
|
|
|
|
} // namespace FileSystem
|
|
|
|
|
|
|
|
namespace NS {
|
2018-02-15 03:22:41 +00:00
|
|
|
|
2019-05-23 07:55:56 +00:00
|
|
|
class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IAccountProxyInterface(Core::System& system_);
|
2019-06-05 20:20:24 +00:00
|
|
|
~IAccountProxyInterface() override;
|
2019-05-23 07:55:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> {
|
|
|
|
public:
|
2020-11-18 12:53:10 +00:00
|
|
|
explicit IApplicationManagerInterface(Core::System& system_);
|
2019-06-05 20:20:24 +00:00
|
|
|
~IApplicationManagerInterface() override;
|
2019-05-23 07:55:56 +00:00
|
|
|
|
|
|
|
ResultVal<u8> GetApplicationDesiredLanguage(u32 supported_languages);
|
|
|
|
ResultVal<u64> ConvertApplicationLanguageToLanguageCode(u8 application_language);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void GetApplicationControlData(Kernel::HLERequestContext& ctx);
|
|
|
|
void GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx);
|
|
|
|
void ConvertApplicationLanguageToLanguageCode(Kernel::HLERequestContext& ctx);
|
|
|
|
};
|
|
|
|
|
|
|
|
class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IApplicationVersionInterface(Core::System& system_);
|
2019-06-05 20:20:24 +00:00
|
|
|
~IApplicationVersionInterface() override;
|
2019-05-23 07:55:56 +00:00
|
|
|
};
|
|
|
|
|
2020-06-29 02:01:34 +00:00
|
|
|
class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> {
|
2019-05-23 07:55:56 +00:00
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IContentManagementInterface(Core::System& system_);
|
2020-06-29 02:01:34 +00:00
|
|
|
~IContentManagementInterface() override;
|
2019-05-23 07:55:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IDocumentInterface final : public ServiceFramework<IDocumentInterface> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IDocumentInterface(Core::System& system_);
|
2019-06-05 20:20:24 +00:00
|
|
|
~IDocumentInterface() override;
|
2019-05-23 07:55:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IDownloadTaskInterface(Core::System& system_);
|
2019-06-05 20:20:24 +00:00
|
|
|
~IDownloadTaskInterface() override;
|
2019-05-23 07:55:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IECommerceInterface final : public ServiceFramework<IECommerceInterface> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IECommerceInterface(Core::System& system_);
|
2019-06-05 20:20:24 +00:00
|
|
|
~IECommerceInterface() override;
|
2019-05-23 07:55:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IFactoryResetInterface(Core::System& system_);
|
2019-06-05 20:20:24 +00:00
|
|
|
~IFactoryResetInterface() override;
|
2019-05-23 07:55:56 +00:00
|
|
|
};
|
|
|
|
|
2021-11-26 02:39:38 +00:00
|
|
|
class IReadOnlyApplicationControlDataInterface final
|
|
|
|
: public ServiceFramework<IReadOnlyApplicationControlDataInterface> {
|
|
|
|
public:
|
|
|
|
explicit IReadOnlyApplicationControlDataInterface(Core::System& system_);
|
|
|
|
~IReadOnlyApplicationControlDataInterface() override;
|
2022-10-11 22:15:30 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void GetApplicationControlData(Kernel::HLERequestContext& ctx);
|
2021-11-26 02:39:38 +00:00
|
|
|
};
|
|
|
|
|
2019-05-23 07:55:56 +00:00
|
|
|
class NS final : public ServiceFramework<NS> {
|
|
|
|
public:
|
2020-11-18 12:53:10 +00:00
|
|
|
explicit NS(const char* name, Core::System& system_);
|
2019-06-05 20:20:24 +00:00
|
|
|
~NS() override;
|
2019-05-23 07:55:56 +00:00
|
|
|
|
2019-05-23 08:28:27 +00:00
|
|
|
std::shared_ptr<IApplicationManagerInterface> GetApplicationManagerInterface() const;
|
2019-05-23 07:55:56 +00:00
|
|
|
|
|
|
|
private:
|
2020-11-18 12:53:10 +00:00
|
|
|
template <typename T, typename... Args>
|
2019-05-23 07:55:56 +00:00
|
|
|
void PushInterface(Kernel::HLERequestContext& ctx) {
|
|
|
|
LOG_DEBUG(Service_NS, "called");
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2020-11-26 20:19:08 +00:00
|
|
|
rb.PushIpcInterface<T>(system);
|
2019-05-23 07:55:56 +00:00
|
|
|
}
|
|
|
|
|
2020-11-18 12:53:10 +00:00
|
|
|
void PushIApplicationManagerInterface(Kernel::HLERequestContext& ctx) {
|
|
|
|
LOG_DEBUG(Service_NS, "called");
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2020-11-18 12:53:10 +00:00
|
|
|
rb.PushIpcInterface<IApplicationManagerInterface>(system);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T, typename... Args>
|
|
|
|
std::shared_ptr<T> GetInterface(Args&&... args) const {
|
2019-05-23 07:55:56 +00:00
|
|
|
static_assert(std::is_base_of_v<Kernel::SessionRequestHandler, T>,
|
|
|
|
"Not a base of ServiceFrameworkBase");
|
|
|
|
|
2020-11-18 12:53:10 +00:00
|
|
|
return std::make_shared<T>(std::forward<Args>(args)...);
|
2019-05-23 07:55:56 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-02-15 03:22:41 +00:00
|
|
|
/// Registers all NS services with the specified service manager.
|
2019-09-22 06:40:58 +00:00
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
2019-04-22 21:53:58 +00:00
|
|
|
|
|
|
|
} // namespace NS
|
|
|
|
} // namespace Service
|