2018-02-14 19:22:41 -08:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "core/hle/service/service.h"
|
|
|
|
|
2020-11-18 04:53:10 -08:00
|
|
|
namespace Core {
|
|
|
|
class System;
|
|
|
|
}
|
|
|
|
|
2019-04-22 14:53:58 -07:00
|
|
|
namespace Service {
|
|
|
|
|
|
|
|
namespace FileSystem {
|
|
|
|
class FileSystemController;
|
|
|
|
} // namespace FileSystem
|
|
|
|
|
|
|
|
namespace NS {
|
2018-02-14 19:22:41 -08:00
|
|
|
|
2019-05-23 00:55:56 -07:00
|
|
|
class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> {
|
|
|
|
public:
|
|
|
|
explicit IAccountProxyInterface();
|
2019-06-05 13:20:24 -07:00
|
|
|
~IAccountProxyInterface() override;
|
2019-05-23 00:55:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> {
|
|
|
|
public:
|
2020-11-18 04:53:10 -08:00
|
|
|
explicit IApplicationManagerInterface(Core::System& system_);
|
2019-06-05 13:20:24 -07:00
|
|
|
~IApplicationManagerInterface() override;
|
2019-05-23 00:55:56 -07: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);
|
2020-11-18 04:53:10 -08:00
|
|
|
|
|
|
|
Core::System& system;
|
2019-05-23 00:55:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> {
|
|
|
|
public:
|
|
|
|
explicit IApplicationVersionInterface();
|
2019-06-05 13:20:24 -07:00
|
|
|
~IApplicationVersionInterface() override;
|
2019-05-23 00:55:56 -07:00
|
|
|
};
|
|
|
|
|
2020-06-28 19:01:34 -07:00
|
|
|
class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> {
|
2019-05-23 00:55:56 -07:00
|
|
|
public:
|
2020-06-28 19:01:34 -07:00
|
|
|
explicit IContentManagementInterface();
|
|
|
|
~IContentManagementInterface() override;
|
2019-05-23 00:55:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class IDocumentInterface final : public ServiceFramework<IDocumentInterface> {
|
|
|
|
public:
|
|
|
|
explicit IDocumentInterface();
|
2019-06-05 13:20:24 -07:00
|
|
|
~IDocumentInterface() override;
|
2019-05-23 00:55:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> {
|
|
|
|
public:
|
|
|
|
explicit IDownloadTaskInterface();
|
2019-06-05 13:20:24 -07:00
|
|
|
~IDownloadTaskInterface() override;
|
2019-05-23 00:55:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class IECommerceInterface final : public ServiceFramework<IECommerceInterface> {
|
|
|
|
public:
|
|
|
|
explicit IECommerceInterface();
|
2019-06-05 13:20:24 -07:00
|
|
|
~IECommerceInterface() override;
|
2019-05-23 00:55:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> {
|
|
|
|
public:
|
|
|
|
explicit IFactoryResetInterface();
|
2019-06-05 13:20:24 -07:00
|
|
|
~IFactoryResetInterface() override;
|
2019-05-23 00:55:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class NS final : public ServiceFramework<NS> {
|
|
|
|
public:
|
2020-11-18 04:53:10 -08:00
|
|
|
explicit NS(const char* name, Core::System& system_);
|
2019-06-05 13:20:24 -07:00
|
|
|
~NS() override;
|
2019-05-23 00:55:56 -07:00
|
|
|
|
2019-05-23 01:28:27 -07:00
|
|
|
std::shared_ptr<IApplicationManagerInterface> GetApplicationManagerInterface() const;
|
2019-05-23 00:55:56 -07:00
|
|
|
|
|
|
|
private:
|
2020-11-18 04:53:10 -08:00
|
|
|
template <typename T, typename... Args>
|
2019-05-23 00:55:56 -07:00
|
|
|
void PushInterface(Kernel::HLERequestContext& ctx) {
|
|
|
|
LOG_DEBUG(Service_NS, "called");
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<T>();
|
|
|
|
}
|
|
|
|
|
2020-11-18 04:53:10 -08:00
|
|
|
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 {
|
2019-05-23 00:55:56 -07:00
|
|
|
static_assert(std::is_base_of_v<Kernel::SessionRequestHandler, T>,
|
|
|
|
"Not a base of ServiceFrameworkBase");
|
|
|
|
|
2020-11-18 04:53:10 -08:00
|
|
|
return std::make_shared<T>(std::forward<Args>(args)...);
|
2019-05-23 00:55:56 -07:00
|
|
|
}
|
2020-11-18 04:53:10 -08:00
|
|
|
|
|
|
|
Core::System& system;
|
2019-05-23 00:55:56 -07:00
|
|
|
};
|
|
|
|
|
2018-02-14 19:22:41 -08:00
|
|
|
/// Registers all NS services with the specified service manager.
|
2019-09-21 23:40:58 -07:00
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
2019-04-22 14:53:58 -07:00
|
|
|
|
|
|
|
} // namespace NS
|
|
|
|
} // namespace Service
|