mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
sf: Change interface definition methodology (#1074)
* sf: Begin experimenting with new interface declaration format * sf: convert fs interfaces to new format * sf: finish conversion of libstrat to new definitions * sf: convert loader to new format * sf: convert spl to new format * sf: update ncm for new format * sf: convert pm to new format * sf: convert ro/sm to new format * sf: update fatal for new format * sf: support building dmnt under new scheme * sf: update ams.mitm for new format * sf: correct invocation def for pointer holder * fs: correct 10.x+ user bindings for Get*SpaceSize
This commit is contained in:
parent
94eb2195d3
commit
9fde97cfdd
190 changed files with 3220 additions and 3172 deletions
|
@ -55,6 +55,7 @@
|
||||||
#include <stratosphere/map.hpp>
|
#include <stratosphere/map.hpp>
|
||||||
#include <stratosphere/ncm.hpp>
|
#include <stratosphere/ncm.hpp>
|
||||||
#include <stratosphere/nim.hpp>
|
#include <stratosphere/nim.hpp>
|
||||||
|
#include <stratosphere/ns.hpp>
|
||||||
#include <stratosphere/patcher.hpp>
|
#include <stratosphere/patcher.hpp>
|
||||||
#include <stratosphere/pgl.hpp>
|
#include <stratosphere/pgl.hpp>
|
||||||
#include <stratosphere/psc.hpp>
|
#include <stratosphere/psc.hpp>
|
||||||
|
|
|
@ -19,33 +19,14 @@
|
||||||
|
|
||||||
namespace ams::erpt::sf {
|
namespace ams::erpt::sf {
|
||||||
|
|
||||||
class IAttachment : public ams::sf::IServiceObject {
|
#define AMS_ERPT_I_ATTACHMENT_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, Open, (const AttachmentId &attachment_id)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, Read, (ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer)) \
|
||||||
Open = 0,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, SetFlags, (AttachmentFlagSet flags)) \
|
||||||
Read = 1,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, GetFlags, (ams::sf::Out<AttachmentFlagSet> out)) \
|
||||||
SetFlags = 2,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, Close, ()) \
|
||||||
GetFlags = 3,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, GetSize, (ams::sf::Out<s64> out))
|
||||||
Close = 4,
|
|
||||||
GetSize = 5,
|
AMS_SF_DEFINE_INTERFACE(IAttachment, AMS_ERPT_I_ATTACHMENT_INTERFACE_INFO)
|
||||||
};
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result Open(const AttachmentId &attachment_id) = 0;
|
|
||||||
virtual Result Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) = 0;
|
|
||||||
virtual Result SetFlags(AttachmentFlagSet flags) = 0;
|
|
||||||
virtual Result GetFlags(ams::sf::Out<AttachmentFlagSet> out) = 0;
|
|
||||||
virtual Result Close() = 0;
|
|
||||||
virtual Result GetSize(ams::sf::Out<s64> out) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(Open),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Read),
|
|
||||||
MAKE_SERVICE_COMMAND_META(SetFlags),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetFlags),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Close),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetSize),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -22,48 +22,20 @@
|
||||||
|
|
||||||
namespace ams::erpt::sf {
|
namespace ams::erpt::sf {
|
||||||
|
|
||||||
class IContext : public ams::sf::IServiceObject {
|
#define AMS_ERPT_I_CONTEXT_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, SubmitContext, (const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &str_buffer)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, CreateReport, (ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &str_buffer, const ams::sf::InBuffer &meta_buffer)) \
|
||||||
SubmitContext = 0,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, SetInitialLaunchSettingsCompletionTime, (const time::SteadyClockTimePoint &time_point), hos::Version_3_0_0) \
|
||||||
CreateReport = 1,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, ClearInitialLaunchSettingsCompletionTime, (), hos::Version_3_0_0) \
|
||||||
SetInitialLaunchSettingsCompletionTime = 2,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, UpdatePowerOnTime, (), hos::Version_3_0_0) \
|
||||||
ClearInitialLaunchSettingsCompletionTime = 3,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, UpdateAwakeTime, (), hos::Version_3_0_0) \
|
||||||
UpdatePowerOnTime = 4,
|
AMS_SF_METHOD_INFO(C, H, 6, Result, SubmitMultipleCategoryContext, (const MultipleCategoryContextEntry &ctx_entry, const ams::sf::InBuffer &str_buffer), hos::Version_5_0_0) \
|
||||||
UpdateAwakeTime = 5,
|
AMS_SF_METHOD_INFO(C, H, 7, Result, UpdateApplicationLaunchTime, (), hos::Version_6_0_0) \
|
||||||
SubmitMultipleCategoryContext = 6,
|
AMS_SF_METHOD_INFO(C, H, 8, Result, ClearApplicationLaunchTime, (), hos::Version_6_0_0) \
|
||||||
UpdateApplicationLaunchTime = 7,
|
AMS_SF_METHOD_INFO(C, H, 9, Result, SubmitAttachment, (ams::sf::Out<AttachmentId> out, const ams::sf::InBuffer &attachment_name, const ams::sf::InBuffer &attachment_data), hos::Version_8_0_0) \
|
||||||
ClearApplicationLaunchTime = 8,
|
AMS_SF_METHOD_INFO(C, H, 10, Result, CreateReportWithAttachments, (ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &str_buffer, const ams::sf::InBuffer &attachment_ids_buffer), hos::Version_8_0_0)
|
||||||
SubmitAttachment = 9,
|
|
||||||
CreateReportWithAttachments = 10,
|
|
||||||
};
|
AMS_SF_DEFINE_INTERFACE(IContext, AMS_ERPT_I_CONTEXT_INTERFACE_INFO)
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result SubmitContext(const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &str_buffer) = 0;
|
|
||||||
virtual Result CreateReport(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &str_buffer, const ams::sf::InBuffer &meta_buffer) = 0;
|
|
||||||
virtual Result SetInitialLaunchSettingsCompletionTime(const time::SteadyClockTimePoint &time_point) = 0;
|
|
||||||
virtual Result ClearInitialLaunchSettingsCompletionTime() = 0;
|
|
||||||
virtual Result UpdatePowerOnTime() = 0;
|
|
||||||
virtual Result UpdateAwakeTime() = 0;
|
|
||||||
virtual Result SubmitMultipleCategoryContext(const MultipleCategoryContextEntry &ctx_entry, const ams::sf::InBuffer &str_buffer) = 0;
|
|
||||||
virtual Result UpdateApplicationLaunchTime() = 0;
|
|
||||||
virtual Result ClearApplicationLaunchTime() = 0;
|
|
||||||
virtual Result SubmitAttachment(ams::sf::Out<AttachmentId> out, const ams::sf::InBuffer &attachment_name, const ams::sf::InBuffer &attachment_data) = 0;
|
|
||||||
virtual Result CreateReportWithAttachments(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &str_buffer, const ams::sf::InBuffer &attachment_ids_buffer) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(SubmitContext),
|
|
||||||
MAKE_SERVICE_COMMAND_META(CreateReport),
|
|
||||||
MAKE_SERVICE_COMMAND_META(SetInitialLaunchSettingsCompletionTime, hos::Version_3_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ClearInitialLaunchSettingsCompletionTime, hos::Version_3_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(UpdatePowerOnTime, hos::Version_3_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(UpdateAwakeTime, hos::Version_3_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(SubmitMultipleCategoryContext, hos::Version_5_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(UpdateApplicationLaunchTime, hos::Version_6_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ClearApplicationLaunchTime, hos::Version_6_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(SubmitAttachment, hos::Version_8_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(CreateReportWithAttachments, hos::Version_8_0_0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -19,33 +19,15 @@
|
||||||
|
|
||||||
namespace ams::erpt::sf {
|
namespace ams::erpt::sf {
|
||||||
|
|
||||||
class IManager : public ams::sf::IServiceObject {
|
#define AMS_ERPT_I_MANAGER_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GetReportList, (const ams::sf::OutBuffer &out_list, ReportType type_filter)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, GetEvent, (ams::sf::OutCopyHandle out)) \
|
||||||
GetReportList = 0,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, CleanupReports, (), hos::Version_4_0_0) \
|
||||||
GetEvent = 1,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, DeleteReport, (const ReportId &report_id), hos::Version_5_0_0) \
|
||||||
CleanupReports = 2,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, GetStorageUsageStatistics, (ams::sf::Out<StorageUsageStatistics> out), hos::Version_5_0_0) \
|
||||||
DeleteReport = 3,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, GetAttachmentList, (const ams::sf::OutBuffer &out_buf, const ReportId &report_id), hos::Version_8_0_0)
|
||||||
GetStorageUsageStatistics = 4,
|
|
||||||
GetAttachmentList = 5,
|
|
||||||
};
|
AMS_SF_DEFINE_INTERFACE(IManager, AMS_ERPT_I_MANAGER_INTERFACE_INFO)
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter) = 0;
|
|
||||||
virtual Result GetEvent(ams::sf::OutCopyHandle out) = 0;
|
|
||||||
virtual Result CleanupReports() = 0;
|
|
||||||
virtual Result DeleteReport(const ReportId &report_id) = 0;
|
|
||||||
virtual Result GetStorageUsageStatistics(ams::sf::Out<StorageUsageStatistics> out) = 0;
|
|
||||||
virtual Result GetAttachmentList(const ams::sf::OutBuffer &out_buf, const ReportId &report_id) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetReportList),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetEvent),
|
|
||||||
MAKE_SERVICE_COMMAND_META(CleanupReports, hos::Version_4_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(DeleteReport, hos::Version_5_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetStorageUsageStatistics, hos::Version_5_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetAttachmentList, hos::Version_8_0_0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -19,33 +19,15 @@
|
||||||
|
|
||||||
namespace ams::erpt::sf {
|
namespace ams::erpt::sf {
|
||||||
|
|
||||||
class IReport : public ams::sf::IServiceObject {
|
#define AMS_ERPT_I_REPORT_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, Open, (const ReportId &report_id)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, Read, (ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer)) \
|
||||||
Open = 0,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, SetFlags, (ReportFlagSet flags)) \
|
||||||
Read = 1,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, GetFlags, (ams::sf::Out<ReportFlagSet> out)) \
|
||||||
SetFlags = 2,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, Close, ()) \
|
||||||
GetFlags = 3,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, GetSize, (ams::sf::Out<s64> out))
|
||||||
Close = 4,
|
|
||||||
GetSize = 5,
|
|
||||||
};
|
AMS_SF_DEFINE_INTERFACE(IReport, AMS_ERPT_I_REPORT_INTERFACE_INFO)
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result Open(const ReportId &report_id) = 0;
|
|
||||||
virtual Result Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) = 0;
|
|
||||||
virtual Result SetFlags(ReportFlagSet flags) = 0;
|
|
||||||
virtual Result GetFlags(ams::sf::Out<ReportFlagSet> out) = 0;
|
|
||||||
virtual Result Close() = 0;
|
|
||||||
virtual Result GetSize(ams::sf::Out<s64> out) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(Open),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Read),
|
|
||||||
MAKE_SERVICE_COMMAND_META(SetFlags),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetFlags),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Close),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetSize),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -22,24 +22,11 @@
|
||||||
|
|
||||||
namespace ams::erpt::sf {
|
namespace ams::erpt::sf {
|
||||||
|
|
||||||
class ISession : public ams::sf::IServiceObject {
|
#define AMS_ERPT_I_SESSION_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, OpenReport, (ams::sf::Out<std::shared_ptr<erpt::sf::IReport>> out)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, OpenManager, (ams::sf::Out<std::shared_ptr<erpt::sf::IManager>> out)) \
|
||||||
OpenReport = 0,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, OpenAttachment, (ams::sf::Out<std::shared_ptr<erpt::sf::IAttachment>> out), hos::Version_8_0_0)
|
||||||
OpenManager = 1,
|
|
||||||
OpenAttachment = 2,
|
AMS_SF_DEFINE_INTERFACE(ISession, AMS_ERPT_I_SESSION_INTERFACE_INFO)
|
||||||
};
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result OpenReport(ams::sf::Out<std::shared_ptr<erpt::sf::IReport>> out) = 0;
|
|
||||||
virtual Result OpenManager(ams::sf::Out<std::shared_ptr<erpt::sf::IManager>> out) = 0;
|
|
||||||
virtual Result OpenAttachment(ams::sf::Out<std::shared_ptr<erpt::sf::IAttachment>> out) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(OpenReport),
|
|
||||||
MAKE_SERVICE_COMMAND_META(OpenManager),
|
|
||||||
MAKE_SERVICE_COMMAND_META(OpenAttachment, hos::Version_8_0_0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,4 +16,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "fatal/fatal_types.hpp"
|
#include <stratosphere/fatal/fatal_types.hpp>
|
||||||
|
|
||||||
|
#include <stratosphere/fatal/impl/fatal_i_service.hpp>
|
||||||
|
#include <stratosphere/fatal/impl/fatal_i_private_service.hpp>
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/fatal/fatal_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::fatal::impl {
|
||||||
|
|
||||||
|
#define AMS_FATAL_I_PRIVATE_SERVICE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GetFatalEvent, (sf::OutCopyHandle out_h))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IPrivateService, AMS_FATAL_I_PRIVATE_SERVICE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/fatal/fatal_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::fatal::impl {
|
||||||
|
|
||||||
|
#define AMS_FATAL_I_SERVICE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, ThrowFatal, (Result error, const sf::ClientProcessId &client_pid)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, ThrowFatalWithPolicy, (Result error, const sf::ClientProcessId &client_pid, FatalPolicy policy)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, ThrowFatalWithCpuContext, (Result error, const sf::ClientProcessId &client_pid, FatalPolicy policy, const CpuContext &cpu_ctx))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IService, AMS_FATAL_I_SERVICE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -14,8 +14,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "fs_common.hpp"
|
#include <stratosphere/fs/fs_common.hpp>
|
||||||
#include "../fssrv/fssrv_sf_path.hpp"
|
#include <stratosphere/fssrv/sf/fssrv_sf_path.hpp>
|
||||||
|
|
||||||
namespace ams::fs {
|
namespace ams::fs {
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "fs_common.hpp"
|
#include <stratosphere/fs/fs_common.hpp>
|
||||||
#include "../fssrv/fssrv_sf_path.hpp"
|
#include <stratosphere/fssrv/sf/fssrv_sf_path.hpp>
|
||||||
|
|
||||||
namespace ams::fs {
|
namespace ams::fs {
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "fs_common.hpp"
|
#include <stratosphere/fs/fs_common.hpp>
|
||||||
#include "fs_file.hpp"
|
#include <stratosphere/fs/fs_file.hpp>
|
||||||
|
|
||||||
namespace ams::fs {
|
namespace ams::fs {
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../fs_common.hpp"
|
#include <stratosphere/fs/fs_common.hpp>
|
||||||
#include "../fs_file.hpp"
|
#include <stratosphere/fs/fs_file.hpp>
|
||||||
#include "../fs_filesystem.hpp"
|
#include <stratosphere/fs/fs_filesystem.hpp>
|
||||||
#include "../fs_operate_range.hpp"
|
#include <stratosphere/fs/fs_operate_range.hpp>
|
||||||
|
|
||||||
namespace ams::fs::fsa {
|
namespace ams::fs::fsa {
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stratosphere/fssrv/fssrv_sf_path.hpp>
|
#include <stratosphere/fssrv/sf/fssrv_sf_path.hpp>
|
||||||
|
#include <stratosphere/fssrv/sf/fssrv_sf_ifile.hpp>
|
||||||
#include <stratosphere/fssrv/fssrv_path_normalizer.hpp>
|
#include <stratosphere/fssrv/fssrv_path_normalizer.hpp>
|
||||||
#include <stratosphere/fssrv/fssrv_nca_crypto_configuration.hpp>
|
#include <stratosphere/fssrv/fssrv_nca_crypto_configuration.hpp>
|
||||||
#include <stratosphere/fssrv/fssrv_memory_resource_from_standard_allocator.hpp>
|
#include <stratosphere/fssrv/fssrv_memory_resource_from_standard_allocator.hpp>
|
||||||
|
|
|
@ -14,13 +14,16 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../../fs/fs_common.hpp"
|
#include <stratosphere/fs/fs_common.hpp>
|
||||||
#include "../../fs/fs_file.hpp"
|
#include <stratosphere/fs/fs_file.hpp>
|
||||||
#include "../../fs/fs_directory.hpp"
|
#include <stratosphere/fs/fs_directory.hpp>
|
||||||
#include "../../fs/fs_filesystem.hpp"
|
#include <stratosphere/fs/fs_filesystem.hpp>
|
||||||
#include "../../fs/fs_query_range.hpp"
|
#include <stratosphere/fs/fs_query_range.hpp>
|
||||||
#include "../../fssrv/fssrv_sf_path.hpp"
|
#include <stratosphere/fssystem/fssystem_utility.hpp>
|
||||||
#include "../../fssystem/fssystem_utility.hpp"
|
#include <stratosphere/fssrv/sf/fssrv_sf_path.hpp>
|
||||||
|
#include <stratosphere/fssrv/sf/fssrv_sf_ifile.hpp>
|
||||||
|
#include <stratosphere/fssrv/sf/fssrv_sf_idirectory.hpp>
|
||||||
|
#include <stratosphere/fssrv/sf/fssrv_sf_ifilesystem.hpp>
|
||||||
|
|
||||||
namespace ams::fs::fsa {
|
namespace ams::fs::fsa {
|
||||||
|
|
||||||
|
@ -34,17 +37,8 @@ namespace ams::fssrv::impl {
|
||||||
|
|
||||||
class FileSystemInterfaceAdapter;
|
class FileSystemInterfaceAdapter;
|
||||||
|
|
||||||
class FileInterfaceAdapter final : public ams::sf::IServiceObject {
|
class FileInterfaceAdapter final {
|
||||||
NON_COPYABLE(FileInterfaceAdapter);
|
NON_COPYABLE(FileInterfaceAdapter);
|
||||||
public:
|
|
||||||
enum class CommandId {
|
|
||||||
Read = 0,
|
|
||||||
Write = 1,
|
|
||||||
Flush = 2,
|
|
||||||
SetSize = 3,
|
|
||||||
GetSize = 4,
|
|
||||||
OperateRange = 5,
|
|
||||||
};
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<FileSystemInterfaceAdapter> parent_filesystem;
|
std::shared_ptr<FileSystemInterfaceAdapter> parent_filesystem;
|
||||||
std::unique_ptr<fs::fsa::IFile> base_file;
|
std::unique_ptr<fs::fsa::IFile> base_file;
|
||||||
|
@ -62,27 +56,11 @@ namespace ams::fssrv::impl {
|
||||||
Result SetSize(s64 size);
|
Result SetSize(s64 size);
|
||||||
Result GetSize(ams::sf::Out<s64> out);
|
Result GetSize(ams::sf::Out<s64> out);
|
||||||
Result OperateRange(ams::sf::Out<fs::FileQueryRangeInfo> out, s32 op_id, s64 offset, s64 size);
|
Result OperateRange(ams::sf::Out<fs::FileQueryRangeInfo> out, s32 op_id, s64 offset, s64 size);
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
/* 1.0.0- */
|
|
||||||
MAKE_SERVICE_COMMAND_META(Read),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Write),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Flush),
|
|
||||||
MAKE_SERVICE_COMMAND_META(SetSize),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetSize),
|
|
||||||
|
|
||||||
/* 4.0.0- */
|
|
||||||
MAKE_SERVICE_COMMAND_META(OperateRange, hos::Version_4_0_0),
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
static_assert(fssrv::sf::IsIFile<FileInterfaceAdapter>);
|
||||||
|
|
||||||
class DirectoryInterfaceAdapter final : public ams::sf::IServiceObject {
|
class DirectoryInterfaceAdapter final {
|
||||||
NON_COPYABLE(DirectoryInterfaceAdapter);
|
NON_COPYABLE(DirectoryInterfaceAdapter);
|
||||||
public:
|
|
||||||
enum class CommandId {
|
|
||||||
Read = 0,
|
|
||||||
GetEntryCount = 1,
|
|
||||||
};
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<FileSystemInterfaceAdapter> parent_filesystem;
|
std::shared_ptr<FileSystemInterfaceAdapter> parent_filesystem;
|
||||||
std::unique_ptr<fs::fsa::IDirectory> base_dir;
|
std::unique_ptr<fs::fsa::IDirectory> base_dir;
|
||||||
|
@ -94,39 +72,11 @@ namespace ams::fssrv::impl {
|
||||||
/* Command API */
|
/* Command API */
|
||||||
Result Read(ams::sf::Out<s64> out, const ams::sf::OutBuffer &out_entries);
|
Result Read(ams::sf::Out<s64> out, const ams::sf::OutBuffer &out_entries);
|
||||||
Result GetEntryCount(ams::sf::Out<s64> out);
|
Result GetEntryCount(ams::sf::Out<s64> out);
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(Read),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetEntryCount),
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
static_assert(fssrv::sf::IsIDirectory<DirectoryInterfaceAdapter>);
|
||||||
|
|
||||||
class FileSystemInterfaceAdapter final : public std::enable_shared_from_this<FileSystemInterfaceAdapter>, public ams::sf::IServiceObject {
|
class FileSystemInterfaceAdapter final : public std::enable_shared_from_this<FileSystemInterfaceAdapter> {
|
||||||
NON_COPYABLE(FileSystemInterfaceAdapter);
|
NON_COPYABLE(FileSystemInterfaceAdapter);
|
||||||
public:
|
|
||||||
enum class CommandId {
|
|
||||||
/* 1.0.0+ */
|
|
||||||
CreateFile = 0,
|
|
||||||
DeleteFile = 1,
|
|
||||||
CreateDirectory = 2,
|
|
||||||
DeleteDirectory = 3,
|
|
||||||
DeleteDirectoryRecursively = 4,
|
|
||||||
RenameFile = 5,
|
|
||||||
RenameDirectory = 6,
|
|
||||||
GetEntryType = 7,
|
|
||||||
OpenFile = 8,
|
|
||||||
OpenDirectory = 9,
|
|
||||||
Commit = 10,
|
|
||||||
GetFreeSpaceSize = 11,
|
|
||||||
GetTotalSpaceSize = 12,
|
|
||||||
|
|
||||||
/* 3.0.0+ */
|
|
||||||
CleanDirectoryRecursively = 13,
|
|
||||||
GetFileTimeStampRaw = 14,
|
|
||||||
|
|
||||||
/* 4.0.0+ */
|
|
||||||
QueryEntry = 15,
|
|
||||||
};
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<fs::fsa::IFileSystem> base_fs;
|
std::shared_ptr<fs::fsa::IFileSystem> base_fs;
|
||||||
std::unique_lock<fssystem::SemaphoreAdapter> mount_count_semaphore;
|
std::unique_lock<fssystem::SemaphoreAdapter> mount_count_semaphore;
|
||||||
|
@ -153,8 +103,8 @@ namespace ams::fssrv::impl {
|
||||||
Result RenameFile(const fssrv::sf::Path &old_path, const fssrv::sf::Path &new_path);
|
Result RenameFile(const fssrv::sf::Path &old_path, const fssrv::sf::Path &new_path);
|
||||||
Result RenameDirectory(const fssrv::sf::Path &old_path, const fssrv::sf::Path &new_path);
|
Result RenameDirectory(const fssrv::sf::Path &old_path, const fssrv::sf::Path &new_path);
|
||||||
Result GetEntryType(ams::sf::Out<u32> out, const fssrv::sf::Path &path);
|
Result GetEntryType(ams::sf::Out<u32> out, const fssrv::sf::Path &path);
|
||||||
Result OpenFile(ams::sf::Out<std::shared_ptr<FileInterfaceAdapter>> out, const fssrv::sf::Path &path, u32 mode);
|
Result OpenFile(ams::sf::Out<std::shared_ptr<fssrv::sf::IFile>> out, const fssrv::sf::Path &path, u32 mode);
|
||||||
Result OpenDirectory(ams::sf::Out<std::shared_ptr<DirectoryInterfaceAdapter>> out, const fssrv::sf::Path &path, u32 mode);
|
Result OpenDirectory(ams::sf::Out<std::shared_ptr<fssrv::sf::IDirectory>> out, const fssrv::sf::Path &path, u32 mode);
|
||||||
Result Commit();
|
Result Commit();
|
||||||
Result GetFreeSpaceSize(ams::sf::Out<s64> out, const fssrv::sf::Path &path);
|
Result GetFreeSpaceSize(ams::sf::Out<s64> out, const fssrv::sf::Path &path);
|
||||||
Result GetTotalSpaceSize(ams::sf::Out<s64> out, const fssrv::sf::Path &path);
|
Result GetTotalSpaceSize(ams::sf::Out<s64> out, const fssrv::sf::Path &path);
|
||||||
|
@ -163,30 +113,6 @@ namespace ams::fssrv::impl {
|
||||||
Result GetFileTimeStampRaw(ams::sf::Out<fs::FileTimeStampRaw> out, const fssrv::sf::Path &path);
|
Result GetFileTimeStampRaw(ams::sf::Out<fs::FileTimeStampRaw> out, const fssrv::sf::Path &path);
|
||||||
|
|
||||||
Result QueryEntry(const ams::sf::OutBuffer &out_buf, const ams::sf::InBuffer &in_buf, s32 query_id, const fssrv::sf::Path &path);
|
Result QueryEntry(const ams::sf::OutBuffer &out_buf, const ams::sf::InBuffer &in_buf, s32 query_id, const fssrv::sf::Path &path);
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
/* 1.0.0- */
|
|
||||||
MAKE_SERVICE_COMMAND_META(CreateFile),
|
|
||||||
MAKE_SERVICE_COMMAND_META(DeleteFile),
|
|
||||||
MAKE_SERVICE_COMMAND_META(CreateDirectory),
|
|
||||||
MAKE_SERVICE_COMMAND_META(DeleteDirectory),
|
|
||||||
MAKE_SERVICE_COMMAND_META(DeleteDirectoryRecursively),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RenameFile),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RenameDirectory),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetEntryType),
|
|
||||||
MAKE_SERVICE_COMMAND_META(OpenFile),
|
|
||||||
MAKE_SERVICE_COMMAND_META(OpenDirectory),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Commit),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetFreeSpaceSize),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetTotalSpaceSize),
|
|
||||||
|
|
||||||
/* 3.0.0- */
|
|
||||||
MAKE_SERVICE_COMMAND_META(CleanDirectoryRecursively, hos::Version_3_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetFileTimeStampRaw, hos::Version_3_0_0),
|
|
||||||
|
|
||||||
/* 4.0.0- */
|
|
||||||
MAKE_SERVICE_COMMAND_META(QueryEntry, hos::Version_4_0_0),
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,10 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../../fs/fs_common.hpp"
|
#include <stratosphere/fs/fs_common.hpp>
|
||||||
#include "../../fs/fs_query_range.hpp"
|
#include <stratosphere/fs/fs_query_range.hpp>
|
||||||
#include "../../fssystem/fssystem_utility.hpp"
|
#include <stratosphere/fssystem/fssystem_utility.hpp>
|
||||||
|
#include <stratosphere/fssrv/sf/fssrv_sf_istorage.hpp>
|
||||||
|
|
||||||
namespace ams::fs {
|
namespace ams::fs {
|
||||||
|
|
||||||
|
@ -26,17 +27,8 @@ namespace ams::fs {
|
||||||
|
|
||||||
namespace ams::fssrv::impl {
|
namespace ams::fssrv::impl {
|
||||||
|
|
||||||
class StorageInterfaceAdapter final : public ams::sf::IServiceObject {
|
class StorageInterfaceAdapter final {
|
||||||
NON_COPYABLE(StorageInterfaceAdapter);
|
NON_COPYABLE(StorageInterfaceAdapter);
|
||||||
public:
|
|
||||||
enum class CommandId {
|
|
||||||
Read = 0,
|
|
||||||
Write = 1,
|
|
||||||
Flush = 2,
|
|
||||||
SetSize = 3,
|
|
||||||
GetSize = 4,
|
|
||||||
OperateRange = 5,
|
|
||||||
};
|
|
||||||
private:
|
private:
|
||||||
/* TODO: Nintendo uses fssystem::AsynchronousAccessStorage here. */
|
/* TODO: Nintendo uses fssystem::AsynchronousAccessStorage here. */
|
||||||
std::shared_ptr<fs::IStorage> base_storage;
|
std::shared_ptr<fs::IStorage> base_storage;
|
||||||
|
@ -53,7 +45,7 @@ namespace ams::fssrv::impl {
|
||||||
~StorageInterfaceAdapter();
|
~StorageInterfaceAdapter();
|
||||||
private:
|
private:
|
||||||
std::optional<std::shared_lock<os::ReadWriteLock>> AcquireCacheInvalidationReadLock();
|
std::optional<std::shared_lock<os::ReadWriteLock>> AcquireCacheInvalidationReadLock();
|
||||||
private:
|
public:
|
||||||
/* Command API. */
|
/* Command API. */
|
||||||
Result Read(s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size);
|
Result Read(s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size);
|
||||||
Result Write(s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size);
|
Result Write(s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size);
|
||||||
|
@ -61,18 +53,7 @@ namespace ams::fssrv::impl {
|
||||||
Result SetSize(s64 size);
|
Result SetSize(s64 size);
|
||||||
Result GetSize(ams::sf::Out<s64> out);
|
Result GetSize(ams::sf::Out<s64> out);
|
||||||
Result OperateRange(ams::sf::Out<fs::StorageQueryRangeInfo> out, s32 op_id, s64 offset, s64 size);
|
Result OperateRange(ams::sf::Out<fs::StorageQueryRangeInfo> out, s32 op_id, s64 offset, s64 size);
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
/* 1.0.0- */
|
|
||||||
MAKE_SERVICE_COMMAND_META(Read),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Write),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Flush),
|
|
||||||
MAKE_SERVICE_COMMAND_META(SetSize),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetSize),
|
|
||||||
|
|
||||||
/* 4.0.0- */
|
|
||||||
MAKE_SERVICE_COMMAND_META(OperateRange, hos::Version_4_0_0),
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
static_assert(fssrv::sf::IsIStorage<StorageInterfaceAdapter>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/fs/fs_directory.hpp>
|
||||||
|
|
||||||
|
namespace ams::fssrv::sf {
|
||||||
|
|
||||||
|
#define AMS_FSSRV_I_DIRECTORY_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, Read, (ams::sf::Out<s64> out, const ams::sf::OutBuffer &out_entries)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, GetEntryCount, (ams::sf::Out<s64> out))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IDirectory, AMS_FSSRV_I_DIRECTORY_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/fs/fs_file.hpp>
|
||||||
|
#include <stratosphere/fs/fs_query_range.hpp>
|
||||||
|
|
||||||
|
namespace ams::fssrv::sf {
|
||||||
|
|
||||||
|
#define AMS_FSSRV_I_FILE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, Read, (ams::sf::Out<s64> out, s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size, ams::fs::ReadOption option)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, Write, (s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size, ams::fs::WriteOption option)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, Flush, ()) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, Result, SetSize, (s64 size)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, Result, GetSize, (ams::sf::Out<s64> out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 5, Result, OperateRange, (ams::sf::Out<ams::fs::FileQueryRangeInfo> out, s32 op_id, s64 offset, s64 size), hos::Version_4_0_0) \
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IFile, AMS_FSSRV_I_FILE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/fs/fs_filesystem.hpp>
|
||||||
|
#include <stratosphere/fs/fs_filesystem_for_debug.hpp>
|
||||||
|
#include <stratosphere/fssrv/sf/fssrv_sf_path.hpp>
|
||||||
|
#include <stratosphere/fssrv/sf/fssrv_sf_ifile.hpp>
|
||||||
|
#include <stratosphere/fssrv/sf/fssrv_sf_idirectory.hpp>
|
||||||
|
|
||||||
|
namespace ams::fssrv::sf {
|
||||||
|
|
||||||
|
#define AMS_FSSRV_I_FILESYSTEM_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, CreateFile, (const ams::fssrv::sf::Path &path, s64 size, s32 option)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, DeleteFile, (const ams::fssrv::sf::Path &path)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, CreateDirectory, (const ams::fssrv::sf::Path &path)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, Result, DeleteDirectory, (const ams::fssrv::sf::Path &path)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, Result, DeleteDirectoryRecursively, (const ams::fssrv::sf::Path &path)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 5, Result, RenameFile, (const ams::fssrv::sf::Path &old_path, const ams::fssrv::sf::Path &new_path)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 6, Result, RenameDirectory, (const ams::fssrv::sf::Path &old_path, const ams::fssrv::sf::Path &new_path)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 7, Result, GetEntryType, (ams::sf::Out<u32> out, const ams::fssrv::sf::Path &path)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 8, Result, OpenFile, (ams::sf::Out<std::shared_ptr<ams::fssrv::sf::IFile>> out, const ams::fssrv::sf::Path &path, u32 mode)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 9, Result, OpenDirectory, (ams::sf::Out<std::shared_ptr<ams::fssrv::sf::IDirectory>> out, const ams::fssrv::sf::Path &path, u32 mode)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 10, Result, Commit, ()) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 11, Result, GetFreeSpaceSize, (ams::sf::Out<s64> out, const ams::fssrv::sf::Path &path)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 12, Result, GetTotalSpaceSize, (ams::sf::Out<s64> out, const ams::fssrv::sf::Path &path)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 13, Result, CleanDirectoryRecursively, (const ams::fssrv::sf::Path &path), hos::Version_3_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 14, Result, GetFileTimeStampRaw, (ams::sf::Out<ams::fs::FileTimeStampRaw> out, const ams::fssrv::sf::Path &path), hos::Version_3_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 15, Result, QueryEntry, (const ams::sf::OutBuffer &out_buf, const ams::sf::InBuffer &in_buf, s32 query_id, const ams::fssrv::sf::Path &path), hos::Version_4_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IFileSystem, AMS_FSSRV_I_FILESYSTEM_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/fs/fs_file.hpp>
|
||||||
|
#include <stratosphere/fs/fs_query_range.hpp>
|
||||||
|
|
||||||
|
namespace ams::fssrv::sf {
|
||||||
|
|
||||||
|
#define AMS_FSSRV_I_STORAGE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, Read, (s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, Write, (s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, Flush, ()) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, Result, SetSize, (s64 size)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, Result, GetSize, (ams::sf::Out<s64> out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 5, Result, OperateRange, (ams::sf::Out<ams::fs::StorageQueryRangeInfo> out, s32 op_id, s64 offset, s64 size), hos::Version_4_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IStorage, AMS_FSSRV_I_STORAGE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -60,6 +60,4 @@ namespace ams::hos {
|
||||||
Version_Max = ::ams::TargetFirmware_Max,
|
Version_Max = ::ams::TargetFirmware_Max,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,3 +19,6 @@
|
||||||
#include <stratosphere/ldr/ldr_types.hpp>
|
#include <stratosphere/ldr/ldr_types.hpp>
|
||||||
#include <stratosphere/ldr/ldr_shell_api.hpp>
|
#include <stratosphere/ldr/ldr_shell_api.hpp>
|
||||||
#include <stratosphere/ldr/ldr_pm_api.hpp>
|
#include <stratosphere/ldr/ldr_pm_api.hpp>
|
||||||
|
#include <stratosphere/ldr/impl/ldr_process_manager_interface.hpp>
|
||||||
|
#include <stratosphere/ldr/impl/ldr_debug_monitor_interface.hpp>
|
||||||
|
#include <stratosphere/ldr/impl/ldr_shell_interface.hpp>
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/ldr/ldr_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::ldr::impl {
|
||||||
|
|
||||||
|
#define AMS_LDR_I_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, SetProgramArguments, (ncm::ProgramId program_id, const sf::InPointerBuffer &args, u32 args_size)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, FlushArguments, ()) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, GetProcessModuleInfo, (sf::Out<u32> count, const sf::OutPointerArray<ModuleInfo> &out, os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65000, void, AtmosphereHasLaunchedProgram, (sf::Out<bool> out, ncm::ProgramId program_id))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IDebugMonitorInterface, AMS_LDR_I_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/ldr/ldr_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::ldr::impl {
|
||||||
|
|
||||||
|
#define AMS_LDR_I_PROCESS_MANAGER_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, CreateProcess, (sf::OutMoveHandle proc_h, PinId id, u32 flags, sf::CopyHandle reslimit_h)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, GetProgramInfo, (sf::Out<ProgramInfo> out_program_info, const ncm::ProgramLocation &loc)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, PinProgram, (sf::Out<PinId> out_id, const ncm::ProgramLocation &loc)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, Result, UnpinProgram, (PinId id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, Result, SetEnabledProgramVerification, (bool enabled), hos::Version_10_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65000, void, AtmosphereHasLaunchedProgram, (sf::Out<bool> out, ncm::ProgramId program_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65001, Result, AtmosphereGetProgramInfo, (sf::Out<ProgramInfo> out_program_info, sf::Out<cfg::OverrideStatus> out_status, const ncm::ProgramLocation &loc)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65002, Result, AtmospherePinProgram, (sf::Out<PinId> out_id, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &override_status))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IProcessManagerInterface, AMS_LDR_I_PROCESS_MANAGER_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/ldr/ldr_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::ldr::impl {
|
||||||
|
|
||||||
|
#define AMS_LDR_I_SHELL_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, SetProgramArguments, (ncm::ProgramId program_id, const sf::InPointerBuffer &args, u32 args_size)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, FlushArguments, ()) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65000, Result, AtmosphereRegisterExternalCode, (sf::OutMoveHandle out, ncm::ProgramId program_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65001, void, AtmosphereUnregisterExternalCode, (ncm::ProgramId program_id))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IShellInterface, AMS_LDR_I_SHELL_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -19,34 +19,14 @@
|
||||||
|
|
||||||
namespace ams::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
class IAddOnContentLocationResolver : public sf::IServiceObject {
|
#define AMS_LR_I_ADD_ON_CONTENT_LOCATION_RESOLVER_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, ResolveAddOnContentPath, (sf::Out<Path> out, ncm::DataId id), hos::Version_2_0_0) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, RegisterAddOnContentStorageDeprecated, (ncm::DataId id, ncm::StorageId storage_id), hos::Version_2_0_0, hos::Version_8_1_1) \
|
||||||
ResolveAddOnContentPath = 0,
|
AMS_SF_METHOD_INFO(C, H, 1, Result, RegisterAddOnContentStorage, (ncm::DataId id, ncm::ApplicationId application_id, ncm::StorageId storage_id), hos::Version_9_0_0) \
|
||||||
RegisterAddOnContentStorageDeprecated = 1,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, UnregisterAllAddOnContentPath, (), hos::Version_2_0_0) \
|
||||||
RegisterAddOnContentStorage = 1,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, RefreshApplicationAddOnContent, (const sf::InArray<ncm::ApplicationId> &ids), hos::Version_9_0_0) \
|
||||||
UnregisterAllAddOnContentPath = 2,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, UnregisterApplicationAddOnContent, (ncm::ApplicationId id), hos::Version_9_0_0)
|
||||||
RefreshApplicationAddOnContent = 3,
|
|
||||||
UnregisterApplicationAddOnContent = 4,
|
|
||||||
};
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result ResolveAddOnContentPath(sf::Out<Path> out, ncm::DataId id) = 0;
|
|
||||||
virtual Result RegisterAddOnContentStorageDeprecated(ncm::DataId id, ncm::StorageId storage_id) = 0;
|
|
||||||
virtual Result RegisterAddOnContentStorage(ncm::DataId id, ncm::ApplicationId application_id, ncm::StorageId storage_id) = 0;
|
|
||||||
virtual Result UnregisterAllAddOnContentPath() = 0;
|
|
||||||
virtual Result RefreshApplicationAddOnContent(const sf::InArray<ncm::ApplicationId> &ids) = 0;
|
|
||||||
virtual Result UnregisterApplicationAddOnContent(ncm::ApplicationId id) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(ResolveAddOnContentPath, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RegisterAddOnContentStorageDeprecated, hos::Version_2_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RegisterAddOnContentStorage, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(UnregisterAllAddOnContentPath, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RefreshApplicationAddOnContent, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(UnregisterApplicationAddOnContent, hos::Version_9_0_0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IAddOnContentLocationResolver, AMS_LR_I_ADD_ON_CONTENT_LOCATION_RESOLVER_INTERFACE_INFO)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,97 +19,35 @@
|
||||||
|
|
||||||
namespace ams::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
class ILocationResolver : public sf::IServiceObject {
|
#define AMS_LR_I_LOCATION_RESOLVER_INTERFACE_INFO(C, H) \
|
||||||
NON_COPYABLE(ILocationResolver);
|
AMS_SF_METHOD_INFO(C, H, 0, Result, ResolveProgramPath, (sf::Out<Path> out, ncm::ProgramId id)) \
|
||||||
NON_MOVEABLE(ILocationResolver);
|
AMS_SF_METHOD_INFO(C, H, 1, Result, RedirectProgramPath, (const Path &path, ncm::ProgramId id)) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 2, Result, ResolveApplicationControlPath, (sf::Out<Path> out, ncm::ProgramId id)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 3, Result, ResolveApplicationHtmlDocumentPath, (sf::Out<Path> out, ncm::ProgramId id)) \
|
||||||
ResolveProgramPath = 0,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, ResolveDataPath, (sf::Out<Path> out, ncm::DataId id)) \
|
||||||
RedirectProgramPath = 1,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, RedirectApplicationControlPathDeprecated, (const Path &path, ncm::ProgramId id), hos::Version_1_0_0, hos::Version_8_1_1) \
|
||||||
ResolveApplicationControlPath = 2,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, RedirectApplicationControlPath, (const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id), hos::Version_9_0_0) \
|
||||||
ResolveApplicationHtmlDocumentPath = 3,
|
AMS_SF_METHOD_INFO(C, H, 6, Result, RedirectApplicationHtmlDocumentPathDeprecated, (const Path &path, ncm::ProgramId id), hos::Version_1_0_0, hos::Version_8_1_1) \
|
||||||
ResolveDataPath = 4,
|
AMS_SF_METHOD_INFO(C, H, 6, Result, RedirectApplicationHtmlDocumentPath, (const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id), hos::Version_9_0_0) \
|
||||||
RedirectApplicationControlPathDeprecated = 5,
|
AMS_SF_METHOD_INFO(C, H, 7, Result, ResolveApplicationLegalInformationPath, (sf::Out<Path> out, ncm::ProgramId id)) \
|
||||||
RedirectApplicationControlPath = 5,
|
AMS_SF_METHOD_INFO(C, H, 8, Result, RedirectApplicationLegalInformationPathDeprecated, (const Path &path, ncm::ProgramId id), hos::Version_1_0_0, hos::Version_8_1_1) \
|
||||||
RedirectApplicationHtmlDocumentPathDeprecated = 6,
|
AMS_SF_METHOD_INFO(C, H, 8, Result, RedirectApplicationLegalInformationPath, (const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id), hos::Version_9_0_0) \
|
||||||
RedirectApplicationHtmlDocumentPath = 6,
|
AMS_SF_METHOD_INFO(C, H, 9, Result, Refresh, ()) \
|
||||||
ResolveApplicationLegalInformationPath = 7,
|
AMS_SF_METHOD_INFO(C, H, 10, Result, RedirectApplicationProgramPathDeprecated, (const Path &path, ncm::ProgramId id), hos::Version_5_0_0, hos::Version_8_1_1) \
|
||||||
RedirectApplicationLegalInformationPathDeprecated = 8,
|
AMS_SF_METHOD_INFO(C, H, 10, Result, RedirectApplicationProgramPath, (const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id), hos::Version_9_0_0) \
|
||||||
RedirectApplicationLegalInformationPath = 8,
|
AMS_SF_METHOD_INFO(C, H, 11, Result, ClearApplicationRedirectionDeprecated, (), hos::Version_5_0_0, hos::Version_8_1_1) \
|
||||||
Refresh = 9,
|
AMS_SF_METHOD_INFO(C, H, 11, Result, ClearApplicationRedirection, (const sf::InArray<ncm::ProgramId> &excluding_ids), hos::Version_9_0_0) \
|
||||||
RedirectApplicationProgramPathDeprecated = 10,
|
AMS_SF_METHOD_INFO(C, H, 12, Result, EraseProgramRedirection, (ncm::ProgramId id), hos::Version_5_0_0) \
|
||||||
RedirectApplicationProgramPath = 10,
|
AMS_SF_METHOD_INFO(C, H, 13, Result, EraseApplicationControlRedirection, (ncm::ProgramId id), hos::Version_5_0_0) \
|
||||||
ClearApplicationRedirectionDeprecated = 11,
|
AMS_SF_METHOD_INFO(C, H, 14, Result, EraseApplicationHtmlDocumentRedirection, (ncm::ProgramId id), hos::Version_5_0_0) \
|
||||||
ClearApplicationRedirection = 11,
|
AMS_SF_METHOD_INFO(C, H, 15, Result, EraseApplicationLegalInformationRedirection, (ncm::ProgramId id), hos::Version_5_0_0) \
|
||||||
EraseProgramRedirection = 12,
|
AMS_SF_METHOD_INFO(C, H, 16, Result, ResolveProgramPathForDebug, (sf::Out<Path> out, ncm::ProgramId id), hos::Version_7_0_0) \
|
||||||
EraseApplicationControlRedirection = 13,
|
AMS_SF_METHOD_INFO(C, H, 17, Result, RedirectProgramPathForDebug, (const Path &path, ncm::ProgramId id), hos::Version_7_0_0) \
|
||||||
EraseApplicationHtmlDocumentRedirection = 14,
|
AMS_SF_METHOD_INFO(C, H, 18, Result, RedirectApplicationProgramPathForDebugDeprecated, (const Path &path, ncm::ProgramId id), hos::Version_7_0_0, hos::Version_8_1_1) \
|
||||||
EraseApplicationLegalInformationRedirection = 15,
|
AMS_SF_METHOD_INFO(C, H, 18, Result, RedirectApplicationProgramPathForDebug, (const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id), hos::Version_9_0_0) \
|
||||||
ResolveProgramPathForDebug = 16,
|
AMS_SF_METHOD_INFO(C, H, 19, Result, EraseProgramRedirectionForDebug, (ncm::ProgramId id), hos::Version_7_0_0)
|
||||||
RedirectProgramPathForDebug = 17,
|
|
||||||
RedirectApplicationProgramPathForDebugDeprecated = 18,
|
|
||||||
RedirectApplicationProgramPathForDebug = 18,
|
AMS_SF_DEFINE_INTERFACE(ILocationResolver, AMS_LR_I_LOCATION_RESOLVER_INTERFACE_INFO)
|
||||||
EraseProgramRedirectionForDebug = 19,
|
|
||||||
};
|
|
||||||
public:
|
|
||||||
ILocationResolver() { /* ... */ }
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id) = 0;
|
|
||||||
virtual Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) = 0;
|
|
||||||
virtual Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) = 0;
|
|
||||||
virtual Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) = 0;
|
|
||||||
virtual Result Refresh() = 0;
|
|
||||||
virtual Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) = 0;
|
|
||||||
virtual Result ClearApplicationRedirectionDeprecated() = 0;
|
|
||||||
virtual Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids) = 0;
|
|
||||||
virtual Result EraseProgramRedirection(ncm::ProgramId id) = 0;
|
|
||||||
virtual Result EraseApplicationControlRedirection(ncm::ProgramId id) = 0;
|
|
||||||
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) = 0;
|
|
||||||
virtual Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) = 0;
|
|
||||||
virtual Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) = 0;
|
|
||||||
virtual Result EraseProgramRedirectionForDebug(ncm::ProgramId id) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(ResolveProgramPath),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectProgramPath),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ResolveApplicationControlPath),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ResolveApplicationHtmlDocumentPath),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ResolveDataPath),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectApplicationControlPathDeprecated, hos::Version_1_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectApplicationControlPath, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectApplicationHtmlDocumentPathDeprecated, hos::Version_1_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectApplicationHtmlDocumentPath, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ResolveApplicationLegalInformationPath),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectApplicationLegalInformationPathDeprecated, hos::Version_1_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectApplicationLegalInformationPath, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Refresh),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectApplicationProgramPathDeprecated, hos::Version_5_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectApplicationProgramPath, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ClearApplicationRedirectionDeprecated, hos::Version_5_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ClearApplicationRedirection, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(EraseProgramRedirection, hos::Version_5_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(EraseApplicationControlRedirection, hos::Version_5_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(EraseApplicationHtmlDocumentRedirection, hos::Version_5_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(EraseApplicationLegalInformationRedirection, hos::Version_5_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ResolveProgramPathForDebug, hos::Version_7_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectProgramPathForDebug, hos::Version_7_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectApplicationProgramPathForDebugDeprecated, hos::Version_7_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectApplicationProgramPathForDebug, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(EraseProgramRedirectionForDebug, hos::Version_7_0_0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,20 +22,12 @@
|
||||||
|
|
||||||
namespace ams::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
class ILocationResolverManager : public sf::IServiceObject {
|
#define AMS_LR_I_LOCATION_RESOLVER_MANAGER_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, OpenLocationResolver, (sf::Out<std::shared_ptr<ILocationResolver>> out, ncm::StorageId storage_id)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, OpenRegisteredLocationResolver, (sf::Out<std::shared_ptr<IRegisteredLocationResolver>> out)) \
|
||||||
OpenLocationResolver = 0,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, RefreshLocationResolver, (ncm::StorageId storage_id)) \
|
||||||
OpenRegisteredLocationResolver = 1,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, OpenAddOnContentLocationResolver, (sf::Out<std::shared_ptr<IAddOnContentLocationResolver>> out), hos::Version_2_0_0)
|
||||||
RefreshLocationResolver = 2,
|
|
||||||
OpenAddOnContentLocationResolver = 3,
|
AMS_SF_DEFINE_INTERFACE(ILocationResolverManager, AMS_LR_I_LOCATION_RESOLVER_MANAGER_INTERFACE_INFO)
|
||||||
};
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result OpenLocationResolver(sf::Out<std::shared_ptr<ILocationResolver>> out, ncm::StorageId storage_id) = 0;
|
|
||||||
virtual Result OpenRegisteredLocationResolver(sf::Out<std::shared_ptr<IRegisteredLocationResolver>> out) = 0;
|
|
||||||
virtual Result RefreshLocationResolver(ncm::StorageId storage_id) = 0;
|
|
||||||
virtual Result OpenAddOnContentLocationResolver(sf::Out<std::shared_ptr<IAddOnContentLocationResolver>> out) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,57 +19,22 @@
|
||||||
|
|
||||||
namespace ams::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
class IRegisteredLocationResolver : public sf::IServiceObject {
|
#define AMS_LR_I_REGISTERED_LOCATION_RESOLVER_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, ResolveProgramPath, (sf::Out<Path> out, ncm::ProgramId id)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, RegisterProgramPathDeprecated, (const Path &path, ncm::ProgramId id), hos::Version_1_0_0, hos::Version_8_1_1) \
|
||||||
ResolveProgramPath = 0,
|
AMS_SF_METHOD_INFO(C, H, 1, Result, RegisterProgramPath, (const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id), hos::Version_9_0_0) \
|
||||||
RegisterProgramPathDeprecated = 1,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, UnregisterProgramPath, (ncm::ProgramId id)) \
|
||||||
RegisterProgramPath = 1,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, RedirectProgramPathDeprecated, (const Path &path, ncm::ProgramId id), hos::Version_1_0_0, hos::Version_8_1_1) \
|
||||||
UnregisterProgramPath = 2,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, RedirectProgramPath, (const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id), hos::Version_9_0_0) \
|
||||||
RedirectProgramPathDeprecated = 3,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, ResolveHtmlDocumentPath, (sf::Out<Path> out, ncm::ProgramId id), hos::Version_2_0_0) \
|
||||||
RedirectProgramPath = 3,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, RegisterHtmlDocumentPathDeprecated, (const Path &path, ncm::ProgramId id), hos::Version_2_0_0, hos::Version_8_1_1) \
|
||||||
ResolveHtmlDocumentPath = 4,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, RegisterHtmlDocumentPath, (const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id), hos::Version_9_0_0) \
|
||||||
RegisterHtmlDocumentPathDeprecated = 5,
|
AMS_SF_METHOD_INFO(C, H, 6, Result, UnregisterHtmlDocumentPath, (ncm::ProgramId id), hos::Version_2_0_0) \
|
||||||
RegisterHtmlDocumentPath = 5,
|
AMS_SF_METHOD_INFO(C, H, 7, Result, RedirectHtmlDocumentPathDeprecated, (const Path &path, ncm::ProgramId id), hos::Version_2_0_0, hos::Version_8_1_1) \
|
||||||
UnregisterHtmlDocumentPath = 6,
|
AMS_SF_METHOD_INFO(C, H, 7, Result, RedirectHtmlDocumentPath, (const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id), hos::Version_9_0_0) \
|
||||||
RedirectHtmlDocumentPathDeprecated = 7,
|
AMS_SF_METHOD_INFO(C, H, 8, Result, Refresh, (), hos::Version_7_0_0) \
|
||||||
RedirectHtmlDocumentPath = 7,
|
AMS_SF_METHOD_INFO(C, H, 9, Result, RefreshExcluding, (const sf::InArray<ncm::ProgramId> &ids), hos::Version_9_0_0)
|
||||||
Refresh = 8,
|
|
||||||
RefreshExcluding = 9,
|
AMS_SF_DEFINE_INTERFACE(IRegisteredLocationResolver, AMS_LR_I_REGISTERED_LOCATION_RESOLVER_INTERFACE_INFO)
|
||||||
};
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RegisterProgramPathDeprecated(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RegisterProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) = 0;
|
|
||||||
virtual Result UnregisterProgramPath(ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectProgramPathDeprecated(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) = 0;
|
|
||||||
virtual Result ResolveHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RegisterHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RegisterHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) = 0;
|
|
||||||
virtual Result UnregisterHtmlDocumentPath(ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) = 0;
|
|
||||||
virtual Result RedirectHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) = 0;
|
|
||||||
virtual Result Refresh() = 0;
|
|
||||||
virtual Result RefreshExcluding(const sf::InArray<ncm::ProgramId> &ids) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(ResolveProgramPath),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RegisterProgramPathDeprecated, hos::Version_1_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RegisterProgramPath, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(UnregisterProgramPath),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectProgramPathDeprecated, hos::Version_1_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectProgramPath, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ResolveHtmlDocumentPath, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RegisterHtmlDocumentPathDeprecated, hos::Version_2_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RegisterHtmlDocumentPath, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(UnregisterHtmlDocumentPath, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectHtmlDocumentPathDeprecated, hos::Version_2_0_0, hos::Version_8_1_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RedirectHtmlDocumentPath, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Refresh, hos::Version_7_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RefreshExcluding, hos::Version_9_0_0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace ams::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
class LocationResolverManagerImpl final : public ILocationResolverManager {
|
class LocationResolverManagerImpl final {
|
||||||
private:
|
private:
|
||||||
/* Resolver storage. */
|
/* Resolver storage. */
|
||||||
ncm::BoundedMap<ncm::StorageId, std::shared_ptr<ILocationResolver>, 5> location_resolvers;
|
ncm::BoundedMap<ncm::StorageId, std::shared_ptr<ILocationResolver>, 5> location_resolvers;
|
||||||
|
@ -31,17 +31,11 @@ namespace ams::lr {
|
||||||
os::Mutex mutex{false};
|
os::Mutex mutex{false};
|
||||||
public:
|
public:
|
||||||
/* Actual commands. */
|
/* Actual commands. */
|
||||||
virtual Result OpenLocationResolver(sf::Out<std::shared_ptr<ILocationResolver>> out, ncm::StorageId storage_id) override;
|
Result OpenLocationResolver(sf::Out<std::shared_ptr<ILocationResolver>> out, ncm::StorageId storage_id);
|
||||||
virtual Result OpenRegisteredLocationResolver(sf::Out<std::shared_ptr<IRegisteredLocationResolver>> out) override;
|
Result OpenRegisteredLocationResolver(sf::Out<std::shared_ptr<IRegisteredLocationResolver>> out);
|
||||||
virtual Result RefreshLocationResolver(ncm::StorageId storage_id) override;
|
Result RefreshLocationResolver(ncm::StorageId storage_id);
|
||||||
virtual Result OpenAddOnContentLocationResolver(sf::Out<std::shared_ptr<IAddOnContentLocationResolver>> out) override;
|
Result OpenAddOnContentLocationResolver(sf::Out<std::shared_ptr<IAddOnContentLocationResolver>> out);
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(OpenLocationResolver),
|
|
||||||
MAKE_SERVICE_COMMAND_META(OpenRegisteredLocationResolver),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RefreshLocationResolver),
|
|
||||||
MAKE_SERVICE_COMMAND_META(OpenAddOnContentLocationResolver, hos::Version_2_0_0),
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
static_assert(IsILocationResolverManager<LocationResolverManagerImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace ams::ncm {
|
||||||
};
|
};
|
||||||
static_assert(util::is_pod<SystemSaveDataInfo>::value);
|
static_assert(util::is_pod<SystemSaveDataInfo>::value);
|
||||||
|
|
||||||
class ContentManagerImpl final : public IContentManager {
|
class ContentManagerImpl final {
|
||||||
private:
|
private:
|
||||||
constexpr static size_t MaxContentStorageRoots = 8;
|
constexpr static size_t MaxContentStorageRoots = 8;
|
||||||
constexpr static size_t MaxContentMetaDatabaseRoots = 8;
|
constexpr static size_t MaxContentMetaDatabaseRoots = 8;
|
||||||
|
@ -131,21 +131,22 @@ namespace ams::ncm {
|
||||||
Result EnsureAndMountSystemSaveData(const char *mount, const SystemSaveDataInfo &info) const;
|
Result EnsureAndMountSystemSaveData(const char *mount, const SystemSaveDataInfo &info) const;
|
||||||
public:
|
public:
|
||||||
/* Actual commands. */
|
/* Actual commands. */
|
||||||
virtual Result CreateContentStorage(StorageId storage_id) override;
|
Result CreateContentStorage(StorageId storage_id);
|
||||||
virtual Result CreateContentMetaDatabase(StorageId storage_id) override;
|
Result CreateContentMetaDatabase(StorageId storage_id);
|
||||||
virtual Result VerifyContentStorage(StorageId storage_id) override;
|
Result VerifyContentStorage(StorageId storage_id);
|
||||||
virtual Result VerifyContentMetaDatabase(StorageId storage_id) override;
|
Result VerifyContentMetaDatabase(StorageId storage_id);
|
||||||
virtual Result OpenContentStorage(sf::Out<std::shared_ptr<IContentStorage>> out, StorageId storage_id) override;
|
Result OpenContentStorage(sf::Out<std::shared_ptr<IContentStorage>> out, StorageId storage_id);
|
||||||
virtual Result OpenContentMetaDatabase(sf::Out<std::shared_ptr<IContentMetaDatabase>> out, StorageId storage_id) override;
|
Result OpenContentMetaDatabase(sf::Out<std::shared_ptr<IContentMetaDatabase>> out, StorageId storage_id);
|
||||||
virtual Result CloseContentStorageForcibly(StorageId storage_id) override;
|
Result CloseContentStorageForcibly(StorageId storage_id);
|
||||||
virtual Result CloseContentMetaDatabaseForcibly(StorageId storage_id) override;
|
Result CloseContentMetaDatabaseForcibly(StorageId storage_id);
|
||||||
virtual Result CleanupContentMetaDatabase(StorageId storage_id) override;
|
Result CleanupContentMetaDatabase(StorageId storage_id);
|
||||||
virtual Result ActivateContentStorage(StorageId storage_id) override;
|
Result ActivateContentStorage(StorageId storage_id);
|
||||||
virtual Result InactivateContentStorage(StorageId storage_id) override;
|
Result InactivateContentStorage(StorageId storage_id);
|
||||||
virtual Result ActivateContentMetaDatabase(StorageId storage_id) override;
|
Result ActivateContentMetaDatabase(StorageId storage_id);
|
||||||
virtual Result InactivateContentMetaDatabase(StorageId storage_id) override;
|
Result InactivateContentMetaDatabase(StorageId storage_id);
|
||||||
virtual Result InvalidateRightsIdCache() override;
|
Result InvalidateRightsIdCache();
|
||||||
virtual Result GetMemoryReport(sf::Out<MemoryReport> out) override;
|
Result GetMemoryReport(sf::Out<MemoryReport> out);
|
||||||
};
|
};
|
||||||
|
static_assert(IsIContentManager<ContentManagerImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,59 +20,23 @@
|
||||||
|
|
||||||
namespace ams::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
class IContentManager : public sf::IServiceObject {
|
#define AMS_NCM_I_CONTENT_MANAGER_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, CreateContentStorage, (StorageId storage_id)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, CreateContentMetaDatabase, (StorageId storage_id)) \
|
||||||
CreateContentStorage = 0,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, VerifyContentStorage, (StorageId storage_id)) \
|
||||||
CreateContentMetaDatabase = 1,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, VerifyContentMetaDatabase, (StorageId storage_id)) \
|
||||||
VerifyContentStorage = 2,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, OpenContentStorage, (sf::Out<std::shared_ptr<IContentStorage>> out, StorageId storage_id)) \
|
||||||
VerifyContentMetaDatabase = 3,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, OpenContentMetaDatabase, (sf::Out<std::shared_ptr<IContentMetaDatabase>> out, StorageId storage_id)) \
|
||||||
OpenContentStorage = 4,
|
AMS_SF_METHOD_INFO(C, H, 6, Result, CloseContentStorageForcibly, (StorageId storage_id), hos::Version_1_0_0, hos::Version_1_0_0) \
|
||||||
OpenContentMetaDatabase = 5,
|
AMS_SF_METHOD_INFO(C, H, 7, Result, CloseContentMetaDatabaseForcibly, (StorageId storage_id), hos::Version_1_0_0, hos::Version_1_0_0) \
|
||||||
CloseContentStorageForcibly = 6,
|
AMS_SF_METHOD_INFO(C, H, 8, Result, CleanupContentMetaDatabase, (StorageId storage_id)) \
|
||||||
CloseContentMetaDatabaseForcibly = 7,
|
AMS_SF_METHOD_INFO(C, H, 9, Result, ActivateContentStorage, (StorageId storage_id), hos::Version_2_0_0) \
|
||||||
CleanupContentMetaDatabase = 8,
|
AMS_SF_METHOD_INFO(C, H, 10, Result, InactivateContentStorage, (StorageId storage_id), hos::Version_2_0_0) \
|
||||||
ActivateContentStorage = 9,
|
AMS_SF_METHOD_INFO(C, H, 11, Result, ActivateContentMetaDatabase, (StorageId storage_id), hos::Version_2_0_0) \
|
||||||
InactivateContentStorage = 10,
|
AMS_SF_METHOD_INFO(C, H, 12, Result, InactivateContentMetaDatabase, (StorageId storage_id), hos::Version_2_0_0) \
|
||||||
ActivateContentMetaDatabase = 11,
|
AMS_SF_METHOD_INFO(C, H, 13, Result, InvalidateRightsIdCache, (), hos::Version_9_0_0) \
|
||||||
InactivateContentMetaDatabase = 12,
|
AMS_SF_METHOD_INFO(C, H, 14, Result, GetMemoryReport, (sf::Out<MemoryReport> out), hos::Version_10_0_0)
|
||||||
InvalidateRightsIdCache = 13,
|
|
||||||
GetMemoryReport = 14,
|
AMS_SF_DEFINE_INTERFACE(IContentManager, AMS_NCM_I_CONTENT_MANAGER_INTERFACE_INFO);
|
||||||
};
|
|
||||||
public:
|
|
||||||
virtual Result CreateContentStorage(StorageId storage_id) = 0;
|
|
||||||
virtual Result CreateContentMetaDatabase(StorageId storage_id) = 0;
|
|
||||||
virtual Result VerifyContentStorage(StorageId storage_id) = 0;
|
|
||||||
virtual Result VerifyContentMetaDatabase(StorageId storage_id) = 0;
|
|
||||||
virtual Result OpenContentStorage(sf::Out<std::shared_ptr<IContentStorage>> out, StorageId storage_id) = 0;
|
|
||||||
virtual Result OpenContentMetaDatabase(sf::Out<std::shared_ptr<IContentMetaDatabase>> out, StorageId storage_id) = 0;
|
|
||||||
virtual Result CloseContentStorageForcibly(StorageId storage_id) = 0;
|
|
||||||
virtual Result CloseContentMetaDatabaseForcibly(StorageId storage_id) = 0;
|
|
||||||
virtual Result CleanupContentMetaDatabase(StorageId storage_id) = 0;
|
|
||||||
virtual Result ActivateContentStorage(StorageId storage_id) = 0;
|
|
||||||
virtual Result InactivateContentStorage(StorageId storage_id) = 0;
|
|
||||||
virtual Result ActivateContentMetaDatabase(StorageId storage_id) = 0;
|
|
||||||
virtual Result InactivateContentMetaDatabase(StorageId storage_id) = 0;
|
|
||||||
virtual Result InvalidateRightsIdCache() = 0;
|
|
||||||
virtual Result GetMemoryReport(sf::Out<MemoryReport> out) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(CreateContentStorage),
|
|
||||||
MAKE_SERVICE_COMMAND_META(CreateContentMetaDatabase),
|
|
||||||
MAKE_SERVICE_COMMAND_META(VerifyContentStorage),
|
|
||||||
MAKE_SERVICE_COMMAND_META(VerifyContentMetaDatabase),
|
|
||||||
MAKE_SERVICE_COMMAND_META(OpenContentStorage),
|
|
||||||
MAKE_SERVICE_COMMAND_META(OpenContentMetaDatabase),
|
|
||||||
MAKE_SERVICE_COMMAND_META(CloseContentStorageForcibly, hos::Version_1_0_0, hos::Version_1_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(CloseContentMetaDatabaseForcibly, hos::Version_1_0_0, hos::Version_1_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(CleanupContentMetaDatabase),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ActivateContentStorage, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(InactivateContentStorage, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ActivateContentMetaDatabase, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(InactivateContentMetaDatabase, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(InvalidateRightsIdCache, hos::Version_9_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetMemoryReport, hos::Version_10_0_0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,84 +19,31 @@
|
||||||
|
|
||||||
namespace ams::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
class IContentMetaDatabase : public sf::IServiceObject {
|
#define AMS_NCM_I_CONTENT_META_DATABASE_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, Set, (const ContentMetaKey &key, sf::InBuffer value)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, Get, (sf::Out<u64> out_size, const ContentMetaKey &key, sf::OutBuffer out_value)) \
|
||||||
Set = 0,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, Remove, (const ContentMetaKey &key)) \
|
||||||
Get = 1,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, GetContentIdByType, (sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type)) \
|
||||||
Remove = 2,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, ListContentInfo, (sf::Out<s32> out_entries_written, const sf::OutArray<ContentInfo> &out_info, const ContentMetaKey &key, s32 offset)) \
|
||||||
GetContentIdByType = 3,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, List, (sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaKey> &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type)) \
|
||||||
ListContentInfo = 4,
|
AMS_SF_METHOD_INFO(C, H, 6, Result, GetLatestContentMetaKey, (sf::Out<ContentMetaKey> out_key, u64 id)) \
|
||||||
List = 5,
|
AMS_SF_METHOD_INFO(C, H, 7, Result, ListApplication, (sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ApplicationContentMetaKey> &out_keys, ContentMetaType meta_type)) \
|
||||||
GetLatestContentMetaKey = 6,
|
AMS_SF_METHOD_INFO(C, H, 8, Result, Has, (sf::Out<bool> out, const ContentMetaKey &key)) \
|
||||||
ListApplication = 7,
|
AMS_SF_METHOD_INFO(C, H, 9, Result, HasAll, (sf::Out<bool> out, const sf::InArray<ContentMetaKey> &keys)) \
|
||||||
Has = 8,
|
AMS_SF_METHOD_INFO(C, H, 10, Result, GetSize, (sf::Out<u64> out_size, const ContentMetaKey &key)) \
|
||||||
HasAll = 9,
|
AMS_SF_METHOD_INFO(C, H, 11, Result, GetRequiredSystemVersion, (sf::Out<u32> out_version, const ContentMetaKey &key)) \
|
||||||
GetSize = 10,
|
AMS_SF_METHOD_INFO(C, H, 12, Result, GetPatchId, (sf::Out<PatchId> out_patch_id, const ContentMetaKey &key)) \
|
||||||
GetRequiredSystemVersion = 11,
|
AMS_SF_METHOD_INFO(C, H, 13, Result, DisableForcibly, ()) \
|
||||||
GetPatchId = 12,
|
AMS_SF_METHOD_INFO(C, H, 14, Result, LookupOrphanContent, (const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids)) \
|
||||||
DisableForcibly = 13,
|
AMS_SF_METHOD_INFO(C, H, 15, Result, Commit, ()) \
|
||||||
LookupOrphanContent = 14,
|
AMS_SF_METHOD_INFO(C, H, 16, Result, HasContent, (sf::Out<bool> out, const ContentMetaKey &key, const ContentId &content_id)) \
|
||||||
Commit = 15,
|
AMS_SF_METHOD_INFO(C, H, 17, Result, ListContentMetaInfo, (sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaInfo> &out_meta_info, const ContentMetaKey &key, s32 offset)) \
|
||||||
HasContent = 16,
|
AMS_SF_METHOD_INFO(C, H, 18, Result, GetAttributes, (sf::Out<u8> out_attributes, const ContentMetaKey &key)) \
|
||||||
ListContentMetaInfo = 17,
|
AMS_SF_METHOD_INFO(C, H, 19, Result, GetRequiredApplicationVersion, (sf::Out<u32> out_version, const ContentMetaKey &key), hos::Version_2_0_0) \
|
||||||
GetAttributes = 18,
|
AMS_SF_METHOD_INFO(C, H, 20, Result, GetContentIdByTypeAndIdOffset, (sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset), hos::Version_5_0_0) \
|
||||||
GetRequiredApplicationVersion = 19,
|
AMS_SF_METHOD_INFO(C, H, 21, Result, GetCount, (sf::Out<u32> out_count), hos::Version_10_0_0) \
|
||||||
GetContentIdByTypeAndIdOffset = 20,
|
AMS_SF_METHOD_INFO(C, H, 22, Result, GetOwnerApplicationId, (sf::Out<ApplicationId> out_id, const ContentMetaKey &key), hos::Version_10_0_0)
|
||||||
GetCount = 21,
|
|
||||||
GetOwnerApplicationId = 22,
|
AMS_SF_DEFINE_INTERFACE(IContentMetaDatabase, AMS_NCM_I_CONTENT_META_DATABASE_INTERFACE_INFO)
|
||||||
};
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result Set(const ContentMetaKey &key, sf::InBuffer value) = 0;
|
|
||||||
virtual Result Get(sf::Out<u64> out_size, const ContentMetaKey &key, sf::OutBuffer out_value) = 0;
|
|
||||||
virtual Result Remove(const ContentMetaKey &key) = 0;
|
|
||||||
virtual Result GetContentIdByType(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type) = 0;
|
|
||||||
virtual Result ListContentInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentInfo> &out_info, const ContentMetaKey &key, s32 offset) = 0;
|
|
||||||
virtual Result List(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaKey> &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type) = 0;
|
|
||||||
virtual Result GetLatestContentMetaKey(sf::Out<ContentMetaKey> out_key, u64 id) = 0;
|
|
||||||
virtual Result ListApplication(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ApplicationContentMetaKey> &out_keys, ContentMetaType meta_type) = 0;
|
|
||||||
virtual Result Has(sf::Out<bool> out, const ContentMetaKey &key) = 0;
|
|
||||||
virtual Result HasAll(sf::Out<bool> out, const sf::InArray<ContentMetaKey> &keys) = 0;
|
|
||||||
virtual Result GetSize(sf::Out<u64> out_size, const ContentMetaKey &key) = 0;
|
|
||||||
virtual Result GetRequiredSystemVersion(sf::Out<u32> out_version, const ContentMetaKey &key) = 0;
|
|
||||||
virtual Result GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) = 0;
|
|
||||||
virtual Result DisableForcibly() = 0;
|
|
||||||
virtual Result LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) = 0;
|
|
||||||
virtual Result Commit() = 0;
|
|
||||||
virtual Result HasContent(sf::Out<bool> out, const ContentMetaKey &key, const ContentId &content_id) = 0;
|
|
||||||
virtual Result ListContentMetaInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaInfo> &out_meta_info, const ContentMetaKey &key, s32 offset) = 0;
|
|
||||||
virtual Result GetAttributes(sf::Out<u8> out_attributes, const ContentMetaKey &key) = 0;
|
|
||||||
virtual Result GetRequiredApplicationVersion(sf::Out<u32> out_version, const ContentMetaKey &key) = 0;
|
|
||||||
virtual Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) = 0;
|
|
||||||
virtual Result GetCount(sf::Out<u32> out_count) = 0;
|
|
||||||
virtual Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(Set),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Get),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Remove),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetContentIdByType),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ListContentInfo),
|
|
||||||
MAKE_SERVICE_COMMAND_META(List),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetLatestContentMetaKey),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ListApplication),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Has),
|
|
||||||
MAKE_SERVICE_COMMAND_META(HasAll),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetSize),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetRequiredSystemVersion),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetPatchId),
|
|
||||||
MAKE_SERVICE_COMMAND_META(DisableForcibly),
|
|
||||||
MAKE_SERVICE_COMMAND_META(LookupOrphanContent),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Commit),
|
|
||||||
MAKE_SERVICE_COMMAND_META(HasContent),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ListContentMetaInfo),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetAttributes),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetRequiredApplicationVersion, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetContentIdByTypeAndIdOffset, hos::Version_5_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetCount, hos::Version_10_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetOwnerApplicationId, hos::Version_10_0_0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,109 +22,38 @@
|
||||||
|
|
||||||
namespace ams::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
class IContentStorage : public sf::IServiceObject {
|
#define AMS_NCM_I_CONTENT_STORAGE_INTERFACE_INFO(C, H) \
|
||||||
NON_COPYABLE(IContentStorage);
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GeneratePlaceHolderId, (sf::Out<PlaceHolderId> out)) \
|
||||||
NON_MOVEABLE(IContentStorage);
|
AMS_SF_METHOD_INFO(C, H, 1, Result, CreatePlaceHolder, (PlaceHolderId placeholder_id, ContentId content_id, s64 size)) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 2, Result, DeletePlaceHolder, (PlaceHolderId placeholder_id)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 3, Result, HasPlaceHolder, (sf::Out<bool> out, PlaceHolderId placeholder_id)) \
|
||||||
GeneratePlaceHolderId = 0,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, WritePlaceHolder, (PlaceHolderId placeholder_id, s64 offset, sf::InBuffer data)) \
|
||||||
CreatePlaceHolder = 1,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, Register, (PlaceHolderId placeholder_id, ContentId content_id)) \
|
||||||
DeletePlaceHolder = 2,
|
AMS_SF_METHOD_INFO(C, H, 6, Result, Delete, (ContentId content_id)) \
|
||||||
HasPlaceHolder = 3,
|
AMS_SF_METHOD_INFO(C, H, 7, Result, Has, (sf::Out<bool> out, ContentId content_id)) \
|
||||||
WritePlaceHolder = 4,
|
AMS_SF_METHOD_INFO(C, H, 8, Result, GetPath, (sf::Out<Path> out, ContentId content_id)) \
|
||||||
Register = 5,
|
AMS_SF_METHOD_INFO(C, H, 9, Result, GetPlaceHolderPath, (sf::Out<Path> out, PlaceHolderId placeholder_id)) \
|
||||||
Delete = 6,
|
AMS_SF_METHOD_INFO(C, H, 10, Result, CleanupAllPlaceHolder, ()) \
|
||||||
Has = 7,
|
AMS_SF_METHOD_INFO(C, H, 11, Result, ListPlaceHolder, (sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf)) \
|
||||||
GetPath = 8,
|
AMS_SF_METHOD_INFO(C, H, 12, Result, GetContentCount, (sf::Out<s32> out_count)) \
|
||||||
GetPlaceHolderPath = 9,
|
AMS_SF_METHOD_INFO(C, H, 13, Result, ListContentId, (sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 start_offset)) \
|
||||||
CleanupAllPlaceHolder = 10,
|
AMS_SF_METHOD_INFO(C, H, 14, Result, GetSizeFromContentId, (sf::Out<s64> out_size, ContentId content_id)) \
|
||||||
ListPlaceHolder = 11,
|
AMS_SF_METHOD_INFO(C, H, 15, Result, DisableForcibly, ()) \
|
||||||
GetContentCount = 12,
|
AMS_SF_METHOD_INFO(C, H, 16, Result, RevertToPlaceHolder, (PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id), hos::Version_2_0_0) \
|
||||||
ListContentId = 13,
|
AMS_SF_METHOD_INFO(C, H, 17, Result, SetPlaceHolderSize, (PlaceHolderId placeholder_id, s64 size), hos::Version_2_0_0) \
|
||||||
GetSizeFromContentId = 14,
|
AMS_SF_METHOD_INFO(C, H, 18, Result, ReadContentIdFile, (sf::OutBuffer buf, ContentId content_id, s64 offset), hos::Version_2_0_0) \
|
||||||
DisableForcibly = 15,
|
AMS_SF_METHOD_INFO(C, H, 19, Result, GetRightsIdFromPlaceHolderIdDeprecated, (sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id), hos::Version_2_0_0, hos::Version_2_3_0) \
|
||||||
RevertToPlaceHolder = 16,
|
AMS_SF_METHOD_INFO(C, H, 19, Result, GetRightsIdFromPlaceHolderId, (sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id), hos::Version_3_0_0) \
|
||||||
SetPlaceHolderSize = 17,
|
AMS_SF_METHOD_INFO(C, H, 20, Result, GetRightsIdFromContentIdDeprecated, (sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id), hos::Version_2_0_0, hos::Version_2_3_0) \
|
||||||
ReadContentIdFile = 18,
|
AMS_SF_METHOD_INFO(C, H, 20, Result, GetRightsIdFromContentId, (sf::Out<ncm::RightsId> out_rights_id, ContentId content_id), hos::Version_3_0_0) \
|
||||||
GetRightsIdFromPlaceHolderIdDeprecated = 19,
|
AMS_SF_METHOD_INFO(C, H, 21, Result, WriteContentForDebug, (ContentId content_id, s64 offset, sf::InBuffer data), hos::Version_2_0_0) \
|
||||||
GetRightsIdFromPlaceHolderId = 19,
|
AMS_SF_METHOD_INFO(C, H, 22, Result, GetFreeSpaceSize, (sf::Out<s64> out_size), hos::Version_2_0_0) \
|
||||||
GetRightsIdFromContentIdDeprecated = 20,
|
AMS_SF_METHOD_INFO(C, H, 23, Result, GetTotalSpaceSize, (sf::Out<s64> out_size), hos::Version_2_0_0) \
|
||||||
GetRightsIdFromContentId = 20,
|
AMS_SF_METHOD_INFO(C, H, 24, Result, FlushPlaceHolder, (), hos::Version_3_0_0) \
|
||||||
WriteContentForDebug = 21,
|
AMS_SF_METHOD_INFO(C, H, 25, Result, GetSizeFromPlaceHolderId, (sf::Out<s64> out, PlaceHolderId placeholder_id), hos::Version_4_0_0) \
|
||||||
GetFreeSpaceSize = 22,
|
AMS_SF_METHOD_INFO(C, H, 26, Result, RepairInvalidFileAttribute, (), hos::Version_4_0_0) \
|
||||||
GetTotalSpaceSize = 23,
|
AMS_SF_METHOD_INFO(C, H, 27, Result, GetRightsIdFromPlaceHolderIdWithCache, (sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id), hos::Version_8_0_0)
|
||||||
FlushPlaceHolder = 24,
|
|
||||||
GetSizeFromPlaceHolderId = 25,
|
AMS_SF_DEFINE_INTERFACE(IContentStorage, AMS_NCM_I_CONTENT_STORAGE_INTERFACE_INFO)
|
||||||
RepairInvalidFileAttribute = 26,
|
|
||||||
GetRightsIdFromPlaceHolderIdWithCache = 27,
|
|
||||||
};
|
|
||||||
public:
|
|
||||||
IContentStorage() { /* ... */ }
|
|
||||||
public:
|
|
||||||
virtual Result GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) = 0;
|
|
||||||
virtual Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) = 0;
|
|
||||||
virtual Result DeletePlaceHolder(PlaceHolderId placeholder_id) = 0;
|
|
||||||
virtual Result HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) = 0;
|
|
||||||
virtual Result WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, sf::InBuffer data) = 0;
|
|
||||||
virtual Result Register(PlaceHolderId placeholder_id, ContentId content_id) = 0;
|
|
||||||
virtual Result Delete(ContentId content_id) = 0;
|
|
||||||
virtual Result Has(sf::Out<bool> out, ContentId content_id) = 0;
|
|
||||||
virtual Result GetPath(sf::Out<Path> out, ContentId content_id) = 0;
|
|
||||||
virtual Result GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) = 0;
|
|
||||||
virtual Result CleanupAllPlaceHolder() = 0;
|
|
||||||
virtual Result ListPlaceHolder(sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf) = 0;
|
|
||||||
virtual Result GetContentCount(sf::Out<s32> out_count) = 0;
|
|
||||||
virtual Result ListContentId(sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 start_offset) = 0;
|
|
||||||
virtual Result GetSizeFromContentId(sf::Out<s64> out_size, ContentId content_id) = 0;
|
|
||||||
virtual Result DisableForcibly() = 0;
|
|
||||||
virtual Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) = 0;
|
|
||||||
virtual Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) = 0;
|
|
||||||
virtual Result ReadContentIdFile(sf::OutBuffer buf, ContentId content_id, s64 offset) = 0;
|
|
||||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) = 0;
|
|
||||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) = 0;
|
|
||||||
virtual Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) = 0;
|
|
||||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) = 0;
|
|
||||||
virtual Result WriteContentForDebug(ContentId content_id, s64 offset, sf::InBuffer data) = 0;
|
|
||||||
virtual Result GetFreeSpaceSize(sf::Out<s64> out_size) = 0;
|
|
||||||
virtual Result GetTotalSpaceSize(sf::Out<s64> out_size) = 0;
|
|
||||||
virtual Result FlushPlaceHolder() = 0;
|
|
||||||
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) = 0;
|
|
||||||
virtual Result RepairInvalidFileAttribute() = 0;
|
|
||||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(GeneratePlaceHolderId),
|
|
||||||
MAKE_SERVICE_COMMAND_META(CreatePlaceHolder),
|
|
||||||
MAKE_SERVICE_COMMAND_META(DeletePlaceHolder),
|
|
||||||
MAKE_SERVICE_COMMAND_META(HasPlaceHolder),
|
|
||||||
MAKE_SERVICE_COMMAND_META(WritePlaceHolder),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Register),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Delete),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Has),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetPath),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetPlaceHolderPath),
|
|
||||||
MAKE_SERVICE_COMMAND_META(CleanupAllPlaceHolder),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ListPlaceHolder),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GeneratePlaceHolderId),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetContentCount),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ListContentId),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetSizeFromContentId),
|
|
||||||
MAKE_SERVICE_COMMAND_META(DisableForcibly),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RevertToPlaceHolder, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(SetPlaceHolderSize, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(ReadContentIdFile, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetRightsIdFromPlaceHolderIdDeprecated, hos::Version_2_0_0, hos::Version_2_3_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetRightsIdFromPlaceHolderId, hos::Version_3_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetRightsIdFromContentIdDeprecated, hos::Version_2_0_0, hos::Version_2_3_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetRightsIdFromContentId, hos::Version_3_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(WriteContentForDebug, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetFreeSpaceSize, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetTotalSpaceSize, hos::Version_2_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(FlushPlaceHolder, hos::Version_3_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetSizeFromPlaceHolderId, hos::Version_4_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(RepairInvalidFileAttribute, hos::Version_4_0_0),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetRightsIdFromPlaceHolderIdWithCache, hos::Version_8_0_0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
19
libraries/libstratosphere/include/stratosphere/ns.hpp
Normal file
19
libraries/libstratosphere/include/stratosphere/ns.hpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stratosphere/ns/impl/ns_i_async.hpp>
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/err/err_error_context.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::ns::impl {
|
||||||
|
|
||||||
|
#define AMS_NS_I_ASYNC_RESULT_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, Get, ()) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, Cancel, ()) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, GetErrorContext, (::ams::sf::Out<::ams::err::ErrorContext> out))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IAsyncResult, AMS_NS_I_ASYNC_RESULT_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -22,21 +22,10 @@
|
||||||
|
|
||||||
namespace ams::pgl::sf {
|
namespace ams::pgl::sf {
|
||||||
|
|
||||||
class IEventObserver : public ams::sf::IServiceObject {
|
#define AMS_PGL_I_EVENT_OBSERVER_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GetProcessEventHandle, (ams::sf::OutCopyHandle out)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, GetProcessEventInfo, (ams::sf::Out<pm::ProcessEventInfo> out))
|
||||||
GetProcessEventHandle = 0,
|
|
||||||
GetProcessEventInfo = 1,
|
AMS_SF_DEFINE_INTERFACE(IEventObserver, AMS_PGL_I_EVENT_OBSERVER_INTERFACE_INFO);
|
||||||
};
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result GetProcessEventHandle(ams::sf::OutCopyHandle out) = 0;
|
|
||||||
virtual Result GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetProcessEventHandle),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetProcessEventInfo),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -23,52 +23,22 @@
|
||||||
|
|
||||||
namespace ams::pgl::sf {
|
namespace ams::pgl::sf {
|
||||||
|
|
||||||
class IShellInterface : public ams::sf::IServiceObject {
|
#define AMS_PGL_I_SHELL_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, LaunchProgram, (ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, TerminateProcess, (os::ProcessId process_id)) \
|
||||||
LaunchProgram = 0,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, LaunchProgramFromHost, (ams::sf::Out<os::ProcessId> out, const ams::sf::InBuffer &content_path, u32 pm_flags)) \
|
||||||
TerminateProcess = 1,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, GetHostContentMetaInfo, (ams::sf::Out<pgl::ContentMetaInfo> out, const ams::sf::InBuffer &content_path)) \
|
||||||
LaunchProgramFromHost = 2,
|
AMS_SF_METHOD_INFO(C, H, 5, Result, GetApplicationProcessId, (ams::sf::Out<os::ProcessId> out)) \
|
||||||
GetHostContentMetaInfo = 4,
|
AMS_SF_METHOD_INFO(C, H, 6, Result, BoostSystemMemoryResourceLimit, (u64 size)) \
|
||||||
GetApplicationProcessId = 5,
|
AMS_SF_METHOD_INFO(C, H, 7, Result, IsProcessTracked, (ams::sf::Out<bool> out, os::ProcessId process_id)) \
|
||||||
BoostSystemMemoryResourceLimit = 6,
|
AMS_SF_METHOD_INFO(C, H, 8, Result, EnableApplicationCrashReport, (bool enabled)) \
|
||||||
IsProcessTracked = 7,
|
AMS_SF_METHOD_INFO(C, H, 9, Result, IsApplicationCrashReportEnabled, (ams::sf::Out<bool> out)) \
|
||||||
EnableApplicationCrashReport = 8,
|
AMS_SF_METHOD_INFO(C, H, 10, Result, EnableApplicationAllThreadDumpOnCrash, (bool enabled)) \
|
||||||
IsApplicationCrashReportEnabled = 9,
|
AMS_SF_METHOD_INFO(C, H, 12, Result, TriggerApplicationSnapShotDumper, (SnapShotDumpType dump_type, const ams::sf::InBuffer &arg)) \
|
||||||
EnableApplicationAllThreadDumpOnCrash = 10,
|
AMS_SF_METHOD_INFO(C, H, 20, Result, GetShellEventObserver, (ams::sf::Out<std::shared_ptr<pgl::sf::IEventObserver>> out))
|
||||||
TriggerApplicationSnapShotDumper = 12,
|
|
||||||
GetShellEventObserver = 20,
|
AMS_SF_DEFINE_INTERFACE(IShellInterface, AMS_PGL_I_SHELL_INTERFACE_INTERFACE_INFO);
|
||||||
};
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result LaunchProgram(ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags) = 0;
|
|
||||||
virtual Result TerminateProcess(os::ProcessId process_id) = 0;
|
|
||||||
virtual Result LaunchProgramFromHost(ams::sf::Out<os::ProcessId> out, const ams::sf::InBuffer &content_path, u32 pm_flags) = 0;
|
|
||||||
virtual Result GetHostContentMetaInfo(ams::sf::Out<pgl::ContentMetaInfo> out, const ams::sf::InBuffer &content_path) = 0;
|
|
||||||
virtual Result GetApplicationProcessId(ams::sf::Out<os::ProcessId> out) = 0;
|
|
||||||
virtual Result BoostSystemMemoryResourceLimit(u64 size) = 0;
|
|
||||||
virtual Result IsProcessTracked(ams::sf::Out<bool> out, os::ProcessId process_id) = 0;
|
|
||||||
virtual Result EnableApplicationCrashReport(bool enabled) = 0;
|
|
||||||
virtual Result IsApplicationCrashReportEnabled(ams::sf::Out<bool> out) = 0;
|
|
||||||
virtual Result EnableApplicationAllThreadDumpOnCrash(bool enabled) = 0;
|
|
||||||
virtual Result TriggerApplicationSnapShotDumper(SnapShotDumpType dump_type, const ams::sf::InBuffer &arg) = 0;
|
|
||||||
|
|
||||||
virtual Result GetShellEventObserver(ams::sf::Out<std::shared_ptr<pgl::sf::IEventObserver>> out) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(LaunchProgram),
|
|
||||||
MAKE_SERVICE_COMMAND_META(TerminateProcess),
|
|
||||||
MAKE_SERVICE_COMMAND_META(LaunchProgramFromHost),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetHostContentMetaInfo),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetApplicationProcessId),
|
|
||||||
MAKE_SERVICE_COMMAND_META(BoostSystemMemoryResourceLimit),
|
|
||||||
MAKE_SERVICE_COMMAND_META(IsProcessTracked),
|
|
||||||
MAKE_SERVICE_COMMAND_META(EnableApplicationCrashReport),
|
|
||||||
MAKE_SERVICE_COMMAND_META(IsApplicationCrashReportEnabled),
|
|
||||||
MAKE_SERVICE_COMMAND_META(EnableApplicationAllThreadDumpOnCrash),
|
|
||||||
MAKE_SERVICE_COMMAND_META(TriggerApplicationSnapShotDumper),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetShellEventObserver),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
namespace ams::pgl::srv {
|
namespace ams::pgl::srv {
|
||||||
|
|
||||||
class ShellInterface final : public pgl::sf::IShellInterface {
|
class ShellInterface final {
|
||||||
NON_COPYABLE(ShellInterface);
|
NON_COPYABLE(ShellInterface);
|
||||||
NON_MOVEABLE(ShellInterface);
|
NON_MOVEABLE(ShellInterface);
|
||||||
private:
|
private:
|
||||||
|
@ -34,19 +34,20 @@ namespace ams::pgl::srv {
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
/* Interface commands. */
|
/* Interface commands. */
|
||||||
virtual Result LaunchProgram(ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags) override final;
|
Result LaunchProgram(ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags);
|
||||||
virtual Result TerminateProcess(os::ProcessId process_id) override final;
|
Result TerminateProcess(os::ProcessId process_id);
|
||||||
virtual Result LaunchProgramFromHost(ams::sf::Out<os::ProcessId> out, const ams::sf::InBuffer &content_path, u32 pm_flags) override final;
|
Result LaunchProgramFromHost(ams::sf::Out<os::ProcessId> out, const ams::sf::InBuffer &content_path, u32 pm_flags);
|
||||||
virtual Result GetHostContentMetaInfo(ams::sf::Out<pgl::ContentMetaInfo> out, const ams::sf::InBuffer &content_path) override final;
|
Result GetHostContentMetaInfo(ams::sf::Out<pgl::ContentMetaInfo> out, const ams::sf::InBuffer &content_path);
|
||||||
virtual Result GetApplicationProcessId(ams::sf::Out<os::ProcessId> out) override final;
|
Result GetApplicationProcessId(ams::sf::Out<os::ProcessId> out);
|
||||||
virtual Result BoostSystemMemoryResourceLimit(u64 size) override final;
|
Result BoostSystemMemoryResourceLimit(u64 size);
|
||||||
virtual Result IsProcessTracked(ams::sf::Out<bool> out, os::ProcessId process_id) override final;
|
Result IsProcessTracked(ams::sf::Out<bool> out, os::ProcessId process_id);
|
||||||
virtual Result EnableApplicationCrashReport(bool enabled) override final;
|
Result EnableApplicationCrashReport(bool enabled);
|
||||||
virtual Result IsApplicationCrashReportEnabled(ams::sf::Out<bool> out) override final;
|
Result IsApplicationCrashReportEnabled(ams::sf::Out<bool> out);
|
||||||
virtual Result EnableApplicationAllThreadDumpOnCrash(bool enabled) override final;
|
Result EnableApplicationAllThreadDumpOnCrash(bool enabled);
|
||||||
virtual Result TriggerApplicationSnapShotDumper(SnapShotDumpType dump_type, const ams::sf::InBuffer &arg) override final;
|
Result TriggerApplicationSnapShotDumper(SnapShotDumpType dump_type, const ams::sf::InBuffer &arg);
|
||||||
|
|
||||||
virtual Result GetShellEventObserver(ams::sf::Out<std::shared_ptr<pgl::sf::IEventObserver>> out) override final;
|
Result GetShellEventObserver(ams::sf::Out<std::shared_ptr<pgl::sf::IEventObserver>> out);
|
||||||
};
|
};
|
||||||
|
static_assert(pgl::sf::IsIShellInterface<ShellInterface>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "pm/pm_types.hpp"
|
#include <stratosphere/pm/pm_types.hpp>
|
||||||
#include "pm/pm_boot_mode_api.hpp"
|
#include <stratosphere/pm/pm_boot_mode_api.hpp>
|
||||||
#include "pm/pm_info_api.hpp"
|
#include <stratosphere/pm/pm_info_api.hpp>
|
||||||
#include "pm/pm_shell_api.hpp"
|
#include <stratosphere/pm/pm_shell_api.hpp>
|
||||||
#include "pm/pm_dmnt_api.hpp"
|
#include <stratosphere/pm/pm_dmnt_api.hpp>
|
||||||
|
#include <stratosphere/pm/impl/pm_boot_mode_interface.hpp>
|
||||||
|
#include <stratosphere/pm/impl/pm_debug_monitor_interface.hpp>
|
||||||
|
#include <stratosphere/pm/impl/pm_information_interface.hpp>
|
||||||
|
#include <stratosphere/pm/impl/pm_shell_interface.hpp>
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/pm/pm_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::pm::impl {
|
||||||
|
|
||||||
|
#define AMS_PM_I_BOOT_MODE_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, void, GetBootMode, (sf::Out<u32> out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, void, SetMaintenanceBoot, ())
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IBootModeInterface, AMS_PM_I_BOOT_MODE_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/pm/pm_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::pm::impl {
|
||||||
|
|
||||||
|
#define AMS_PM_I_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GetExceptionProcessIdList, (sf::Out<u32> out_count, const sf::OutArray<os::ProcessId> &out_process_ids)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, StartProcess, (os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, GetProcessId, (sf::Out<os::ProcessId> out, ncm::ProgramId program_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, Result, HookToCreateProcess, (sf::OutCopyHandle out_hook, ncm::ProgramId program_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, Result, GetApplicationProcessId, (sf::Out<os::ProcessId> out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 5, Result, HookToCreateApplicationProcess, (sf::OutCopyHandle out_hook)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 6, Result, ClearHook, (u32 which), hos::Version_6_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65000, Result, AtmosphereGetProcessInfo, (sf::OutCopyHandle out_process_handle, sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status, os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65001, Result, AtmosphereGetCurrentLimitInfo, (sf::Out<s64> out_cur_val, sf::Out<s64> out_lim_val, u32 group, u32 resource))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IDebugMonitorInterface, AMS_PM_I_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
#define AMS_PM_I_DEPRECATED_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GetModuleIdList, (sf::Out<u32> out_count, const sf::OutBuffer &out_buf, u64 unused)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, GetExceptionProcessIdList, (sf::Out<u32> out_count, const sf::OutArray<os::ProcessId> &out_process_ids)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, StartProcess, (os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, Result, GetProcessId, (sf::Out<os::ProcessId> out, ncm::ProgramId program_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, Result, HookToCreateProcess, (sf::OutCopyHandle out_hook, ncm::ProgramId program_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 5, Result, GetApplicationProcessId, (sf::Out<os::ProcessId> out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 6, Result, HookToCreateApplicationProcess, (sf::OutCopyHandle out_hook)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65000, Result, AtmosphereGetProcessInfo, (sf::OutCopyHandle out_process_handle, sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status, os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65001, Result, AtmosphereGetCurrentLimitInfo, (sf::Out<s64> out_cur_val, sf::Out<s64> out_lim_val, u32 group, u32 resource))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IDeprecatedDebugMonitorInterface, AMS_PM_I_DEPRECATED_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/pm/pm_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::pm::impl {
|
||||||
|
|
||||||
|
#define AMS_PM_I_INFORMATION_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GetProgramId, (sf::Out<ncm::ProgramId> out, os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65000, Result, AtmosphereGetProcessId, (sf::Out<os::ProcessId> out, ncm::ProgramId program_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65001, Result, AtmosphereHasLaunchedProgram, (sf::Out<bool> out, ncm::ProgramId program_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65002, Result, AtmosphereGetProcessInfo, (sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status, os::ProcessId process_id))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IInformationInterface, AMS_PM_I_INFORMATION_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/pm/pm_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::pm::impl {
|
||||||
|
|
||||||
|
#define AMS_PM_I_SHELL_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, LaunchProgram, (sf::Out<os::ProcessId> out_process_id, const ncm::ProgramLocation &loc, u32 flags)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, TerminateProcess, (os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, TerminateProgram, (ncm::ProgramId program_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, void, GetProcessEventHandle, (sf::OutCopyHandle out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, void, GetProcessEventInfo, (sf::Out<ProcessEventInfo> out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 5, void, NotifyBootFinished, ()) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 6, Result, GetApplicationProcessIdForShell, (sf::Out<os::ProcessId> out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 7, Result, BoostSystemMemoryResourceLimit, (u64 boost_size)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 8, Result, BoostApplicationThreadResourceLimit, (), hos::Version_7_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 9, void, GetBootFinishedEventHandle, (sf::OutCopyHandle out), hos::Version_8_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IShellInterface, AMS_PM_I_SHELL_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
#define AMS_PM_I_DEPRECATED_SHELL_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, LaunchProgram, (sf::Out<os::ProcessId> out_process_id, const ncm::ProgramLocation &loc, u32 flags)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, TerminateProcess, (os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, TerminateProgram, (ncm::ProgramId program_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, void, GetProcessEventHandle, (sf::OutCopyHandle out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, void, GetProcessEventInfo, (sf::Out<ProcessEventInfo> out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 5, Result, CleanupProcess, (os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 6, Result, ClearExceptionOccurred, (os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 7, void, NotifyBootFinished, ()) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 8, Result, GetApplicationProcessIdForShell, (sf::Out<os::ProcessId> out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 9, Result, BoostSystemMemoryResourceLimit, (u64 boost_size), hos::Version_4_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IDeprecatedShellInterface, AMS_PM_I_DEPRECATED_SHELL_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -21,30 +21,13 @@
|
||||||
|
|
||||||
namespace ams::psc::sf {
|
namespace ams::psc::sf {
|
||||||
|
|
||||||
class IPmModule : public ams::sf::IServiceObject {
|
#define AMS_PSC_I_PM_MODULE_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, Initialize, (ams::sf::OutCopyHandle out, psc::PmModuleId module_id, const ams::sf::InBuffer &child_list)) \
|
||||||
enum class CommandId {
|
AMS_SF_METHOD_INFO(C, H, 1, Result, GetRequest, (ams::sf::Out<PmState> out_state, ams::sf::Out<PmFlagSet> out_flags)) \
|
||||||
Initialize = 0,
|
AMS_SF_METHOD_INFO(C, H, 2, Result, Acknowledge, ()) \
|
||||||
GetRequest = 1,
|
AMS_SF_METHOD_INFO(C, H, 3, Result, Finalize, ()) \
|
||||||
Acknowledge = 2,
|
AMS_SF_METHOD_INFO(C, H, 4, Result, AcknowledgeEx, (PmState state), hos::Version_5_1_0)
|
||||||
Finalize = 3,
|
|
||||||
AcknowledgeEx = 4,
|
AMS_SF_DEFINE_INTERFACE(IPmModule, AMS_PSC_I_PM_MODULE_INTERFACE_INFO)
|
||||||
};
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result Initialize(ams::sf::OutCopyHandle out, psc::PmModuleId module_id, const ams::sf::InBuffer &child_list) = 0;
|
|
||||||
virtual Result GetRequest(ams::sf::Out<PmState> out_state, ams::sf::Out<PmFlagSet> out_flags) = 0;
|
|
||||||
virtual Result Acknowledge() = 0;
|
|
||||||
virtual Result Finalize() = 0;
|
|
||||||
virtual Result AcknowledgeEx(PmState state) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(Initialize),
|
|
||||||
MAKE_SERVICE_COMMAND_META(GetRequest),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Acknowledge),
|
|
||||||
MAKE_SERVICE_COMMAND_META(Finalize),
|
|
||||||
MAKE_SERVICE_COMMAND_META(AcknowledgeEx, hos::Version_5_1_0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -20,18 +20,9 @@
|
||||||
|
|
||||||
namespace ams::psc::sf {
|
namespace ams::psc::sf {
|
||||||
|
|
||||||
class IPmService : public ams::sf::IServiceObject {
|
#define AMS_PSC_I_PM_SERVICE_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 0, Result, Initialize, (ams::sf::Out<std::shared_ptr<psc::sf::IPmModule>> out))
|
||||||
enum class CommandId {
|
|
||||||
Initialize = 0,
|
AMS_SF_DEFINE_INTERFACE(IPmService, AMS_PSC_I_PM_SERVICE_INTERFACE_INFO)
|
||||||
};
|
|
||||||
public:
|
|
||||||
/* Actual commands. */
|
|
||||||
virtual Result Initialize(ams::sf::Out<std::shared_ptr<psc::sf::IPmModule>> out) = 0;
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(Initialize),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,4 +16,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ro/ro_types.hpp"
|
#include <stratosphere/ro/ro_types.hpp>
|
||||||
|
#include <stratosphere/ro/impl/ro_ro_interface.hpp>
|
||||||
|
#include <stratosphere/ro/impl/ro_debug_monitor_interface.hpp>
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/ro/ro_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::ro::impl {
|
||||||
|
|
||||||
|
#define AMS_RO_I_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GetProcessModuleInfo, (sf::Out<u32> out_count, const sf::OutArray<LoaderModuleInfo> &out_infos, os::ProcessId process_id))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IDebugMonitorInterface, AMS_RO_I_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/ro/ro_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::ro::impl {
|
||||||
|
|
||||||
|
#define AMS_RO_I_RO_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, MapManualLoadModuleMemory, (sf::Out<u64> out_load_address, const sf::ClientProcessId &client_pid, u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, UnmapManualLoadModuleMemory, (const sf::ClientProcessId &client_pid, u64 nro_address)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, RegisterModuleInfo, (const sf::ClientProcessId &client_pid, u64 nrr_address, u64 nrr_size)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, Result, UnregisterModuleInfo, (const sf::ClientProcessId &client_pid, u64 nrr_address)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, Result, RegisterProcessHandle, (const sf::ClientProcessId &client_pid, sf::CopyHandle process_h)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 10, Result, RegisterModuleInfoEx, (const sf::ClientProcessId &client_pid, u64 nrr_address, u64 nrr_size, sf::CopyHandle process_h), hos::Version_7_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IRoInterface, AMS_RO_I_RO_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -28,6 +28,7 @@
|
||||||
#include <stratosphere/sf/sf_out.hpp>
|
#include <stratosphere/sf/sf_out.hpp>
|
||||||
#include <stratosphere/sf/sf_buffers.hpp>
|
#include <stratosphere/sf/sf_buffers.hpp>
|
||||||
#include <stratosphere/sf/impl/sf_impl_command_serialization.hpp>
|
#include <stratosphere/sf/impl/sf_impl_command_serialization.hpp>
|
||||||
|
#include <stratosphere/sf/impl/sf_impl_service_object_macros.hpp>
|
||||||
|
|
||||||
#include <stratosphere/sf/hipc/sf_hipc_server_manager.hpp>
|
#include <stratosphere/sf/hipc/sf_hipc_server_manager.hpp>
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace ams::sf::cmif {
|
||||||
explicit constexpr ServiceDispatchTable(Entries... entries) : impl::ServiceDispatchTableImpl<sizeof...(Entries)>(entries...) { /* ... */ }
|
explicit constexpr ServiceDispatchTable(Entries... entries) : impl::ServiceDispatchTableImpl<sizeof...(Entries)>(entries...) { /* ... */ }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFINE_SERVICE_DISPATCH_TABLE \
|
#define AMS_SF_CMIF_IMPL_DEFINE_SERVICE_DISPATCH_TABLE \
|
||||||
template<typename ServiceImpl> \
|
template<typename ServiceImpl> \
|
||||||
static constexpr inline ::ams::sf::cmif::ServiceDispatchTable s_CmifServiceDispatchTable
|
static constexpr inline ::ams::sf::cmif::ServiceDispatchTable s_CmifServiceDispatchTable
|
||||||
|
|
||||||
|
@ -127,23 +127,21 @@ namespace ams::sf::cmif {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T> requires sf::IsServiceObject<T>
|
||||||
struct ServiceDispatchTraits {
|
struct ServiceDispatchTraits {
|
||||||
static_assert(std::is_base_of<sf::IServiceObject, T>::value, "ServiceObjects must derive from sf::IServiceObject");
|
|
||||||
|
|
||||||
using ProcessHandlerType = decltype(ServiceDispatchMeta::ProcessHandler);
|
using ProcessHandlerType = decltype(ServiceDispatchMeta::ProcessHandler);
|
||||||
|
|
||||||
static constexpr inline auto DispatchTable = T::template s_CmifServiceDispatchTable<T>;
|
static constexpr inline auto DispatchTable = T::template s_CmifServiceDispatchTable<T>;
|
||||||
using DispatchTableType = decltype(DispatchTable);
|
using DispatchTableType = decltype(DispatchTable);
|
||||||
|
|
||||||
static constexpr ProcessHandlerType ProcessHandlerImpl = ServiceObjectTraits<T>::IsMitmServiceObject ? (&impl::ServiceDispatchTableBase::ProcessMessageForMitm<DispatchTableType>)
|
static constexpr ProcessHandlerType ProcessHandlerImpl = sf::IsMitmServiceObject<T> ? (&impl::ServiceDispatchTableBase::ProcessMessageForMitm<DispatchTableType>)
|
||||||
: (&impl::ServiceDispatchTableBase::ProcessMessage<DispatchTableType>);
|
: (&impl::ServiceDispatchTableBase::ProcessMessage<DispatchTableType>);
|
||||||
|
|
||||||
static constexpr inline ServiceDispatchMeta Meta{&DispatchTable, ProcessHandlerImpl};
|
static constexpr inline ServiceDispatchMeta Meta{&DispatchTable, ProcessHandlerImpl};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
NX_CONSTEXPR const ServiceDispatchMeta *GetServiceDispatchMeta() {
|
constexpr ALWAYS_INLINE const ServiceDispatchMeta *GetServiceDispatchMeta() {
|
||||||
return &ServiceDispatchTraits<T>::Meta;
|
return &ServiceDispatchTraits<T>::Meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,12 +69,12 @@ namespace ams::sf::hipc {
|
||||||
virtual void CreateSessionObjectHolder(cmif::ServiceObjectHolder *out_obj, std::shared_ptr<::Service> *out_fsrv) const = 0;
|
virtual void CreateSessionObjectHolder(cmif::ServiceObjectHolder *out_obj, std::shared_ptr<::Service> *out_fsrv) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename ServiceImpl, auto MakeShared = std::make_shared<ServiceImpl>>
|
template<typename Interface, auto MakeShared>
|
||||||
class Server : public ServerBase {
|
class Server : public ServerBase {
|
||||||
NON_COPYABLE(Server);
|
NON_COPYABLE(Server);
|
||||||
NON_MOVEABLE(Server);
|
NON_MOVEABLE(Server);
|
||||||
private:
|
private:
|
||||||
static constexpr bool IsMitmServer = ServiceObjectTraits<ServiceImpl>::IsMitmServiceObject;
|
static constexpr bool IsMitmServer = sf::IsMitmServiceObject<Interface>;
|
||||||
public:
|
public:
|
||||||
Server(Handle ph, sm::ServiceName sn, bool m, cmif::ServiceObjectHolder &&sh) : ServerBase(ph, sn, m, std::forward<cmif::ServiceObjectHolder>(sh)) {
|
Server(Handle ph, sm::ServiceName sn, bool m, cmif::ServiceObjectHolder &&sh) : ServerBase(ph, sn, m, std::forward<cmif::ServiceObjectHolder>(sh)) {
|
||||||
/* ... */
|
/* ... */
|
||||||
|
@ -145,14 +145,14 @@ namespace ams::sf::hipc {
|
||||||
|
|
||||||
void ProcessDeferredSessions();
|
void ProcessDeferredSessions();
|
||||||
|
|
||||||
template<typename ServiceImpl, auto MakeShared = std::make_shared<ServiceImpl>>
|
template<typename Interface, auto MakeShared>
|
||||||
void RegisterServerImpl(Handle port_handle, sm::ServiceName service_name, bool managed, cmif::ServiceObjectHolder &&static_holder) {
|
void RegisterServerImpl(Handle port_handle, sm::ServiceName service_name, bool managed, cmif::ServiceObjectHolder &&static_holder) {
|
||||||
/* Allocate server memory. */
|
/* Allocate server memory. */
|
||||||
auto *server = this->AllocateServer();
|
auto *server = this->AllocateServer();
|
||||||
AMS_ABORT_UNLESS(server != nullptr);
|
AMS_ABORT_UNLESS(server != nullptr);
|
||||||
new (server) Server<ServiceImpl, MakeShared>(port_handle, service_name, managed, std::forward<cmif::ServiceObjectHolder>(static_holder));
|
new (server) Server<Interface, MakeShared>(port_handle, service_name, managed, std::forward<cmif::ServiceObjectHolder>(static_holder));
|
||||||
|
|
||||||
if constexpr (!ServiceObjectTraits<ServiceImpl>::IsMitmServiceObject) {
|
if constexpr (!sf::IsMitmServiceObject<Interface>) {
|
||||||
/* Non-mitm server. */
|
/* Non-mitm server. */
|
||||||
os::SetWaitableHolderUserData(server, static_cast<uintptr_t>(UserDataTag::Server));
|
os::SetWaitableHolderUserData(server, static_cast<uintptr_t>(UserDataTag::Server));
|
||||||
} else {
|
} else {
|
||||||
|
@ -163,9 +163,9 @@ namespace ams::sf::hipc {
|
||||||
os::LinkWaitableHolder(std::addressof(this->waitable_manager), server);
|
os::LinkWaitableHolder(std::addressof(this->waitable_manager), server);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ServiceImpl>
|
template<typename Interface, typename ServiceImpl>
|
||||||
static constexpr inline std::shared_ptr<ServiceImpl> MakeSharedMitm(std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &client_info) {
|
static constexpr inline std::shared_ptr<Interface> MakeSharedMitm(std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &client_info) {
|
||||||
return std::make_shared<ServiceImpl>(std::forward<std::shared_ptr<::Service>>(s), client_info);
|
return sf::MakeShared<Interface, ServiceImpl>(std::forward<std::shared_ptr<::Service>>(s), client_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result InstallMitmServerImpl(Handle *out_port_handle, sm::ServiceName service_name, MitmQueryFunction query_func);
|
Result InstallMitmServerImpl(Handle *out_port_handle, sm::ServiceName service_name, MitmQueryFunction query_func);
|
||||||
|
@ -187,21 +187,18 @@ namespace ams::sf::hipc {
|
||||||
os::InitializeWaitableManager(std::addressof(this->waitlist));
|
os::InitializeWaitableManager(std::addressof(this->waitlist));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ServiceImpl, auto MakeShared = std::make_shared<ServiceImpl>>
|
template<typename Interface, typename ServiceImpl, auto MakeShared = sf::MakeShared<Interface, ServiceImpl>> requires (sf::IsServiceObject<Interface> && !sf::IsMitmServiceObject<Interface>)
|
||||||
void RegisterServer(Handle port_handle, std::shared_ptr<ServiceImpl> static_object = nullptr) {
|
void RegisterServer(Handle port_handle, std::shared_ptr<Interface> static_object = nullptr) {
|
||||||
static_assert(!ServiceObjectTraits<ServiceImpl>::IsMitmServiceObject, "RegisterServer requires non-mitm object. Use RegisterMitmServer instead.");
|
|
||||||
/* Register server. */
|
/* Register server. */
|
||||||
cmif::ServiceObjectHolder static_holder;
|
cmif::ServiceObjectHolder static_holder;
|
||||||
if (static_object != nullptr) {
|
if (static_object != nullptr) {
|
||||||
static_holder = cmif::ServiceObjectHolder(std::move(static_object));
|
static_holder = cmif::ServiceObjectHolder(std::move(static_object));
|
||||||
}
|
}
|
||||||
this->RegisterServerImpl<ServiceImpl, MakeShared>(port_handle, sm::InvalidServiceName, false, std::move(static_holder));
|
this->RegisterServerImpl<Interface, MakeShared>(port_handle, sm::InvalidServiceName, false, std::move(static_holder));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ServiceImpl, auto MakeShared = std::make_shared<ServiceImpl>>
|
template<typename Interface, typename ServiceImpl, auto MakeShared = sf::MakeShared<Interface, ServiceImpl>> requires (sf::IsServiceObject<Interface> && !sf::IsMitmServiceObject<Interface>)
|
||||||
Result RegisterServer(sm::ServiceName service_name, size_t max_sessions, std::shared_ptr<ServiceImpl> static_object = nullptr) {
|
Result RegisterServer(sm::ServiceName service_name, size_t max_sessions, std::shared_ptr<Interface> static_object = nullptr) {
|
||||||
static_assert(!ServiceObjectTraits<ServiceImpl>::IsMitmServiceObject, "RegisterServer requires non-mitm object. Use RegisterMitmServer instead.");
|
|
||||||
|
|
||||||
/* Register service. */
|
/* Register service. */
|
||||||
Handle port_handle;
|
Handle port_handle;
|
||||||
R_TRY(sm::RegisterService(&port_handle, service_name, max_sessions, false));
|
R_TRY(sm::RegisterService(&port_handle, service_name, max_sessions, false));
|
||||||
|
@ -211,19 +208,18 @@ namespace ams::sf::hipc {
|
||||||
if (static_object != nullptr) {
|
if (static_object != nullptr) {
|
||||||
static_holder = cmif::ServiceObjectHolder(std::move(static_object));
|
static_holder = cmif::ServiceObjectHolder(std::move(static_object));
|
||||||
}
|
}
|
||||||
this->RegisterServerImpl<ServiceImpl, MakeShared>(port_handle, service_name, true, std::move(static_holder));
|
this->RegisterServerImpl<Interface, MakeShared>(port_handle, service_name, true, std::move(static_holder));
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ServiceImpl, auto MakeShared = MakeSharedMitm<ServiceImpl>>
|
template<typename Interface, typename ServiceImpl, auto MakeShared = MakeSharedMitm<Interface, ServiceImpl>>
|
||||||
|
requires (sf::IsMitmServiceObject<Interface> && sf::IsMitmServiceImpl<ServiceImpl>)
|
||||||
Result RegisterMitmServer(sm::ServiceName service_name) {
|
Result RegisterMitmServer(sm::ServiceName service_name) {
|
||||||
static_assert(ServiceObjectTraits<ServiceImpl>::IsMitmServiceObject, "RegisterMitmServer requires mitm object. Use RegisterServer instead.");
|
|
||||||
|
|
||||||
/* Install mitm service. */
|
/* Install mitm service. */
|
||||||
Handle port_handle;
|
Handle port_handle;
|
||||||
R_TRY(this->InstallMitmServerImpl(&port_handle, service_name, &ServiceImpl::ShouldMitm));
|
R_TRY(this->InstallMitmServerImpl(&port_handle, service_name, &ServiceImpl::ShouldMitm));
|
||||||
|
|
||||||
this->RegisterServerImpl<ServiceImpl, MakeShared>(port_handle, service_name, true, cmif::ServiceObjectHolder());
|
this->RegisterServerImpl<Interface, MakeShared>(port_handle, service_name, true, cmif::ServiceObjectHolder());
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,22 +368,13 @@ namespace ams::sf::impl {
|
||||||
size_t out_object_index;
|
size_t out_object_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<auto MemberFunction>
|
template<auto MemberFunction, typename Return, typename Class, typename... Arguments>
|
||||||
struct CommandMetaInfo {
|
struct CommandMetaInfo {
|
||||||
private:
|
|
||||||
template<typename R, typename C, typename... A>
|
|
||||||
static R GetReturnTypeImpl(R(C::*)(A...));
|
|
||||||
|
|
||||||
template<typename R, typename C, typename... A>
|
|
||||||
static C *GetClassTypePointerImpl(R(C::*)(A...));
|
|
||||||
|
|
||||||
template<typename R, typename C, typename... A>
|
|
||||||
static std::tuple<typename std::decay<A>::type...> GetArgsImpl(R(C::*)(A...));
|
|
||||||
public:
|
public:
|
||||||
using ReturnType = decltype(GetReturnTypeImpl(MemberFunction));
|
using ReturnType = Return;
|
||||||
using ClassTypePointer = decltype(GetClassTypePointerImpl(MemberFunction));
|
using ClassType = Class;
|
||||||
using ArgsType = decltype(GetArgsImpl(MemberFunction));
|
using ClassTypePointer = ClassType *;
|
||||||
using ClassType = typename std::remove_pointer<ClassTypePointer>::type;
|
using ArgsType = std::tuple<typename std::decay<Arguments>::type...>;
|
||||||
|
|
||||||
static constexpr bool ReturnsResult = std::is_same<ReturnType, Result>::value;
|
static constexpr bool ReturnsResult = std::is_same<ReturnType, Result>::value;
|
||||||
static constexpr bool ReturnsVoid = std::is_same<ReturnType, void>::value;
|
static constexpr bool ReturnsVoid = std::is_same<ReturnType, void>::value;
|
||||||
|
@ -1045,9 +1036,9 @@ namespace ams::sf::impl {
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<auto ServiceCommandImpl>
|
template<auto ServiceCommandImpl, typename Return, typename ClassType, typename... Arguments>
|
||||||
constexpr Result InvokeServiceCommandImpl(CmifOutHeader **out_header_ptr, cmif::ServiceDispatchContext &ctx, const cmif::PointerAndSize &in_raw_data) {
|
constexpr Result InvokeServiceCommandImpl(CmifOutHeader **out_header_ptr, cmif::ServiceDispatchContext &ctx, const cmif::PointerAndSize &in_raw_data) {
|
||||||
using CommandMeta = CommandMetaInfo<ServiceCommandImpl>;
|
using CommandMeta = CommandMetaInfo<ServiceCommandImpl, Return, ClassType, Arguments...>;
|
||||||
using ImplProcessorType = HipcCommandProcessor<CommandMeta>;
|
using ImplProcessorType = HipcCommandProcessor<CommandMeta>;
|
||||||
using BufferArrayType = std::array<cmif::PointerAndSize, CommandMeta::NumBuffers>;
|
using BufferArrayType = std::array<cmif::PointerAndSize, CommandMeta::NumBuffers>;
|
||||||
using OutHandleHolderType = OutHandleHolder<CommandMeta::NumOutMoveHandles, CommandMeta::NumOutCopyHandles>;
|
using OutHandleHolderType = OutHandleHolder<CommandMeta::NumOutMoveHandles, CommandMeta::NumOutCopyHandles>;
|
||||||
|
@ -1113,7 +1104,7 @@ namespace ams::sf::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
if constexpr (CommandMeta::ReturnsResult) {
|
if constexpr (CommandMeta::ReturnsResult) {
|
||||||
const auto command_result = std::apply([=](auto&&... args) { return (this_ptr->*ServiceCommandImpl)(args...); }, args_tuple);
|
const auto command_result = std::apply([=](auto&&... args) { return (this_ptr->*ServiceCommandImpl)(std::forward<Arguments>(args)...); }, args_tuple);
|
||||||
if (R_FAILED(command_result)) {
|
if (R_FAILED(command_result)) {
|
||||||
cmif::PointerAndSize out_raw_data;
|
cmif::PointerAndSize out_raw_data;
|
||||||
ctx.processor->PrepareForErrorReply(ctx, out_raw_data, runtime_metadata);
|
ctx.processor->PrepareForErrorReply(ctx, out_raw_data, runtime_metadata);
|
||||||
|
@ -1121,7 +1112,7 @@ namespace ams::sf::impl {
|
||||||
return command_result;
|
return command_result;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::apply([=](auto&&... args) { (this_ptr->*ServiceCommandImpl)(args...); }, args_tuple);
|
std::apply([=](auto&&... args) { (this_ptr->*ServiceCommandImpl)(std::forward<Arguments>(args)...); }, args_tuple);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1148,18 +1139,16 @@ namespace ams::sf::impl {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ams::sf {
|
namespace ams::sf::impl {
|
||||||
|
|
||||||
template <auto CommandId, auto CommandImpl, hos::Version Low = hos::Version_Min, hos::Version High = hos::Version_Max>
|
template<hos::Version Low, hos::Version High, u32 CommandId, auto CommandImpl, typename Return, typename ClassType, typename... Arguments>
|
||||||
inline static constexpr cmif::ServiceCommandMeta MakeServiceCommandMeta() {
|
consteval inline cmif::ServiceCommandMeta MakeServiceCommandMeta() {
|
||||||
return {
|
return {
|
||||||
.hosver_low = Low,
|
.hosver_low = Low,
|
||||||
.hosver_high = High,
|
.hosver_high = High,
|
||||||
.cmd_id = static_cast<u32>(CommandId),
|
.cmd_id = static_cast<u32>(CommandId),
|
||||||
.handler = ::ams::sf::impl::InvokeServiceCommandImpl<CommandImpl>,
|
.handler = ::ams::sf::impl::InvokeServiceCommandImpl<CommandImpl, Return, ClassType, Arguments...>,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAKE_SERVICE_COMMAND_META(Name, ...) ::ams::sf::MakeServiceCommandMeta<ServiceImpl::CommandId::Name, &ServiceImpl::Name, ##__VA_ARGS__>()
|
|
||||||
|
|
|
@ -0,0 +1,293 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
|
||||||
|
namespace ams::sf::impl {
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
concept ServiceCommandResult = std::same_as<::ams::Result, T> || std::same_as<void, T>;
|
||||||
|
|
||||||
|
template<auto F, typename ...Arguments>
|
||||||
|
concept Invokable = requires (Arguments &&... args) {
|
||||||
|
{ F(std::forward<Arguments>(args)...) };
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FunctionTraits {
|
||||||
|
public:
|
||||||
|
template<typename R, typename... A>
|
||||||
|
static std::tuple<A...> GetArgsImpl(R(A...));
|
||||||
|
};
|
||||||
|
|
||||||
|
template<auto F>
|
||||||
|
using FunctionArgsType = decltype(FunctionTraits::GetArgsImpl(F));
|
||||||
|
|
||||||
|
template<typename Class, typename Return, typename ArgsTuple>
|
||||||
|
struct ClassFunctionPointerHelper;
|
||||||
|
|
||||||
|
template<typename Class, typename Return, typename... Arguments>
|
||||||
|
struct ClassFunctionPointerHelper<Class, Return, std::tuple<Arguments...>> {
|
||||||
|
using Type = Return (*)(Class *, Arguments &&...);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Class, typename Return, typename ArgsTuple>
|
||||||
|
using ClassFunctionPointer = typename ClassFunctionPointerHelper<Class, Return, ArgsTuple>::Type;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct TypeTag{};
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_HELPER_FUNCTION_NAME_IMPL(CLASSNAME, FUNCNAME, SUFFIX) \
|
||||||
|
__ams_sf_impl_helper_##CLASSNAME##_##FUNCNAME##_##SUFFIX
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_HELPER_FUNCTION_NAME(CLASSNAME, FUNCNAME) \
|
||||||
|
AMS_SF_IMPL_HELPER_FUNCTION_NAME_IMPL(CLASSNAME, FUNCNAME, intf)
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, FUNCNAME) \
|
||||||
|
::ams::sf::impl::FunctionArgsType<AMS_SF_IMPL_HELPER_FUNCTION_NAME(CLASSNAME, FUNCNAME)>
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_CONCEPT_HELPER_FUNCTION_NAME(CLASSNAME, FUNCNAME) \
|
||||||
|
AMS_SF_IMPL_HELPER_FUNCTION_NAME_IMPL(CLASSNAME, FUNCNAME, intf_for_concept)
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DECLARE_HELPER_FUNCTIONS(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
static void AMS_SF_IMPL_HELPER_FUNCTION_NAME(CLASSNAME, NAME) ARGS { __builtin_unreachable(); } \
|
||||||
|
template<typename T, typename... Arguments> \
|
||||||
|
requires std::same_as<std::tuple<Arguments...>, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> \
|
||||||
|
static auto AMS_SF_IMPL_CONCEPT_HELPER_FUNCTION_NAME(CLASSNAME, NAME) (T &t, std::tuple<Arguments...> a) { \
|
||||||
|
return [&]<size_t... Ix>(std::index_sequence<Ix...>) { \
|
||||||
|
return t.NAME(std::forward<typename std::tuple_element<Ix, decltype(a)>::type>(std::get<Ix>(a))...); \
|
||||||
|
}(std::make_index_sequence<sizeof...(Arguments)>()); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DECLARE_HELPERS(CLASSNAME, CMD_MACRO) \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DECLARE_HELPER_FUNCTIONS)
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DECLARE_CONCEPT_REQUIREMENT(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
{ AMS_SF_IMPL_CONCEPT_HELPER_FUNCTION_NAME(CLASSNAME, NAME) (impl, std::declval<AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)>()) } -> ::ams::sf::impl::ServiceCommandResult;
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DEFINE_CONCEPT(CLASSNAME, CMD_MACRO) \
|
||||||
|
template<typename Impl> \
|
||||||
|
concept Is##CLASSNAME = requires (Impl &impl) { \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DECLARE_CONCEPT_REQUIREMENT) \
|
||||||
|
};
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_FUNCTION_POINTER_TYPE(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
::ams::sf::impl::ClassFunctionPointer<CLASSNAME, RETURN, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)>
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DECLARE_FUNCTION_POINTER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
AMS_SF_IMPL_FUNCTION_POINTER_TYPE(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) NAME;
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
template<typename ...Arguments> \
|
||||||
|
requires std::same_as<std::tuple<Arguments...>, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> \
|
||||||
|
RETURN Invoke##NAME##ByCommandTable (Arguments &&... args) { \
|
||||||
|
return this->cmd_table->NAME(this, std::forward<Arguments>(args)...); \
|
||||||
|
} \
|
||||||
|
template<typename ...Arguments> \
|
||||||
|
requires (::ams::sf::impl::Invokable<AMS_SF_IMPL_HELPER_FUNCTION_NAME(CLASSNAME, NAME), Arguments...> && \
|
||||||
|
std::same_as<std::tuple<Arguments...>, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)>) \
|
||||||
|
ALWAYS_INLINE RETURN NAME (Arguments &&... args) { \
|
||||||
|
return this->Invoke##NAME##ByCommandTable(std::forward<Arguments>(args)...); \
|
||||||
|
} \
|
||||||
|
template<typename ...Arguments> \
|
||||||
|
requires (::ams::sf::impl::Invokable<AMS_SF_IMPL_HELPER_FUNCTION_NAME(CLASSNAME, NAME), Arguments...> && \
|
||||||
|
!std::same_as<std::tuple<Arguments...>, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)>) \
|
||||||
|
ALWAYS_INLINE RETURN NAME (Arguments &&... args) { \
|
||||||
|
return [this] <typename... CorrectArguments, typename... PassedArguments> ALWAYS_INLINE_LAMBDA (::ams::sf::impl::TypeTag<std::tuple<CorrectArguments...>>, PassedArguments &&...args_) -> RETURN { \
|
||||||
|
return this->template NAME<CorrectArguments...>(std::forward<CorrectArguments>(args_)...); \
|
||||||
|
}(::ams::sf::impl::TypeTag<AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)>{}, std::forward<Arguments>(args)...); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION_INVOKER_HOLDER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
template<typename ...Arguments> \
|
||||||
|
requires std::same_as<std::tuple<Arguments...>, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> \
|
||||||
|
static RETURN NAME##Invoker (CLASSNAME *_this, Arguments &&... args) { \
|
||||||
|
return static_cast<ImplHolder *>(_this)->NAME(std::forward<Arguments>(args)...); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION_INVOKER_POINTER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
template<typename ...Arguments> \
|
||||||
|
requires std::same_as<std::tuple<Arguments...>, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> \
|
||||||
|
static RETURN NAME##Invoker (CLASSNAME *_this, Arguments &&... args) { \
|
||||||
|
return static_cast<ImplPointer *>(_this)->NAME(std::forward<Arguments>(args)...); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION_IMPL(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
template<typename ...Arguments> \
|
||||||
|
requires (std::same_as<std::tuple<Arguments...>, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> && \
|
||||||
|
std::same_as<RETURN, decltype(impl.NAME(std::declval<Arguments>()...))>) \
|
||||||
|
RETURN NAME (Arguments &&... args) { \
|
||||||
|
return this->impl.NAME(std::forward<Arguments>(args)...); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION_IMPL_PTR(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
template<typename ...Arguments> \
|
||||||
|
requires (std::same_as<std::tuple<Arguments...>, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> && \
|
||||||
|
std::same_as<RETURN, decltype(impl->NAME(std::declval<Arguments>()...))>) \
|
||||||
|
RETURN NAME (Arguments &&... args) { \
|
||||||
|
return this->impl->NAME(std::forward<Arguments>(args)...); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DEFINE_INTERFACE_IMPL_FUNCTION_POINTER_HOLDER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
template<typename A> struct NAME##FunctionPointerHolder; \
|
||||||
|
\
|
||||||
|
template<typename ...Arguments> \
|
||||||
|
requires std::same_as<std::tuple<Arguments...>, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> \
|
||||||
|
struct NAME##FunctionPointerHolder<std::tuple<Arguments...>> { \
|
||||||
|
static constexpr auto Value = static_cast<AMS_SF_IMPL_FUNCTION_POINTER_TYPE(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX)>(&NAME##Invoker<Arguments...>); \
|
||||||
|
};
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DEFINE_INTERFACE_SERVICE_COMMAND_META_HOLDER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
template<typename ServiceImpl, typename A> struct NAME##ServiceCommandMetaHolder; \
|
||||||
|
\
|
||||||
|
template<typename ServiceImpl, typename ...Arguments> \
|
||||||
|
requires std::same_as<std::tuple<Arguments...>, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> \
|
||||||
|
struct NAME##ServiceCommandMetaHolder<ServiceImpl, std::tuple<Arguments...>> { \
|
||||||
|
static constexpr auto Value = ::ams::sf::impl::MakeServiceCommandMeta<VERSION_MIN, VERSION_MAX, CMD_ID, &ServiceImpl::template Invoke##NAME##ByCommandTable<Arguments...>, RETURN, CLASSNAME, Arguments...>(); \
|
||||||
|
};
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DEFINE_INTERFACE_COMMAND_POINTER_TABLE_MEMBER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
.NAME = NAME##FunctionPointerHolder<AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)>::Value,
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DEFINE_CMIF_SERVICE_COMMAND_META_TABLE_ENTRY(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
NAME##ServiceCommandMetaHolder<ServiceImpl, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)>::Value,
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct Print;
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DEFINE_CLASS(BASECLASS, CLASSNAME, CMD_MACRO) \
|
||||||
|
class CLASSNAME : public BASECLASS { \
|
||||||
|
NON_COPYABLE(CLASSNAME); \
|
||||||
|
NON_MOVEABLE(CLASSNAME); \
|
||||||
|
private: \
|
||||||
|
struct CommandPointerTable { \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DECLARE_FUNCTION_POINTER) \
|
||||||
|
}; \
|
||||||
|
private: \
|
||||||
|
const CommandPointerTable * const cmd_table; \
|
||||||
|
private: \
|
||||||
|
CLASSNAME() = delete; \
|
||||||
|
protected: \
|
||||||
|
constexpr CLASSNAME(const CommandPointerTable *ct) \
|
||||||
|
: cmd_table(ct) { /* ... */ } \
|
||||||
|
virtual ~CLASSNAME() { /* ... */ } \
|
||||||
|
public: \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION) \
|
||||||
|
private: \
|
||||||
|
template<typename S, typename T> \
|
||||||
|
requires ((std::same_as<CLASSNAME, S> && !std::same_as<CLASSNAME, T>&& Is##CLASSNAME<T>) && \
|
||||||
|
(::ams::sf::IsMitmServiceObject<S> == ::ams::sf::IsMitmServiceImpl<T>)) \
|
||||||
|
struct ImplGenerator { \
|
||||||
|
public: \
|
||||||
|
class ImplHolder : public S { \
|
||||||
|
private: \
|
||||||
|
T impl; \
|
||||||
|
public: \
|
||||||
|
template<typename... Args> requires std::constructible_from<T, Args...> \
|
||||||
|
constexpr ImplHolder(Args &&... args) \
|
||||||
|
: S(std::addressof(CommandPointerTableImpl)), impl(std::forward<Args>(args)...) \
|
||||||
|
{ \
|
||||||
|
/* ... */ \
|
||||||
|
} \
|
||||||
|
ALWAYS_INLINE T &GetImpl() { return this->impl; } \
|
||||||
|
ALWAYS_INLINE const T &GetImpl() const { return this->impl; } \
|
||||||
|
\
|
||||||
|
template<typename U = S> requires ::ams::sf::IsMitmServiceObject<S> && std::same_as<U, S> \
|
||||||
|
static ALWAYS_INLINE bool ShouldMitm(os::ProcessId p, ncm::ProgramId r) { return T::ShouldMitm(p, r); } \
|
||||||
|
private: \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION_INVOKER_HOLDER) \
|
||||||
|
public: \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION_IMPL) \
|
||||||
|
private: \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DEFINE_INTERFACE_IMPL_FUNCTION_POINTER_HOLDER) \
|
||||||
|
public: \
|
||||||
|
static constexpr CommandPointerTable CommandPointerTableImpl = { \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DEFINE_INTERFACE_COMMAND_POINTER_TABLE_MEMBER) \
|
||||||
|
}; \
|
||||||
|
}; \
|
||||||
|
static_assert(Is##CLASSNAME<ImplHolder>); \
|
||||||
|
\
|
||||||
|
class ImplPointer : public S { \
|
||||||
|
private: \
|
||||||
|
T *impl; \
|
||||||
|
public: \
|
||||||
|
constexpr ImplPointer(T *t) \
|
||||||
|
: S(std::addressof(CommandPointerTableImpl)), impl(t) \
|
||||||
|
{ \
|
||||||
|
/* ... */ \
|
||||||
|
} \
|
||||||
|
ALWAYS_INLINE T &GetImpl() { return *this->impl; } \
|
||||||
|
ALWAYS_INLINE const T &GetImpl() const { return *this->impl; } \
|
||||||
|
private: \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION_INVOKER_POINTER) \
|
||||||
|
public: \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION_IMPL_PTR) \
|
||||||
|
private: \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DEFINE_INTERFACE_IMPL_FUNCTION_POINTER_HOLDER) \
|
||||||
|
public: \
|
||||||
|
static constexpr CommandPointerTable CommandPointerTableImpl = { \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DEFINE_INTERFACE_COMMAND_POINTER_TABLE_MEMBER) \
|
||||||
|
}; \
|
||||||
|
}; \
|
||||||
|
static_assert(Is##CLASSNAME<ImplHolder>); \
|
||||||
|
}; \
|
||||||
|
private: \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DEFINE_INTERFACE_SERVICE_COMMAND_META_HOLDER) \
|
||||||
|
public: \
|
||||||
|
template<typename T> requires (!std::same_as<CLASSNAME, T>&& Is##CLASSNAME<T>) \
|
||||||
|
using ImplHolder = typename ImplGenerator<CLASSNAME, T>::ImplHolder; \
|
||||||
|
\
|
||||||
|
template<typename T> requires (!std::same_as<CLASSNAME, T>&& Is##CLASSNAME<T>) \
|
||||||
|
using ImplPointer = typename ImplGenerator<CLASSNAME, T>::ImplPointer; \
|
||||||
|
\
|
||||||
|
AMS_SF_CMIF_IMPL_DEFINE_SERVICE_DISPATCH_TABLE { \
|
||||||
|
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DEFINE_CMIF_SERVICE_COMMAND_META_TABLE_ENTRY) \
|
||||||
|
}; \
|
||||||
|
};
|
||||||
|
|
||||||
|
#define AMS_SF_METHOD_INFO_6(CLASSNAME, HANDLER, CMD_ID, RETURN, NAME, ARGS) \
|
||||||
|
HANDLER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, hos::Version_Min, hos::Version_Max)
|
||||||
|
|
||||||
|
#define AMS_SF_METHOD_INFO_7(CLASSNAME, HANDLER, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN) \
|
||||||
|
HANDLER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, hos::Version_Max)
|
||||||
|
|
||||||
|
#define AMS_SF_METHOD_INFO_8(CLASSNAME, HANDLER, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
HANDLER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX)
|
||||||
|
|
||||||
|
#define AMS_SF_METHOD_INFO_X(_, _0, _1, _2, _3, _4, _5, _6, _7, FUNC, ...) FUNC
|
||||||
|
|
||||||
|
#define AMS_SF_METHOD_INFO(...) \
|
||||||
|
AMS_SF_METHOD_INFO_X(, ## __VA_ARGS__, AMS_SF_METHOD_INFO_8(__VA_ARGS__), AMS_SF_METHOD_INFO_7(__VA_ARGS__), AMS_SF_METHOD_INFO_6(__VA_ARGS__))
|
||||||
|
|
||||||
|
#define AMS_SF_DEFINE_INTERFACE(CLASSNAME, CMD_MACRO) \
|
||||||
|
AMS_SF_IMPL_DECLARE_HELPERS(CLASSNAME,CMD_MACRO) \
|
||||||
|
AMS_SF_IMPL_DEFINE_CONCEPT(CLASSNAME, CMD_MACRO) \
|
||||||
|
AMS_SF_IMPL_DEFINE_CLASS( ::ams::sf::IServiceObject, CLASSNAME, CMD_MACRO) \
|
||||||
|
static_assert(Is##CLASSNAME<CLASSNAME>);
|
||||||
|
|
||||||
|
#define AMS_SF_DEFINE_MITM_INTERFACE(CLASSNAME, CMD_MACRO) \
|
||||||
|
AMS_SF_IMPL_DECLARE_HELPERS(CLASSNAME,CMD_MACRO) \
|
||||||
|
AMS_SF_IMPL_DEFINE_CONCEPT(CLASSNAME, CMD_MACRO) \
|
||||||
|
AMS_SF_IMPL_DEFINE_CLASS(::ams::sf::IMitmServiceObject, CLASSNAME, CMD_MACRO) \
|
||||||
|
static_assert(Is##CLASSNAME<CLASSNAME>);
|
||||||
|
|
||||||
|
#define AMS_SF_IMPL_DECLARE_INTERFACE_METHODS(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
|
||||||
|
RETURN NAME ARGS;
|
||||||
|
|
||||||
|
#define AMS_SF_DECLARE_INTERFACE_METHODS(CMD_MACRO) \
|
||||||
|
CMD_MACRO(_, AMS_SF_IMPL_DECLARE_INTERFACE_METHODS)
|
||||||
|
|
||||||
|
}
|
|
@ -25,38 +25,44 @@ namespace ams::sf {
|
||||||
virtual ~IServiceObject() { /* ... */ }
|
virtual ~IServiceObject() { /* ... */ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
concept IsServiceObject = std::derived_from<T, IServiceObject>;
|
||||||
|
|
||||||
class IMitmServiceObject : public IServiceObject {
|
class IMitmServiceObject : public IServiceObject {
|
||||||
|
public:
|
||||||
|
virtual ~IMitmServiceObject() { /* ... */ }
|
||||||
|
};
|
||||||
|
|
||||||
|
class MitmServiceImplBase {
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<::Service> forward_service;
|
std::shared_ptr<::Service> forward_service;
|
||||||
sm::MitmProcessInfo client_info;
|
sm::MitmProcessInfo client_info;
|
||||||
public:
|
public:
|
||||||
IMitmServiceObject(std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &c) : forward_service(std::move(s)), client_info(c) { /* ... */ }
|
MitmServiceImplBase(std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &c) : forward_service(std::move(s)), client_info(c) { /* ... */ }
|
||||||
|
|
||||||
virtual ~IMitmServiceObject() { /* ... */ }
|
|
||||||
|
|
||||||
static bool ShouldMitm(os::ProcessId process_id, ncm::ProgramId program_id);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Utility. */
|
|
||||||
#define SF_MITM_SERVICE_OBJECT_CTOR(cls) cls(std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &c) : ::ams::sf::IMitmServiceObject(std::forward<std::shared_ptr<::Service>>(s), c)
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct ServiceObjectTraits {
|
concept IsMitmServiceObject = IsServiceObject<T> && std::derived_from<T, IMitmServiceObject>;
|
||||||
static_assert(std::is_base_of<ams::sf::IServiceObject, T>::value, "ServiceObjectTraits requires ServiceObject");
|
|
||||||
|
|
||||||
static constexpr bool IsMitmServiceObject = std::is_base_of<IMitmServiceObject, T>::value;
|
template<typename T>
|
||||||
|
concept IsMitmServiceImpl = requires (std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &c) {
|
||||||
struct SharedPointerHelper {
|
{ T(std::forward<std::shared_ptr<::Service>>(s), c) };
|
||||||
|
{ T::ShouldMitm(c) } -> std::same_as<bool>;
|
||||||
static constexpr void EmptyDelete(T *) { /* Empty deleter, for fake shared pointer. */ }
|
|
||||||
|
|
||||||
static constexpr std::shared_ptr<T> GetEmptyDeleteSharedPointer(T *srv_obj) {
|
|
||||||
return std::shared_ptr<T>(srv_obj, EmptyDelete);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename Interface, typename Impl, typename... Arguments> requires std::constructible_from<Impl, Arguments...>
|
||||||
|
constexpr ALWAYS_INLINE std::shared_ptr<typename Interface::ImplHolder<Impl>> MakeShared(Arguments &&... args) {
|
||||||
|
return std::make_shared<typename Interface::ImplHolder<Impl>>(std::forward<Arguments>(args)...);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Interface, typename Impl>
|
||||||
|
constexpr ALWAYS_INLINE std::shared_ptr<typename Interface::ImplPointer<Impl>> GetSharedPointerTo(Impl *impl) {
|
||||||
|
return std::make_shared<typename Interface::ImplPointer<Impl>>(impl);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Interface, typename Impl>
|
||||||
|
constexpr ALWAYS_INLINE std::shared_ptr<typename Interface::ImplPointer<Impl>> GetSharedPointerTo(Impl &impl) {
|
||||||
|
return GetSharedPointerTo<Interface, Impl>(std::addressof(impl));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,9 +16,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "sm/sm_types.hpp"
|
#include <stratosphere/sm/sm_types.hpp>
|
||||||
#include "sm/sm_api.hpp"
|
#include <stratosphere/sm/sm_api.hpp>
|
||||||
#include "sm/sm_mitm_api.hpp"
|
#include <stratosphere/sm/sm_mitm_api.hpp>
|
||||||
#include "sm/sm_scoped_holder.hpp"
|
#include <stratosphere/sm/sm_scoped_holder.hpp>
|
||||||
|
|
||||||
#include "sm/sm_manager_api.hpp"
|
#include <stratosphere/sm/sm_manager_api.hpp>
|
||||||
|
|
||||||
|
#include <stratosphere/sm/impl/sm_user_interface.hpp>
|
||||||
|
#include <stratosphere/sm/impl/sm_manager_interface.hpp>
|
||||||
|
#include <stratosphere/sm/impl/sm_debug_monitor_interface.hpp>
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sm/sm_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::sm::impl {
|
||||||
|
|
||||||
|
#define AMS_SM_I_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65000, Result, AtmosphereGetRecord, (sf::Out<ServiceRecord> record, ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65001, void, AtmosphereListRecords, (const sf::OutArray<ServiceRecord> &records, sf::Out<u64> out_count, u64 offset)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65002, void, AtmosphereGetRecordSize, (sf::Out<u64> record_size))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IDebugMonitorInterface, AMS_SM_I_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sm/sm_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::sm::impl {
|
||||||
|
|
||||||
|
#define AMS_SM_I_MANAGER_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, RegisterProcess, (os::ProcessId process_id, const sf::InBuffer &acid_sac, const sf::InBuffer &aci_sac)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, UnregisterProcess, (os::ProcessId process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65000, void, AtmosphereEndInitDefers, ()) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65001, void, AtmosphereHasMitm, (sf::Out<bool> out, ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65002, Result, AtmosphereRegisterProcess, (os::ProcessId process_id, ncm::ProgramId program_id, cfg::OverrideStatus override_status, const sf::InBuffer &acid_sac, const sf::InBuffer &aci_sac))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IManagerInterface, AMS_SM_I_MANAGER_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sm/sm_types.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
|
namespace ams::sm::impl {
|
||||||
|
|
||||||
|
#define AMS_SM_I_USER_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, RegisterClient, (const sf::ClientProcessId &client_process_id)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, GetServiceHandle, (sf::OutMoveHandle out_h, ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, RegisterService, (sf::OutMoveHandle out_h, ServiceName service, u32 max_sessions, bool is_light)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, Result, UnregisterService, (ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65000, Result, AtmosphereInstallMitm, (sf::OutMoveHandle srv_h, sf::OutMoveHandle qry_h, ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65001, Result, AtmosphereUninstallMitm, (ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65003, Result, AtmosphereAcknowledgeMitmSession, (sf::Out<MitmProcessInfo> client_info, sf::OutMoveHandle fwd_h, ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65004, Result, AtmosphereHasMitm, (sf::Out<bool> out, ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65005, Result, AtmosphereWaitMitm, (ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65006, Result, AtmosphereDeclareFutureMitm, (ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65100, Result, AtmosphereHasService, (sf::Out<bool> out, ServiceName service)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 65101, Result, AtmosphereWaitService, (ServiceName service))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IUserInterface, AMS_SM_I_USER_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -16,6 +16,15 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "spl/spl_types.hpp"
|
#include <stratosphere/spl/spl_types.hpp>
|
||||||
#include "spl/spl_api.hpp"
|
#include <stratosphere/spl/spl_api.hpp>
|
||||||
#include "spl/smc/spl_smc.hpp"
|
#include <stratosphere/spl/smc/spl_smc.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_random_interface.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_deprecated_general_interface.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_general_interface.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_crypto_interface.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_device_unique_data_interface.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_ssl_interface.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_es_interface.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_manu_interface.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_fs_interface.hpp>
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/spl/spl_types.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_general_interface.hpp>
|
||||||
|
|
||||||
|
namespace ams::spl::impl {
|
||||||
|
|
||||||
|
#define AMS_SPL_I_CRYPTO_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SPL_I_GENERAL_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, GenerateAesKek, (sf::Out<AccessKey> out_access_key, KeySource key_source, u32 generation, u32 option)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, Result, LoadAesKey, (s32 keyslot, AccessKey access_key, KeySource key_source)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, Result, GenerateAesKey, (sf::Out<AesKey> out_key, AccessKey access_key, KeySource key_source)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 14, Result, DecryptAesKey, (sf::Out<AesKey> out_key, KeySource key_source, u32 generation, u32 option)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 15, Result, ComputeCtr, (const sf::OutNonSecureBuffer &out_buf, s32 keyslot, const sf::InNonSecureBuffer &in_buf, IvCtr iv_ctr)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 16, Result, ComputeCmac, (sf::Out<Cmac> out_cmac, s32 keyslot, const sf::InPointerBuffer &in_buf)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 21, Result, AllocateAesKeySlot, (sf::Out<s32> out_keyslot)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 22, Result, DeallocateAesKeySlot, (s32 keyslot)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 23, Result, GetAesKeySlotAvailableEvent, (sf::OutCopyHandle out_hnd))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(ICryptoInterface, AMS_SPL_I_CRYPTO_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/spl/spl_types.hpp>
|
||||||
|
|
||||||
|
namespace ams::spl::impl {
|
||||||
|
|
||||||
|
#define AMS_SPL_I_DEPRECATED_GENERAL_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GetConfig, (sf::Out<u64> out, u32 which)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, ModularExponentiate, (const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &exp, const sf::InPointerBuffer &mod)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 2, Result, GenerateAesKek, (sf::Out<AccessKey> out_access_key, KeySource key_source, u32 generation, u32 option)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 3, Result, LoadAesKey, (s32 keyslot, AccessKey access_key, KeySource key_source)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 4, Result, GenerateAesKey, (sf::Out<AesKey> out_key, AccessKey access_key, KeySource key_source)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 5, Result, SetConfig, (u32 which, u64 value)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 7, Result, GenerateRandomBytes, (const sf::OutPointerBuffer &out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 9, Result, DecryptAndStoreGcKey, (const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 10, Result, DecryptGcMessage, (sf::Out<u32> out_size, const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 11, Result, IsDevelopment, (sf::Out<bool> is_dev)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 12, Result, GenerateSpecificAesKey, (sf::Out<AesKey> out_key, KeySource key_source, u32 generation, u32 which)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 13, Result, DecryptDeviceUniqueData, (const sf::OutPointerBuffer &dst, const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 14, Result, DecryptAesKey, (sf::Out<AesKey> out_key, KeySource key_source, u32 generation, u32 option)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 15, Result, ComputeCtrDeprecated, (const sf::OutBuffer &out_buf, s32 keyslot, const sf::InBuffer &in_buf, IvCtr iv_ctr), hos::Version_1_0_0, hos::Version_1_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 15, Result, ComputeCtr, (const sf::OutNonSecureBuffer &out_buf, s32 keyslot, const sf::InNonSecureBuffer &in_buf, IvCtr iv_ctr), hos::Version_2_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 16, Result, ComputeCmac, (sf::Out<Cmac> out_cmac, s32 keyslot, const sf::InPointerBuffer &in_buf)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 17, Result, LoadEsDeviceKey, (const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 18, Result, PrepareEsTitleKeyDeprecated, (sf::Out<AccessKey> out_access_key, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest), hos::Version_1_0_0, hos::Version_2_3_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 18, Result, PrepareEsTitleKey, (sf::Out<AccessKey> out_access_key, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest, u32 generation), hos::Version_3_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 19, Result, LoadPreparedAesKey, (s32 keyslot, AccessKey access_key)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 20, Result, PrepareCommonEsTitleKeyDeprecated, (sf::Out<AccessKey> out_access_key, KeySource key_source), hos::Version_2_0_0, hos::Version_2_3_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 20, Result, PrepareCommonEsTitleKey, (sf::Out<AccessKey> out_access_key, KeySource key_source, u32 generation), hos::Version_3_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 22, Result, DeallocateAesKeySlot, (s32 keyslot)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 23, Result, GetAesKeySlotAvailableEvent, (sf::OutCopyHandle out_hnd)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 24, Result, SetBootReason, (spl::BootReasonValue boot_reason), hos::Version_3_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 25, Result, GetBootReason, (sf::Out<spl::BootReasonValue> out), hos::Version_3_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IDeprecatedGeneralInterface, AMS_SPL_I_DEPRECATED_GENERAL_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/spl/spl_types.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_crypto_interface.hpp>
|
||||||
|
|
||||||
|
namespace ams::spl::impl {
|
||||||
|
|
||||||
|
#define AMS_SPL_I_DEVICE_UNIQUE_DATA_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SPL_I_CRYPTO_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 13, Result, DecryptDeviceUniqueDataDeprecated, (const sf::OutPointerBuffer &dst, const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option), hos::Version_Min, hos::Version_4_1_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 13, Result, DecryptDeviceUniqueData, (const sf::OutPointerBuffer &dst, const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source), hos::Version_5_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IDeviceUniqueDataInterface, AMS_SPL_I_DEVICE_UNIQUE_DATA_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/spl/spl_types.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_device_unique_data_interface.hpp>
|
||||||
|
|
||||||
|
namespace ams::spl::impl {
|
||||||
|
|
||||||
|
#define AMS_SPL_I_ES_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SPL_I_DEVICE_UNIQUE_DATA_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 17, Result, LoadEsDeviceKeyDeprecated, (const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option), hos::Version_Min, hos::Version_4_1_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 17, Result, LoadEsDeviceKey, (const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source), hos::Version_5_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 18, Result, PrepareEsTitleKey, (sf::Out<AccessKey> out_access_key, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest, u32 generation)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 20, Result, PrepareCommonEsTitleKey, (sf::Out<AccessKey> out_access_key, KeySource key_source, u32 generation), hos::Version_2_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 28, Result, DecryptAndStoreDrmDeviceCertKey, (const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source), hos::Version_5_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 29, Result, ModularExponentiateWithDrmDeviceCertKey, (const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod), hos::Version_5_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 31, Result, PrepareEsArchiveKey, (sf::Out<AccessKey> out_access_key, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest, u32 generation), hos::Version_6_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 32, Result, LoadPreparedAesKey, (s32 keyslot, AccessKey access_key), hos::Version_6_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IEsInterface, AMS_SPL_I_ES_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/spl/spl_types.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_crypto_interface.hpp>
|
||||||
|
|
||||||
|
namespace ams::spl::impl {
|
||||||
|
|
||||||
|
#define AMS_SPL_I_FS_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SPL_I_CRYPTO_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 9, Result, DecryptAndStoreGcKeyDeprecated, (const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option), hos::Version_Min, hos::Version_4_1_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 9, Result, DecryptAndStoreGcKey, (const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source), hos::Version_5_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 10, Result, DecryptGcMessage, (sf::Out<u32> out_size, const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 12, Result, GenerateSpecificAesKey, (sf::Out<AesKey> out_key, KeySource key_source, u32 generation, u32 which)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 19, Result, LoadPreparedAesKey, (s32 keyslot, AccessKey access_key)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 31, Result, GetPackage2Hash, (const sf::OutPointerBuffer &dst), hos::Version_5_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IFsInterface, AMS_SPL_I_FS_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/spl/spl_types.hpp>
|
||||||
|
|
||||||
|
namespace ams::spl::impl {
|
||||||
|
|
||||||
|
#define AMS_SPL_I_GENERAL_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GetConfig, (sf::Out<u64> out, u32 which)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 1, Result, ModularExponentiate, (const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &exp, const sf::InPointerBuffer &mod)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 5, Result, SetConfig, (u32 which, u64 value)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 7, Result, GenerateRandomBytes, (const sf::OutPointerBuffer &out)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 11, Result, IsDevelopment, (sf::Out<bool> is_dev)) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 24, Result, SetBootReason, (spl::BootReasonValue boot_reason), hos::Version_3_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 25, Result, GetBootReason, (sf::Out<spl::BootReasonValue> out), hos::Version_3_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IGeneralInterface, AMS_SPL_I_GENERAL_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/spl/spl_types.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_device_unique_data_interface.hpp>
|
||||||
|
|
||||||
|
namespace ams::spl::impl {
|
||||||
|
|
||||||
|
#define AMS_SPL_I_MANU_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SPL_I_DEVICE_UNIQUE_DATA_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 30, Result, ReencryptDeviceUniqueData, (const sf::OutPointerBuffer &out, const sf::InPointerBuffer &src, AccessKey access_key_dec, KeySource source_dec, AccessKey access_key_enc, KeySource source_enc, u32 option)) \
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IManuInterface, AMS_SPL_I_MANU_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/spl/spl_types.hpp>
|
||||||
|
|
||||||
|
namespace ams::spl::impl {
|
||||||
|
|
||||||
|
#define AMS_SPL_I_RANDOM_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GenerateRandomBytes, (const sf::OutBuffer &out))
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(IRandomInterface, AMS_SPL_I_RANDOM_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/sf.hpp>
|
||||||
|
#include <stratosphere/spl/spl_types.hpp>
|
||||||
|
#include <stratosphere/spl/impl/spl_device_unique_data_interface.hpp>
|
||||||
|
|
||||||
|
namespace ams::spl::impl {
|
||||||
|
|
||||||
|
#define AMS_SPL_I_SSL_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SPL_I_DEVICE_UNIQUE_DATA_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 26, Result, DecryptAndStoreSslClientCertKey, (const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source), hos::Version_5_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 27, Result, ModularExponentiateWithSslClientCertKey, (const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod), hos::Version_5_0_0)
|
||||||
|
|
||||||
|
AMS_SF_DEFINE_INTERFACE(ISslInterface, AMS_SPL_I_SSL_INTERFACE_INTERFACE_INFO)
|
||||||
|
|
||||||
|
}
|
|
@ -20,54 +20,47 @@
|
||||||
namespace ams::spl::smc {
|
namespace ams::spl::smc {
|
||||||
|
|
||||||
/* Helpers for converting arguments. */
|
/* Helpers for converting arguments. */
|
||||||
inline u32 GetCryptAesMode(CipherMode mode, u32 keyslot) {
|
inline u32 GetComputeAesMode(CipherMode mode, u32 keyslot) {
|
||||||
return static_cast<u32>((static_cast<u32>(mode) << 4) | (keyslot & 7));
|
return static_cast<u32>((static_cast<u32>(mode) << 4) | (keyslot & 7));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u32 GetUnwrapEsKeyOption(EsKeyType type, u32 generation) {
|
inline u32 GetPrepareEsDeviceUniqueKeyOption(EsCommonKeyType type, u32 generation) {
|
||||||
return static_cast<u32>((static_cast<u32>(type) << 6) | (generation & 0x3F));
|
return static_cast<u32>((static_cast<u32>(type) << 6) | (generation & 0x3F));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Functions. */
|
/* Functions. */
|
||||||
Result SetConfig(SplConfigItem which, const u64 *value, size_t num_qwords);
|
Result SetConfig(spl::ConfigItem which, const u64 *value, size_t num_qwords);
|
||||||
Result GetConfig(u64 *out, size_t num_qwords, SplConfigItem which);
|
Result GetConfig(u64 *out, size_t num_qwords, spl::ConfigItem which);
|
||||||
Result CheckStatus(Result *out, AsyncOperationKey op);
|
Result GetResult(Result *out, AsyncOperationKey op);
|
||||||
Result GetResult(Result *out, void *out_buf, size_t out_buf_size, AsyncOperationKey op);
|
Result GetResultData(Result *out, void *out_buf, size_t out_buf_size, AsyncOperationKey op);
|
||||||
Result ExpMod(AsyncOperationKey *out_op, const void *base, const void *exp, size_t exp_size, const void *mod);
|
Result ModularExponentiate(AsyncOperationKey *out_op, const void *base, const void *exp, size_t exp_size, const void *mod);
|
||||||
Result GenerateRandomBytes(void *out, size_t size);
|
Result GenerateRandomBytes(void *out, size_t size);
|
||||||
Result GenerateAesKek(AccessKey *out, const KeySource &source, u32 generation, u32 option);
|
Result GenerateAesKek(AccessKey *out, const KeySource &source, u32 generation, u32 option);
|
||||||
Result LoadAesKey(u32 keyslot, const AccessKey &access_key, const KeySource &source);
|
Result LoadAesKey(u32 keyslot, const AccessKey &access_key, const KeySource &source);
|
||||||
Result CryptAes(AsyncOperationKey *out_op, u32 mode, const IvCtr &iv_ctr, u32 dst_addr, u32 src_addr, size_t size);
|
Result ComputeAes(AsyncOperationKey *out_op, u32 mode, const IvCtr &iv_ctr, u32 dst_addr, u32 src_addr, size_t size);
|
||||||
Result GenerateSpecificAesKey(AesKey *out_key, const KeySource &source, u32 generation, u32 which);
|
Result GenerateSpecificAesKey(AesKey *out_key, const KeySource &source, u32 generation, u32 which);
|
||||||
Result ComputeCmac(Cmac *out_mac, u32 keyslot, const void *data, size_t size);
|
Result ComputeCmac(Cmac *out_mac, u32 keyslot, const void *data, size_t size);
|
||||||
Result ReEncryptRsaPrivateKey(void *data, size_t size, const AccessKey &access_key_dec, const KeySource &source_dec, const AccessKey &access_key_enc, const KeySource &source_enc, u32 option);
|
Result ReencryptDeviceUniqueData(void *data, size_t size, const AccessKey &access_key_dec, const KeySource &source_dec, const AccessKey &access_key_enc, const KeySource &source_enc, u32 option);
|
||||||
Result DecryptOrImportRsaPrivateKey(void *data, size_t size, const AccessKey &access_key, const KeySource &source, DecryptOrImportMode mode);
|
Result DecryptDeviceUniqueData(void *data, size_t size, const AccessKey &access_key, const KeySource &source, DeviceUniqueDataMode mode);
|
||||||
Result SecureExpMod(AsyncOperationKey *out_op, const void *base, const void *mod, SecureExpModMode mode);
|
Result ModularExponentiateWithStorageKey(AsyncOperationKey *out_op, const void *base, const void *mod, ModularExponentiateWithStorageKeyMode mode);
|
||||||
Result UnwrapTitleKey(AsyncOperationKey *out_op, const void *base, const void *mod, const void *label_digest, size_t label_digest_size, u32 option);
|
Result PrepareEsDeviceUniqueKey(AsyncOperationKey *out_op, const void *base, const void *mod, const void *label_digest, size_t label_digest_size, u32 option);
|
||||||
Result LoadTitleKey(u32 keyslot, const AccessKey &access_key);
|
Result LoadPreparedAesKey(u32 keyslot, const AccessKey &access_key);
|
||||||
Result UnwrapCommonTitleKey(AccessKey *out, const KeySource &source, u32 generation);
|
Result PrepareCommonEsTitleKey(AccessKey *out, const KeySource &source, u32 generation);
|
||||||
|
|
||||||
/* Deprecated functions. */
|
/* Deprecated functions. */
|
||||||
Result ImportEsKey(const void *data, size_t size, const AccessKey &access_key, const KeySource &source, u32 option);
|
Result LoadEsDeviceKey(const void *data, size_t size, const AccessKey &access_key, const KeySource &source, u32 option);
|
||||||
Result DecryptRsaPrivateKey(size_t *out_size, void *data, size_t size, const AccessKey &access_key, const KeySource &source, u32 option);
|
Result DecryptDeviceUniqueData(size_t *out_size, void *data, size_t size, const AccessKey &access_key, const KeySource &source, u32 option);
|
||||||
Result ImportSecureExpModKey(const void *data, size_t size, const AccessKey &access_key, const KeySource &source, u32 option);
|
Result DecryptAndStoreGcKey(const void *data, size_t size, const AccessKey &access_key, const KeySource &source, u32 option);
|
||||||
|
|
||||||
/* Atmosphere functions. */
|
/* Atmosphere functions. */
|
||||||
Result AtmosphereCopyToIram(uintptr_t iram_dst, const void *dram_src, size_t size);
|
Result AtmosphereCopyToIram(uintptr_t iram_dst, const void *dram_src, size_t size);
|
||||||
Result AtmosphereCopyFromIram(void *dram_dst, uintptr_t iram_src, size_t size);
|
Result AtmosphereCopyFromIram(void *dram_dst, uintptr_t iram_src, size_t size);
|
||||||
Result AtmosphereReadWriteRegister(uint64_t address, uint32_t mask, uint32_t value, uint32_t *out_value);
|
Result AtmosphereReadWriteRegister(uint64_t address, uint32_t mask, uint32_t value, uint32_t *out_value);
|
||||||
Result AtmosphereWriteAddress(void *dst, const void *src, size_t size);
|
|
||||||
Result AtmosphereGetEmummcConfig(void *out_config, void *out_paths, u32 storage_id);
|
Result AtmosphereGetEmummcConfig(void *out_config, void *out_paths, u32 storage_id);
|
||||||
|
|
||||||
/* Helpers. */
|
/* Helpers. */
|
||||||
inline Result SetConfig(SplConfigItem which, const u64 value) {
|
inline Result SetConfig(spl::ConfigItem which, const u64 value) {
|
||||||
return SetConfig(which, &value, 1);
|
return SetConfig(which, &value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline Result AtmosphereWriteAddress(void *dst, const T value) {
|
|
||||||
static_assert(std::is_integral<T>::value && sizeof(T) <= 8 && (sizeof(T) & (sizeof(T) - 1)) == 0, "AtmosphereWriteAddress requires integral type.");
|
|
||||||
return AtmosphereWriteAddress(dst, &value, sizeof(T));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,35 +22,34 @@ namespace ams::spl {
|
||||||
namespace smc {
|
namespace smc {
|
||||||
|
|
||||||
enum class FunctionId : u32 {
|
enum class FunctionId : u32 {
|
||||||
SetConfig = 0xC3000401,
|
SetConfig = 0xC3000401,
|
||||||
GetConfig = 0xC3000002,
|
GetConfig = 0xC3000002,
|
||||||
CheckStatus = 0xC3000003,
|
GetResult = 0xC3000003,
|
||||||
GetResult = 0xC3000404,
|
GetResultData = 0xC3000404,
|
||||||
ExpMod = 0xC3000E05,
|
ModularExponentiate = 0xC3000E05,
|
||||||
GenerateRandomBytes = 0xC3000006,
|
GenerateRandomBytes = 0xC3000006,
|
||||||
GenerateAesKek = 0xC3000007,
|
GenerateAesKek = 0xC3000007,
|
||||||
LoadAesKey = 0xC3000008,
|
LoadAesKey = 0xC3000008,
|
||||||
CryptAes = 0xC3000009,
|
ComputeAes = 0xC3000009,
|
||||||
GenerateSpecificAesKey = 0xC300000A,
|
GenerateSpecificAesKey = 0xC300000A,
|
||||||
ComputeCmac = 0xC300040B,
|
ComputeCmac = 0xC300040B,
|
||||||
ReEncryptRsaPrivateKey = 0xC300D60C,
|
ReencryptDeviceUniqueData = 0xC300D60C,
|
||||||
DecryptOrImportRsaPrivateKey = 0xC300100D,
|
DecryptDeviceUniqueData = 0xC300100D,
|
||||||
|
|
||||||
SecureExpMod = 0xC300060F,
|
ModularExponentiateWithStorageKey = 0xC300060F,
|
||||||
UnwrapTitleKey = 0xC3000610,
|
PrepareEsDeviceUniqueKey = 0xC3000610,
|
||||||
LoadTitleKey = 0xC3000011,
|
LoadPreparedAesKey = 0xC3000011,
|
||||||
UnwrapCommonTitleKey = 0xC3000012,
|
PrepareCommonEsTitleKey = 0xC3000012,
|
||||||
|
|
||||||
/* Deprecated functions. */
|
/* Deprecated functions. */
|
||||||
ImportEsKey = 0xC300100C,
|
LoadEsDeviceKey = 0xC300100C,
|
||||||
DecryptRsaPrivateKey = 0xC300100D,
|
DecryptAndStoreGcKey = 0xC300100E,
|
||||||
ImportSecureExpModKey = 0xC300100E,
|
|
||||||
|
|
||||||
/* Atmosphere functions. */
|
/* Atmosphere functions. */
|
||||||
AtmosphereIramCopy = 0xF0000201,
|
AtmosphereIramCopy = 0xF0000201,
|
||||||
AtmosphereReadWriteRegister = 0xF0000002,
|
AtmosphereReadWriteRegister = 0xF0000002,
|
||||||
AtmosphereWriteAddress = 0xF0000003,
|
|
||||||
AtmosphereGetEmummcConfig = 0xF0000404,
|
AtmosphereGetEmummcConfig = 0xF0000404,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class Result {
|
enum class Result {
|
||||||
|
@ -61,6 +60,7 @@ namespace ams::spl {
|
||||||
NoAsyncOperation = 4,
|
NoAsyncOperation = 4,
|
||||||
InvalidAsyncOperation = 5,
|
InvalidAsyncOperation = 5,
|
||||||
NotPermitted = 6,
|
NotPermitted = 6,
|
||||||
|
NotInitialized = 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr inline ::ams::Result ConvertResult(Result smc_result) {
|
constexpr inline ::ams::Result ConvertResult(Result smc_result) {
|
||||||
|
@ -69,11 +69,10 @@ namespace ams::spl {
|
||||||
|
|
||||||
/* Convert to the list of known SecureMonitorErrors. */
|
/* Convert to the list of known SecureMonitorErrors. */
|
||||||
const auto converted = R_MAKE_NAMESPACE_RESULT(::ams::spl, static_cast<u32>(smc_result));
|
const auto converted = R_MAKE_NAMESPACE_RESULT(::ams::spl, static_cast<u32>(smc_result));
|
||||||
if (spl::ResultSecureMonitorError::Includes(converted)) {
|
R_UNLESS(spl::ResultSecureMonitorError::Includes(converted), spl::ResultUnknownSecureMonitorError());
|
||||||
return converted;
|
|
||||||
}
|
|
||||||
|
|
||||||
return spl::ResultUnknownSecureMonitorError();
|
/* Return the error. */
|
||||||
|
return converted;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class CipherMode {
|
enum class CipherMode {
|
||||||
|
@ -82,23 +81,23 @@ namespace ams::spl {
|
||||||
Ctr = 2,
|
Ctr = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DecryptOrImportMode {
|
enum class DeviceUniqueDataMode {
|
||||||
DecryptRsaPrivateKey = 0,
|
DecryptDeviceUniqueData = 0,
|
||||||
ImportLotusKey = 1,
|
DecryptAndStoreGcKey = 1,
|
||||||
ImportEsKey = 2,
|
DecryptAndStoreEsDeviceKey = 2,
|
||||||
ImportSslKey = 3,
|
DecryptAndStoreSslKey = 3,
|
||||||
ImportDrmKey = 4,
|
DecryptAndStoreDrmDeviceCertKey = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SecureExpModMode {
|
enum class ModularExponentiateWithStorageKeyMode {
|
||||||
Lotus = 0,
|
Gc = 0,
|
||||||
Ssl = 1,
|
Ssl = 1,
|
||||||
Drm = 2,
|
DrmDeviceCert = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class EsKeyType {
|
enum class EsCommonKeyType {
|
||||||
TitleKey = 0,
|
TitleKey = 0,
|
||||||
ElicenseKey = 1,
|
ArchiveKey = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AsyncOperationKey {
|
struct AsyncOperationKey {
|
||||||
|
@ -196,23 +195,23 @@ namespace ams::spl {
|
||||||
|
|
||||||
enum class ConfigItem : u32 {
|
enum class ConfigItem : u32 {
|
||||||
/* Standard config items. */
|
/* Standard config items. */
|
||||||
DisableProgramVerification = 1,
|
DisableProgramVerification = 1,
|
||||||
DramId = 2,
|
DramId = 2,
|
||||||
SecurityEngineIrqNumber = 3,
|
SecurityEngineInterruptNumber = 3,
|
||||||
FuseVersion = 4,
|
FuseVersion = 4,
|
||||||
HardwareType = 5,
|
HardwareType = 5,
|
||||||
HardwareState = 6,
|
HardwareState = 6,
|
||||||
IsRecoveryBoot = 7,
|
IsRecoveryBoot = 7,
|
||||||
DeviceId = 8,
|
DeviceId = 8,
|
||||||
BootReason = 9,
|
BootReason = 9,
|
||||||
MemoryMode = 10,
|
MemoryMode = 10,
|
||||||
IsDevelopmentFunctionEnabled = 11,
|
IsDevelopmentFunctionEnabled = 11,
|
||||||
KernelConfiguration = 12,
|
KernelConfiguration = 12,
|
||||||
IsChargerHiZModeEnabled = 13,
|
IsChargerHiZModeEnabled = 13,
|
||||||
IsQuest = 14,
|
QuestState = 14,
|
||||||
RegulatorType = 15,
|
RegulatorType = 15,
|
||||||
DeviceUniqueKeyGeneration = 16,
|
DeviceUniqueKeyGeneration = 16,
|
||||||
Package2Hash = 17,
|
Package2Hash = 17,
|
||||||
|
|
||||||
/* Extension config items for exosphere. */
|
/* Extension config items for exosphere. */
|
||||||
ExosphereApiVersion = 65000,
|
ExosphereApiVersion = 65000,
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace ams::exosphere {
|
||||||
|
|
||||||
ApiInfo GetApiInfo() {
|
ApiInfo GetApiInfo() {
|
||||||
u64 exosphere_cfg;
|
u64 exosphere_cfg;
|
||||||
if (spl::smc::GetConfig(&exosphere_cfg, 1, SplConfigItem_ExosphereApiVersion) != spl::smc::Result::Success) {
|
if (spl::smc::GetConfig(&exosphere_cfg, 1, spl::ConfigItem::ExosphereApiVersion) != spl::smc::Result::Success) {
|
||||||
R_ABORT_UNLESS(ResultNotPresent());
|
R_ABORT_UNLESS(ResultNotPresent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,15 +29,15 @@ namespace ams::exosphere {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForceRebootToRcm() {
|
void ForceRebootToRcm() {
|
||||||
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::SetConfig(SplConfigItem_ExosphereNeedsReboot, 1)));
|
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::SetConfig(spl::ConfigItem::ExosphereNeedsReboot, 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForceRebootToIramPayload() {
|
void ForceRebootToIramPayload() {
|
||||||
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::SetConfig(SplConfigItem_ExosphereNeedsReboot, 2)));
|
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::SetConfig(spl::ConfigItem::ExosphereNeedsReboot, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForceShutdown() {
|
void ForceShutdown() {
|
||||||
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::SetConfig(SplConfigItem_ExosphereNeedsShutdown, 1)));
|
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::SetConfig(spl::ConfigItem::ExosphereNeedsShutdown, 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyToIram(uintptr_t iram_dst, const void *dram_src, size_t size) {
|
void CopyToIram(uintptr_t iram_dst, const void *dram_src, size_t size) {
|
||||||
|
@ -52,7 +52,7 @@ namespace ams::exosphere {
|
||||||
|
|
||||||
inline u64 GetU64ConfigItem(spl::ConfigItem cfg) {
|
inline u64 GetU64ConfigItem(spl::ConfigItem cfg) {
|
||||||
u64 tmp;
|
u64 tmp;
|
||||||
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::GetConfig(std::addressof(tmp), 1, static_cast<::SplConfigItem>(cfg))));
|
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::GetConfig(std::addressof(tmp), 1, cfg)));
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace ams::capsrv::server {
|
||||||
this->server_manager_holder.emplace();
|
this->server_manager_holder.emplace();
|
||||||
|
|
||||||
/* Register the service. */
|
/* Register the service. */
|
||||||
R_ABORT_UNLESS(this->server_manager_holder->RegisterServer<Service>(ServiceName, MaxSessions, sf::ServiceObjectTraits<Service>::SharedPointerHelper::GetEmptyDeleteSharedPointer(std::addressof(*this->service_holder))));
|
R_ABORT_UNLESS((this->server_manager_holder->RegisterServer<Interface, Service>(ServiceName, MaxSessions, sf::GetSharedPointerTo<Interface>(*this->service_holder))));
|
||||||
|
|
||||||
/* Initialize the idle event, we're idle initially. */
|
/* Initialize the idle event, we're idle initially. */
|
||||||
os::InitializeEvent(std::addressof(this->idle_event), true, os::EventClearMode_ManualClear);
|
os::InitializeEvent(std::addressof(this->idle_event), true, os::EventClearMode_ManualClear);
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace ams::capsrv::server {
|
||||||
static constexpr inline size_t MaxSessions = 2;
|
static constexpr inline size_t MaxSessions = 2;
|
||||||
static constexpr inline sm::ServiceName ServiceName = sm::ServiceName::Encode("caps:dc");
|
static constexpr inline sm::ServiceName ServiceName = sm::ServiceName::Encode("caps:dc");
|
||||||
|
|
||||||
|
using Interface = IDecoderControlService;
|
||||||
using Service = DecoderControlService;
|
using Service = DecoderControlService;
|
||||||
using ServerOptions = sf::hipc::DefaultServerManagerOptions;
|
using ServerOptions = sf::hipc::DefaultServerManagerOptions;
|
||||||
using ServerManager = sf::hipc::ServerManager<NumServers, ServerOptions, MaxSessions>;
|
using ServerManager = sf::hipc::ServerManager<NumServers, ServerOptions, MaxSessions>;
|
||||||
|
|
|
@ -18,17 +18,15 @@
|
||||||
|
|
||||||
namespace ams::capsrv::server {
|
namespace ams::capsrv::server {
|
||||||
|
|
||||||
class DecoderControlService final : public sf::IServiceObject {
|
#define AMS_CAPSRV_DECODER_CONTROL_SERVICE_INTERFACE_INFO(C, H) \
|
||||||
protected:
|
AMS_SF_METHOD_INFO(C, H, 3001, Result, DecodeJpeg, (const sf::OutNonSecureBuffer &out, const sf::InBuffer &in, u32 width, u32 height, const ScreenShotDecodeOption &option))
|
||||||
enum class CommandId {
|
|
||||||
DecodeJpeg = 3001,
|
AMS_SF_DEFINE_INTERFACE(IDecoderControlService, AMS_CAPSRV_DECODER_CONTROL_SERVICE_INTERFACE_INFO)
|
||||||
};
|
|
||||||
|
class DecoderControlService final {
|
||||||
public:
|
public:
|
||||||
/* Actual commands. */
|
Result DecodeJpeg(const sf::OutNonSecureBuffer &out, const sf::InBuffer &in, u32 width, u32 height, const ScreenShotDecodeOption &option);
|
||||||
virtual Result DecodeJpeg(const sf::OutNonSecureBuffer &out, const sf::InBuffer &in, u32 width, u32 height, const ScreenShotDecodeOption &option);
|
|
||||||
public:
|
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
|
||||||
MAKE_SERVICE_COMMAND_META(DecodeJpeg)
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
static_assert(IsIDecoderControlService<DecoderControlService>);
|
||||||
|
|
||||||
}
|
}
|
|
@ -20,19 +20,20 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
class Attachment;
|
class Attachment;
|
||||||
|
|
||||||
class AttachmentImpl final : public erpt::sf::IAttachment {
|
class AttachmentImpl final {
|
||||||
private:
|
private:
|
||||||
Attachment *attachment;
|
Attachment *attachment;
|
||||||
public:
|
public:
|
||||||
AttachmentImpl();
|
AttachmentImpl();
|
||||||
~AttachmentImpl();
|
~AttachmentImpl();
|
||||||
public:
|
public:
|
||||||
virtual Result Open(const AttachmentId &attachment_id) override final;
|
Result Open(const AttachmentId &attachment_id);
|
||||||
virtual Result Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) override final;
|
Result Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer);
|
||||||
virtual Result SetFlags(AttachmentFlagSet flags) override final;
|
Result SetFlags(AttachmentFlagSet flags);
|
||||||
virtual Result GetFlags(ams::sf::Out<AttachmentFlagSet> out) override final;
|
Result GetFlags(ams::sf::Out<AttachmentFlagSet> out);
|
||||||
virtual Result Close() override final;
|
Result Close();
|
||||||
virtual Result GetSize(ams::sf::Out<s64> out) override final;
|
Result GetSize(ams::sf::Out<s64> out);
|
||||||
};
|
};
|
||||||
|
static_assert(erpt::sf::IsIAttachment<AttachmentImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,19 +18,20 @@
|
||||||
|
|
||||||
namespace ams::erpt::srv {
|
namespace ams::erpt::srv {
|
||||||
|
|
||||||
class ContextImpl final : public erpt::sf::IContext {
|
class ContextImpl final {
|
||||||
public:
|
public:
|
||||||
virtual Result SubmitContext(const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer) override final;
|
Result SubmitContext(const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer);
|
||||||
virtual Result CreateReport(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer) override final;
|
Result CreateReport(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer);
|
||||||
virtual Result SetInitialLaunchSettingsCompletionTime(const time::SteadyClockTimePoint &time_point) override final;
|
Result SetInitialLaunchSettingsCompletionTime(const time::SteadyClockTimePoint &time_point);
|
||||||
virtual Result ClearInitialLaunchSettingsCompletionTime() override final;
|
Result ClearInitialLaunchSettingsCompletionTime();
|
||||||
virtual Result UpdatePowerOnTime() override final;
|
Result UpdatePowerOnTime();
|
||||||
virtual Result UpdateAwakeTime() override final;
|
Result UpdateAwakeTime();
|
||||||
virtual Result SubmitMultipleCategoryContext(const MultipleCategoryContextEntry &ctx_entry, const ams::sf::InBuffer &str_buffer) override final;
|
Result SubmitMultipleCategoryContext(const MultipleCategoryContextEntry &ctx_entry, const ams::sf::InBuffer &str_buffer);
|
||||||
virtual Result UpdateApplicationLaunchTime() override final;
|
Result UpdateApplicationLaunchTime();
|
||||||
virtual Result ClearApplicationLaunchTime() override final;
|
Result ClearApplicationLaunchTime();
|
||||||
virtual Result SubmitAttachment(ams::sf::Out<AttachmentId> out, const ams::sf::InBuffer &attachment_name, const ams::sf::InBuffer &attachment_data) override final;
|
Result SubmitAttachment(ams::sf::Out<AttachmentId> out, const ams::sf::InBuffer &attachment_name, const ams::sf::InBuffer &attachment_data);
|
||||||
virtual Result CreateReportWithAttachments(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer) override final;
|
Result CreateReportWithAttachments(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer);
|
||||||
};
|
};
|
||||||
|
static_assert(erpt::sf::IsIContext<ContextImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
namespace ams::erpt::srv {
|
namespace ams::erpt::srv {
|
||||||
|
|
||||||
class ManagerImpl final : public erpt::sf::IManager, public util::IntrusiveListBaseNode<ManagerImpl> {
|
class ManagerImpl final : public util::IntrusiveListBaseNode<ManagerImpl> {
|
||||||
private:
|
private:
|
||||||
os::SystemEvent system_event;
|
os::SystemEvent system_event;
|
||||||
public:
|
public:
|
||||||
|
@ -29,12 +29,13 @@ namespace ams::erpt::srv {
|
||||||
public:
|
public:
|
||||||
static Result NotifyAll();
|
static Result NotifyAll();
|
||||||
public:
|
public:
|
||||||
virtual Result GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter) override final;
|
Result GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter);
|
||||||
virtual Result GetEvent(ams::sf::OutCopyHandle out) override final;
|
Result GetEvent(ams::sf::OutCopyHandle out);
|
||||||
virtual Result CleanupReports() override final;
|
Result CleanupReports();
|
||||||
virtual Result DeleteReport(const ReportId &report_id) override final;
|
Result DeleteReport(const ReportId &report_id);
|
||||||
virtual Result GetStorageUsageStatistics(ams::sf::Out<StorageUsageStatistics> out) override final;
|
Result GetStorageUsageStatistics(ams::sf::Out<StorageUsageStatistics> out);
|
||||||
virtual Result GetAttachmentList(const ams::sf::OutBuffer &out_buf, const ReportId &report_id) override final;
|
Result GetAttachmentList(const ams::sf::OutBuffer &out_buf, const ReportId &report_id);
|
||||||
};
|
};
|
||||||
|
static_assert(erpt::sf::IsIManager<ManagerImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,19 +20,20 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
class Report;
|
class Report;
|
||||||
|
|
||||||
class ReportImpl final : public erpt::sf::IReport {
|
class ReportImpl final {
|
||||||
private:
|
private:
|
||||||
Report *report;
|
Report *report;
|
||||||
public:
|
public:
|
||||||
ReportImpl();
|
ReportImpl();
|
||||||
~ReportImpl();
|
~ReportImpl();
|
||||||
public:
|
public:
|
||||||
virtual Result Open(const ReportId &report_id) override final;
|
Result Open(const ReportId &report_id);
|
||||||
virtual Result Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) override final;
|
Result Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer);
|
||||||
virtual Result SetFlags(ReportFlagSet flags) override final;
|
Result SetFlags(ReportFlagSet flags);
|
||||||
virtual Result GetFlags(ams::sf::Out<ReportFlagSet> out) override final;
|
Result GetFlags(ams::sf::Out<ReportFlagSet> out);
|
||||||
virtual Result Close() override final;
|
Result Close();
|
||||||
virtual Result GetSize(ams::sf::Out<s64> out) override final;
|
Result GetSize(ams::sf::Out<s64> out);
|
||||||
};
|
};
|
||||||
|
static_assert(erpt::sf::IsIReport<ReportImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace ams::erpt::srv {
|
||||||
class ErrorReportServiceManager : public ams::sf::hipc::ServerManager<ErrorReportNumServers, ErrorReportServerOptions, ErrorReportMaxSessions> {
|
class ErrorReportServiceManager : public ams::sf::hipc::ServerManager<ErrorReportNumServers, ErrorReportServerOptions, ErrorReportMaxSessions> {
|
||||||
private:
|
private:
|
||||||
os::ThreadType thread;
|
os::ThreadType thread;
|
||||||
std::shared_ptr<erpt::srv::ContextImpl> context_session_object;
|
std::shared_ptr<erpt::sf::IContext> context_session_object;
|
||||||
private:
|
private:
|
||||||
static void ThreadFunction(void *_this) {
|
static void ThreadFunction(void *_this) {
|
||||||
reinterpret_cast<ErrorReportServiceManager *>(_this)->SetupAndLoopProcess();
|
reinterpret_cast<ErrorReportServiceManager *>(_this)->SetupAndLoopProcess();
|
||||||
|
@ -51,14 +51,14 @@ namespace ams::erpt::srv {
|
||||||
void SetupAndLoopProcess();
|
void SetupAndLoopProcess();
|
||||||
public:
|
public:
|
||||||
ErrorReportServiceManager(erpt::srv::ContextImpl *c)
|
ErrorReportServiceManager(erpt::srv::ContextImpl *c)
|
||||||
: context_session_object(ams::sf::ServiceObjectTraits<erpt::srv::ContextImpl>::SharedPointerHelper::GetEmptyDeleteSharedPointer(c))
|
: context_session_object(ams::sf::GetSharedPointerTo<erpt::sf::IContext, erpt::srv::ContextImpl>(c))
|
||||||
{
|
{
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Initialize() {
|
Result Initialize() {
|
||||||
R_ABORT_UNLESS(this->RegisterServer<erpt::srv::ContextImpl>(ErrorReportContextServiceName, ErrorReportContextSessions, this->context_session_object));
|
R_ABORT_UNLESS((this->RegisterServer<erpt::sf::IContext, erpt::srv::ContextImpl>(ErrorReportContextServiceName, ErrorReportContextSessions, this->context_session_object)));
|
||||||
R_ABORT_UNLESS(this->RegisterServer<erpt::srv::SessionImpl>(ErrorReportReportServiceName, ErrorReportReportSessions));
|
R_ABORT_UNLESS((this->RegisterServer<erpt::sf::ISession, erpt::srv::SessionImpl>(ErrorReportReportServiceName, ErrorReportReportSessions)));
|
||||||
|
|
||||||
this->ResumeProcessing();
|
this->ResumeProcessing();
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ namespace ams::erpt::srv {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
erpt::srv::ContextImpl g_context_object;
|
constinit erpt::srv::ContextImpl g_context_object;
|
||||||
ErrorReportServiceManager g_erpt_server_manager(std::addressof(g_context_object));
|
ErrorReportServiceManager g_erpt_server_manager(std::addressof(g_context_object));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,34 +21,34 @@
|
||||||
|
|
||||||
namespace ams::erpt::srv {
|
namespace ams::erpt::srv {
|
||||||
|
|
||||||
Result SessionImpl::OpenReport(ams::sf::Out<std::shared_ptr<erpt::sf::IReport>> out) {
|
namespace {
|
||||||
/* Create an interface. */
|
|
||||||
auto intf = std::shared_ptr<ReportImpl>(new (std::nothrow) ReportImpl);
|
|
||||||
R_UNLESS(intf != nullptr, erpt::ResultOutOfMemory());
|
|
||||||
|
|
||||||
/* Return it. */
|
template<typename Interface, typename Impl>
|
||||||
out.SetValue(std::move(intf));
|
ALWAYS_INLINE Result OpenInterface(ams::sf::Out<std::shared_ptr<Interface>> &out) {
|
||||||
return ResultSuccess();
|
/* Define holder type. */
|
||||||
|
using Holder = typename Interface::ImplHolder<Impl>;
|
||||||
|
|
||||||
|
/* Create an interface holder. */
|
||||||
|
auto intf = std::shared_ptr<Holder>(new (std::nothrow) Holder);
|
||||||
|
R_UNLESS(intf != nullptr, erpt::ResultOutOfMemory());
|
||||||
|
|
||||||
|
/* Return it. */
|
||||||
|
out.SetValue(std::move(intf));
|
||||||
|
return ResultSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Result SessionImpl::OpenReport(ams::sf::Out<std::shared_ptr<erpt::sf::IReport>> out) {
|
||||||
|
return OpenInterface<erpt::sf::IReport, ReportImpl>(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SessionImpl::OpenManager(ams::sf::Out<std::shared_ptr<erpt::sf::IManager>> out) {
|
Result SessionImpl::OpenManager(ams::sf::Out<std::shared_ptr<erpt::sf::IManager>> out) {
|
||||||
/* Create an interface. */
|
return OpenInterface<erpt::sf::IManager, ManagerImpl>(out);
|
||||||
auto intf = std::shared_ptr<ManagerImpl>(new (std::nothrow) ManagerImpl);
|
|
||||||
R_UNLESS(intf != nullptr, erpt::ResultOutOfMemory());
|
|
||||||
|
|
||||||
/* Return it. */
|
|
||||||
out.SetValue(std::move(intf));
|
|
||||||
return ResultSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SessionImpl::OpenAttachment(ams::sf::Out<std::shared_ptr<erpt::sf::IAttachment>> out) {
|
Result SessionImpl::OpenAttachment(ams::sf::Out<std::shared_ptr<erpt::sf::IAttachment>> out) {
|
||||||
/* Create an interface. */
|
return OpenInterface<erpt::sf::IAttachment, AttachmentImpl>(out);
|
||||||
auto intf = std::shared_ptr<AttachmentImpl>(new (std::nothrow) AttachmentImpl);
|
|
||||||
R_UNLESS(intf != nullptr, erpt::ResultOutOfMemory());
|
|
||||||
|
|
||||||
/* Return it. */
|
|
||||||
out.SetValue(std::move(intf));
|
|
||||||
return ResultSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,12 @@
|
||||||
|
|
||||||
namespace ams::erpt::srv {
|
namespace ams::erpt::srv {
|
||||||
|
|
||||||
class SessionImpl final : public erpt::sf::ISession {
|
class SessionImpl final {
|
||||||
public:
|
public:
|
||||||
virtual Result OpenReport(ams::sf::Out<std::shared_ptr<erpt::sf::IReport>> out) override final;
|
Result OpenReport(ams::sf::Out<std::shared_ptr<erpt::sf::IReport>> out);
|
||||||
virtual Result OpenManager(ams::sf::Out<std::shared_ptr<erpt::sf::IManager>> out) override final;
|
Result OpenManager(ams::sf::Out<std::shared_ptr<erpt::sf::IManager>> out);
|
||||||
virtual Result OpenAttachment(ams::sf::Out<std::shared_ptr<erpt::sf::IAttachment>> out) override final;
|
Result OpenAttachment(ams::sf::Out<std::shared_ptr<erpt::sf::IAttachment>> out);
|
||||||
};
|
};
|
||||||
|
static_assert(erpt::sf::IsISession<SessionImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ namespace ams::fs {
|
||||||
/* Get the space size. */
|
/* Get the space size. */
|
||||||
auto get_size_impl = [&]() -> Result {
|
auto get_size_impl = [&]() -> Result {
|
||||||
R_UNLESS(sub_path == nullptr || std::strcmp(sub_path, "/") == 0, fs::ResultInvalidMountName());
|
R_UNLESS(sub_path == nullptr || std::strcmp(sub_path, "/") == 0, fs::ResultInvalidMountName());
|
||||||
R_TRY(accessor->GetFreeSpaceSize(out, path));
|
R_TRY(accessor->GetFreeSpaceSize(out, "/"));
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ namespace ams::fs {
|
||||||
/* Get the space size. */
|
/* Get the space size. */
|
||||||
auto get_size_impl = [&]() -> Result {
|
auto get_size_impl = [&]() -> Result {
|
||||||
R_UNLESS(sub_path == nullptr || std::strcmp(sub_path, "/") == 0, fs::ResultInvalidMountName());
|
R_UNLESS(sub_path == nullptr || std::strcmp(sub_path, "/") == 0, fs::ResultInvalidMountName());
|
||||||
R_TRY(accessor->GetTotalSpaceSize(out, path));
|
R_TRY(accessor->GetTotalSpaceSize(out, "/"));
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ namespace ams::fssrv::impl {
|
||||||
return this->base_fs->GetEntryType(reinterpret_cast<fs::DirectoryEntryType *>(out.GetPointer()), normalizer.GetPath());
|
return this->base_fs->GetEntryType(reinterpret_cast<fs::DirectoryEntryType *>(out.GetPointer()), normalizer.GetPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FileSystemInterfaceAdapter::OpenFile(ams::sf::Out<std::shared_ptr<FileInterfaceAdapter>> out, const fssrv::sf::Path &path, u32 mode) {
|
Result FileSystemInterfaceAdapter::OpenFile(ams::sf::Out<std::shared_ptr<fssrv::sf::IFile>> out, const fssrv::sf::Path &path, u32 mode) {
|
||||||
auto read_lock = this->AcquireCacheInvalidationReadLock();
|
auto read_lock = this->AcquireCacheInvalidationReadLock();
|
||||||
|
|
||||||
std::unique_lock<fssystem::SemaphoreAdapter> open_count_semaphore;
|
std::unique_lock<fssystem::SemaphoreAdapter> open_count_semaphore;
|
||||||
|
@ -254,14 +254,14 @@ namespace ams::fssrv::impl {
|
||||||
/* TODO: N creates an nn::fssystem::AsynchronousAccessFile here. */
|
/* TODO: N creates an nn::fssystem::AsynchronousAccessFile here. */
|
||||||
|
|
||||||
std::shared_ptr<FileSystemInterfaceAdapter> shared_this = this->shared_from_this();
|
std::shared_ptr<FileSystemInterfaceAdapter> shared_this = this->shared_from_this();
|
||||||
std::shared_ptr<FileInterfaceAdapter> file_intf = std::make_shared<FileInterfaceAdapter>(std::move(file), std::move(shared_this), std::move(open_count_semaphore));
|
auto file_intf = ams::sf::MakeShared<fssrv::sf::IFile, FileInterfaceAdapter>(std::move(file), std::move(shared_this), std::move(open_count_semaphore));
|
||||||
R_UNLESS(file_intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter());
|
R_UNLESS(file_intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter());
|
||||||
|
|
||||||
out.SetValue(std::move(file_intf), target_object_id);
|
out.SetValue(std::move(file_intf), target_object_id);
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FileSystemInterfaceAdapter::OpenDirectory(ams::sf::Out<std::shared_ptr<DirectoryInterfaceAdapter>> out, const fssrv::sf::Path &path, u32 mode) {
|
Result FileSystemInterfaceAdapter::OpenDirectory(ams::sf::Out<std::shared_ptr<fssrv::sf::IDirectory>> out, const fssrv::sf::Path &path, u32 mode) {
|
||||||
auto read_lock = this->AcquireCacheInvalidationReadLock();
|
auto read_lock = this->AcquireCacheInvalidationReadLock();
|
||||||
|
|
||||||
std::unique_lock<fssystem::SemaphoreAdapter> open_count_semaphore;
|
std::unique_lock<fssystem::SemaphoreAdapter> open_count_semaphore;
|
||||||
|
@ -281,7 +281,7 @@ namespace ams::fssrv::impl {
|
||||||
const auto target_object_id = dir->GetDomainObjectId();
|
const auto target_object_id = dir->GetDomainObjectId();
|
||||||
|
|
||||||
std::shared_ptr<FileSystemInterfaceAdapter> shared_this = this->shared_from_this();
|
std::shared_ptr<FileSystemInterfaceAdapter> shared_this = this->shared_from_this();
|
||||||
std::shared_ptr<DirectoryInterfaceAdapter> dir_intf = std::make_shared<DirectoryInterfaceAdapter>(std::move(dir), std::move(shared_this), std::move(open_count_semaphore));
|
auto dir_intf = ams::sf::MakeShared<fssrv::sf::IDirectory, DirectoryInterfaceAdapter>(std::move(dir), std::move(shared_this), std::move(open_count_semaphore));
|
||||||
R_UNLESS(dir_intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter());
|
R_UNLESS(dir_intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter());
|
||||||
|
|
||||||
out.SetValue(std::move(dir_intf), target_object_id);
|
out.SetValue(std::move(dir_intf), target_object_id);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace ams::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
class AddOnContentLocationResolverImpl : public IAddOnContentLocationResolver {
|
class AddOnContentLocationResolverImpl {
|
||||||
private:
|
private:
|
||||||
/* Storage for RegisteredData entries by data id. */
|
/* Storage for RegisteredData entries by data id. */
|
||||||
RegisteredStorages<ncm::DataId, 0x800> registered_storages;
|
RegisteredStorages<ncm::DataId, 0x800> registered_storages;
|
||||||
|
@ -29,12 +29,13 @@ namespace ams::lr {
|
||||||
AddOnContentLocationResolverImpl() : registered_storages(hos::GetVersion() < hos::Version_9_0_0 ? 0x800 : 0x2) { /* ... */ }
|
AddOnContentLocationResolverImpl() : registered_storages(hos::GetVersion() < hos::Version_9_0_0 ? 0x800 : 0x2) { /* ... */ }
|
||||||
|
|
||||||
/* Actual commands. */
|
/* Actual commands. */
|
||||||
virtual Result ResolveAddOnContentPath(sf::Out<Path> out, ncm::DataId id) override;
|
Result ResolveAddOnContentPath(sf::Out<Path> out, ncm::DataId id);
|
||||||
virtual Result RegisterAddOnContentStorageDeprecated(ncm::DataId id, ncm::StorageId storage_id) override;
|
Result RegisterAddOnContentStorageDeprecated(ncm::DataId id, ncm::StorageId storage_id);
|
||||||
virtual Result RegisterAddOnContentStorage(ncm::DataId id, ncm::ApplicationId application_id, ncm::StorageId storage_id) override;
|
Result RegisterAddOnContentStorage(ncm::DataId id, ncm::ApplicationId application_id, ncm::StorageId storage_id);
|
||||||
virtual Result UnregisterAllAddOnContentPath() override;
|
Result UnregisterAllAddOnContentPath();
|
||||||
virtual Result RefreshApplicationAddOnContent(const sf::InArray<ncm::ApplicationId> &ids) override;
|
Result RefreshApplicationAddOnContent(const sf::InArray<ncm::ApplicationId> &ids);
|
||||||
virtual Result UnregisterApplicationAddOnContent(ncm::ApplicationId id) override;
|
Result UnregisterApplicationAddOnContent(ncm::ApplicationId id);
|
||||||
};
|
};
|
||||||
|
static_assert(lr::IsIAddOnContentLocationResolver<AddOnContentLocationResolverImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace ams::lr {
|
||||||
LrLocationResolver lr;
|
LrLocationResolver lr;
|
||||||
R_TRY(lrOpenLocationResolver(static_cast<NcmStorageId>(storage_id), std::addressof(lr)));
|
R_TRY(lrOpenLocationResolver(static_cast<NcmStorageId>(storage_id), std::addressof(lr)));
|
||||||
|
|
||||||
*out = LocationResolver(std::make_shared<RemoteLocationResolverImpl>(lr));
|
*out = LocationResolver(sf::MakeShared<ILocationResolver, RemoteLocationResolverImpl>(lr));
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace ams::lr {
|
||||||
LrRegisteredLocationResolver lr;
|
LrRegisteredLocationResolver lr;
|
||||||
R_TRY(lrOpenRegisteredLocationResolver(std::addressof(lr)));
|
R_TRY(lrOpenRegisteredLocationResolver(std::addressof(lr)));
|
||||||
|
|
||||||
*out = RegisteredLocationResolver(std::make_shared<RemoteRegisteredLocationResolverImpl>(lr));
|
*out = RegisteredLocationResolver(sf::MakeShared<IRegisteredLocationResolver, RemoteRegisteredLocationResolverImpl>(lr));
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,32 +35,33 @@ namespace ams::lr {
|
||||||
void GetContentStoragePath(Path *out, ncm::ContentId content_id);
|
void GetContentStoragePath(Path *out, ncm::ContentId content_id);
|
||||||
public:
|
public:
|
||||||
/* Actual commands. */
|
/* Actual commands. */
|
||||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id) override;
|
Result RedirectProgramPath(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id) override;
|
Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id);
|
||||||
virtual Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result Refresh() override;
|
Result Refresh();
|
||||||
virtual Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result ClearApplicationRedirectionDeprecated() override;
|
Result ClearApplicationRedirectionDeprecated();
|
||||||
virtual Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids) override;
|
Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids);
|
||||||
virtual Result EraseProgramRedirection(ncm::ProgramId id) override;
|
Result EraseProgramRedirection(ncm::ProgramId id);
|
||||||
virtual Result EraseApplicationControlRedirection(ncm::ProgramId id) override;
|
Result EraseApplicationControlRedirection(ncm::ProgramId id);
|
||||||
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) override;
|
Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id);
|
||||||
virtual Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) override;
|
Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id);
|
||||||
virtual Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) override;
|
Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result EraseProgramRedirectionForDebug(ncm::ProgramId id) override;
|
Result EraseProgramRedirectionForDebug(ncm::ProgramId id);
|
||||||
};
|
};
|
||||||
|
static_assert(lr::IsILocationResolver<ContentLocationResolverImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
namespace ams::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
class LocationResolverImplBase : public ILocationResolver {
|
class LocationResolverImplBase {
|
||||||
NON_COPYABLE(LocationResolverImplBase);
|
NON_COPYABLE(LocationResolverImplBase);
|
||||||
NON_MOVEABLE(LocationResolverImplBase);
|
NON_MOVEABLE(LocationResolverImplBase);
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -30,10 +30,10 @@ namespace ams::lr {
|
||||||
/* No existing resolver is present, create one. */
|
/* No existing resolver is present, create one. */
|
||||||
if (!resolver) {
|
if (!resolver) {
|
||||||
if (storage_id == ncm::StorageId::Host) {
|
if (storage_id == ncm::StorageId::Host) {
|
||||||
AMS_ABORT_UNLESS(this->location_resolvers.Insert(storage_id, std::make_shared<RedirectOnlyLocationResolverImpl>()));
|
AMS_ABORT_UNLESS(this->location_resolvers.Insert(storage_id, sf::MakeShared<ILocationResolver, RedirectOnlyLocationResolverImpl>()));
|
||||||
} else {
|
} else {
|
||||||
auto content_resolver = std::make_shared<ContentLocationResolverImpl>(storage_id);
|
auto content_resolver = sf::MakeShared<ILocationResolver, ContentLocationResolverImpl>(storage_id);
|
||||||
R_TRY(content_resolver->Refresh());
|
R_TRY(content_resolver->GetImpl().Refresh());
|
||||||
AMS_ABORT_UNLESS(this->location_resolvers.Insert(storage_id, std::move(content_resolver)));
|
AMS_ABORT_UNLESS(this->location_resolvers.Insert(storage_id, std::move(content_resolver)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace ams::lr {
|
||||||
|
|
||||||
/* No existing resolver is present, create one. */
|
/* No existing resolver is present, create one. */
|
||||||
if (!this->registered_location_resolver) {
|
if (!this->registered_location_resolver) {
|
||||||
this->registered_location_resolver = std::make_shared<RegisteredLocationResolverImpl>();
|
this->registered_location_resolver = sf::MakeShared<IRegisteredLocationResolver, RegisteredLocationResolverImpl>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the output interface. */
|
/* Copy the output interface. */
|
||||||
|
@ -79,7 +79,7 @@ namespace ams::lr {
|
||||||
|
|
||||||
/* No existing resolver is present, create one. */
|
/* No existing resolver is present, create one. */
|
||||||
if (!this->add_on_content_location_resolver) {
|
if (!this->add_on_content_location_resolver) {
|
||||||
this->add_on_content_location_resolver = std::make_shared<AddOnContentLocationResolverImpl>();
|
this->add_on_content_location_resolver = sf::MakeShared<IAddOnContentLocationResolver, AddOnContentLocationResolverImpl>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the output interface. */
|
/* Copy the output interface. */
|
||||||
|
|
|
@ -24,32 +24,33 @@ namespace ams::lr {
|
||||||
~RedirectOnlyLocationResolverImpl();
|
~RedirectOnlyLocationResolverImpl();
|
||||||
public:
|
public:
|
||||||
/* Actual commands. */
|
/* Actual commands. */
|
||||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id) override;
|
Result RedirectProgramPath(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id) override;
|
Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id);
|
||||||
virtual Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result Refresh() override;
|
Result Refresh();
|
||||||
virtual Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result ClearApplicationRedirectionDeprecated() override;
|
Result ClearApplicationRedirectionDeprecated();
|
||||||
virtual Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids) override;
|
Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids);
|
||||||
virtual Result EraseProgramRedirection(ncm::ProgramId id) override;
|
Result EraseProgramRedirection(ncm::ProgramId id);
|
||||||
virtual Result EraseApplicationControlRedirection(ncm::ProgramId id) override;
|
Result EraseApplicationControlRedirection(ncm::ProgramId id);
|
||||||
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) override;
|
Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id);
|
||||||
virtual Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) override;
|
Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id);
|
||||||
virtual Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) override;
|
Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result EraseProgramRedirectionForDebug(ncm::ProgramId id) override;
|
Result EraseProgramRedirectionForDebug(ncm::ProgramId id);
|
||||||
};
|
};
|
||||||
|
static_assert(lr::IsILocationResolver<RedirectOnlyLocationResolverImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace ams::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
class RegisteredLocationResolverImpl : public IRegisteredLocationResolver {
|
class RegisteredLocationResolverImpl {
|
||||||
private:
|
private:
|
||||||
static constexpr size_t MaxRegisteredLocationsDeprecated = 0x10;
|
static constexpr size_t MaxRegisteredLocationsDeprecated = 0x10;
|
||||||
static constexpr size_t MaxRegisteredLocations = 0x20;
|
static constexpr size_t MaxRegisteredLocations = 0x20;
|
||||||
|
@ -49,20 +49,21 @@ namespace ams::lr {
|
||||||
~RegisteredLocationResolverImpl();
|
~RegisteredLocationResolverImpl();
|
||||||
public:
|
public:
|
||||||
/* Actual commands. */
|
/* Actual commands. */
|
||||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result RegisterProgramPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RegisterProgramPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RegisterProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RegisterProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result UnregisterProgramPath(ncm::ProgramId id) override;
|
Result UnregisterProgramPath(ncm::ProgramId id);
|
||||||
virtual Result RedirectProgramPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectProgramPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result ResolveHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
Result ResolveHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||||
virtual Result RegisterHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RegisterHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RegisterHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RegisterHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result UnregisterHtmlDocumentPath(ncm::ProgramId id) override;
|
Result UnregisterHtmlDocumentPath(ncm::ProgramId id);
|
||||||
virtual Result RedirectHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
Result RedirectHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||||
virtual Result RedirectHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
Result RedirectHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||||
virtual Result Refresh() override;
|
Result Refresh();
|
||||||
virtual Result RefreshExcluding(const sf::InArray<ncm::ProgramId> &ids) override;
|
Result RefreshExcluding(const sf::InArray<ncm::ProgramId> &ids);
|
||||||
};
|
};
|
||||||
|
static_assert(lr::IsIRegisteredLocationResolver<RegisteredLocationResolverImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
namespace ams::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
class RemoteLocationResolverImpl : public ILocationResolver {
|
class RemoteLocationResolverImpl {
|
||||||
private:
|
private:
|
||||||
::LrLocationResolver srv;
|
::LrLocationResolver srv;
|
||||||
public:
|
public:
|
||||||
|
@ -27,121 +27,122 @@ namespace ams::lr {
|
||||||
~RemoteLocationResolverImpl() { ::serviceClose(&srv.s); }
|
~RemoteLocationResolverImpl() { ::serviceClose(&srv.s); }
|
||||||
public:
|
public:
|
||||||
/* Actual commands. */
|
/* Actual commands. */
|
||||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||||
return lrLrResolveProgramPath(std::addressof(this->srv), id.value, out->str);
|
return ::lrLrResolveProgramPath(std::addressof(this->srv), id.value, out->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id) override {
|
Result RedirectProgramPath(const Path &path, ncm::ProgramId id) {
|
||||||
return lrLrRedirectProgramPath(std::addressof(this->srv), id.value, path.str);
|
return ::lrLrRedirectProgramPath(std::addressof(this->srv), id.value, path.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||||
return lrLrResolveApplicationControlPath(std::addressof(this->srv), id.value, out->str);
|
return ::lrLrResolveApplicationControlPath(std::addressof(this->srv), id.value, out->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||||
return lrLrResolveApplicationHtmlDocumentPath(std::addressof(this->srv), id.value, out->str);
|
return ::lrLrResolveApplicationHtmlDocumentPath(std::addressof(this->srv), id.value, out->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id) override {
|
Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id) {
|
||||||
return lrLrResolveDataPath(std::addressof(this->srv), id.value, out->str);
|
return ::lrLrResolveDataPath(std::addressof(this->srv), id.value, out->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||||
return lrLrRedirectApplicationControlPath(std::addressof(this->srv), id.value, 0, path.str);
|
return ::lrLrRedirectApplicationControlPath(std::addressof(this->srv), id.value, 0, path.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override {
|
Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||||
return lrLrRedirectApplicationControlPath(std::addressof(this->srv), id.value, owner_id.value, path.str);
|
return ::lrLrRedirectApplicationControlPath(std::addressof(this->srv), id.value, owner_id.value, path.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||||
return lrLrRedirectApplicationHtmlDocumentPath(std::addressof(this->srv), id.value, 0, path.str);
|
return ::lrLrRedirectApplicationHtmlDocumentPath(std::addressof(this->srv), id.value, 0, path.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override {
|
Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||||
return lrLrRedirectApplicationHtmlDocumentPath(std::addressof(this->srv), id.value, owner_id.value, path.str);
|
return ::lrLrRedirectApplicationHtmlDocumentPath(std::addressof(this->srv), id.value, owner_id.value, path.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||||
return lrLrResolveApplicationLegalInformationPath(std::addressof(this->srv), id.value, out->str);
|
return ::lrLrResolveApplicationLegalInformationPath(std::addressof(this->srv), id.value, out->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||||
return lrLrRedirectApplicationLegalInformationPath(std::addressof(this->srv), id.value, 0, path.str);
|
return ::lrLrRedirectApplicationLegalInformationPath(std::addressof(this->srv), id.value, 0, path.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override {
|
Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||||
return lrLrRedirectApplicationLegalInformationPath(std::addressof(this->srv), id.value, owner_id.value, path.str);
|
return ::lrLrRedirectApplicationLegalInformationPath(std::addressof(this->srv), id.value, owner_id.value, path.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Refresh() override {
|
Result Refresh() {
|
||||||
return lrLrRefresh(std::addressof(this->srv));
|
return ::lrLrRefresh(std::addressof(this->srv));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override {
|
Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ClearApplicationRedirectionDeprecated() override {
|
Result ClearApplicationRedirectionDeprecated() {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids) override {
|
Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result EraseProgramRedirection(ncm::ProgramId id) override {
|
Result EraseProgramRedirection(ncm::ProgramId id) {
|
||||||
return lrLrEraseProgramRedirection(std::addressof(this->srv), id.value);
|
return ::lrLrEraseProgramRedirection(std::addressof(this->srv), id.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result EraseApplicationControlRedirection(ncm::ProgramId id) override {
|
Result EraseApplicationControlRedirection(ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) override {
|
Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) override {
|
Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id) override {
|
Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) override {
|
Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) override {
|
Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override {
|
Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result EraseProgramRedirectionForDebug(ncm::ProgramId id) override {
|
Result EraseProgramRedirectionForDebug(ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
static_assert(lr::IsILocationResolver<RemoteLocationResolverImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
namespace ams::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
class RemoteRegisteredLocationResolverImpl : public IRegisteredLocationResolver {
|
class RemoteRegisteredLocationResolverImpl {
|
||||||
private:
|
private:
|
||||||
::LrRegisteredLocationResolver srv;
|
::LrRegisteredLocationResolver srv;
|
||||||
public:
|
public:
|
||||||
|
@ -28,74 +28,75 @@ namespace ams::lr {
|
||||||
~RemoteRegisteredLocationResolverImpl() { ::serviceClose(&srv.s); }
|
~RemoteRegisteredLocationResolverImpl() { ::serviceClose(&srv.s); }
|
||||||
public:
|
public:
|
||||||
/* Actual commands. */
|
/* Actual commands. */
|
||||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||||
return lrRegLrResolveProgramPath(std::addressof(this->srv), static_cast<u64>(id), out->str);
|
return ::lrRegLrResolveProgramPath(std::addressof(this->srv), static_cast<u64>(id), out->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RegisterProgramPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
Result RegisterProgramPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RegisterProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override {
|
Result RegisterProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result UnregisterProgramPath(ncm::ProgramId id) override {
|
Result UnregisterProgramPath(ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectProgramPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
Result RedirectProgramPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override {
|
Result RedirectProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ResolveHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
Result ResolveHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RegisterHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
Result RegisterHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RegisterHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override {
|
Result RegisterHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result UnregisterHtmlDocumentPath(ncm::ProgramId id) override {
|
Result UnregisterHtmlDocumentPath(ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
Result RedirectHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RedirectHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override {
|
Result RedirectHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Refresh() override {
|
Result Refresh() {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result RefreshExcluding(const sf::InArray<ncm::ProgramId> &ids) override {
|
Result RefreshExcluding(const sf::InArray<ncm::ProgramId> &ids) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
static_assert(lr::IsIRegisteredLocationResolver<RemoteRegisteredLocationResolverImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace ams::ncm {
|
||||||
void Initialize() {
|
void Initialize() {
|
||||||
AMS_ASSERT(g_content_manager == nullptr);
|
AMS_ASSERT(g_content_manager == nullptr);
|
||||||
R_ABORT_UNLESS(ncmInitialize());
|
R_ABORT_UNLESS(ncmInitialize());
|
||||||
g_content_manager = std::make_shared<RemoteContentManagerImpl>();
|
g_content_manager = sf::MakeShared<IContentManager, RemoteContentManagerImpl>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Finalize() {
|
void Finalize() {
|
||||||
|
|
|
@ -553,23 +553,23 @@ namespace ams::ncm {
|
||||||
|
|
||||||
if (storage_id == StorageId::GameCard) {
|
if (storage_id == StorageId::GameCard) {
|
||||||
/* Game card content storage is read only. */
|
/* Game card content storage is read only. */
|
||||||
auto content_storage = std::make_shared<ReadOnlyContentStorageImpl>();
|
auto content_storage = sf::MakeShared<IContentStorage, ReadOnlyContentStorageImpl>();
|
||||||
R_TRY(content_storage->Initialize(root->path, MakeFlatContentFilePath));
|
R_TRY(content_storage->GetImpl().Initialize(root->path, MakeFlatContentFilePath));
|
||||||
root->content_storage = std::move(content_storage);
|
root->content_storage = std::move(content_storage);
|
||||||
} else {
|
} else {
|
||||||
/* Create a content storage. */
|
/* Create a content storage. */
|
||||||
auto content_storage = std::make_shared<ContentStorageImpl>();
|
auto content_storage = sf::MakeShared<IContentStorage, ContentStorageImpl>();
|
||||||
|
|
||||||
/* Initialize content storage with an appropriate path function. */
|
/* Initialize content storage with an appropriate path function. */
|
||||||
switch (storage_id) {
|
switch (storage_id) {
|
||||||
case StorageId::BuiltInSystem:
|
case StorageId::BuiltInSystem:
|
||||||
R_TRY(content_storage->Initialize(root->path, MakeFlatContentFilePath, MakeFlatPlaceHolderFilePath, false, std::addressof(this->rights_id_cache)));
|
R_TRY(content_storage->GetImpl().Initialize(root->path, MakeFlatContentFilePath, MakeFlatPlaceHolderFilePath, false, std::addressof(this->rights_id_cache)));
|
||||||
break;
|
break;
|
||||||
case StorageId::SdCard:
|
case StorageId::SdCard:
|
||||||
R_TRY(content_storage->Initialize(root->path, MakeSha256HierarchicalContentFilePath_ForFat16KCluster, MakeSha256HierarchicalPlaceHolderFilePath_ForFat16KCluster, true, std::addressof(this->rights_id_cache)));
|
R_TRY(content_storage->GetImpl().Initialize(root->path, MakeSha256HierarchicalContentFilePath_ForFat16KCluster, MakeSha256HierarchicalPlaceHolderFilePath_ForFat16KCluster, true, std::addressof(this->rights_id_cache)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
R_TRY(content_storage->Initialize(root->path, MakeSha256HierarchicalContentFilePath_ForFat16KCluster, MakeSha256HierarchicalPlaceHolderFilePath_ForFat16KCluster, false, std::addressof(this->rights_id_cache)));
|
R_TRY(content_storage->GetImpl().Initialize(root->path, MakeSha256HierarchicalContentFilePath_ForFat16KCluster, MakeSha256HierarchicalPlaceHolderFilePath_ForFat16KCluster, false, std::addressof(this->rights_id_cache)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,7 +617,7 @@ namespace ams::ncm {
|
||||||
R_TRY(root->kvs->Initialize(root->max_content_metas, root->memory_resource));
|
R_TRY(root->kvs->Initialize(root->max_content_metas, root->memory_resource));
|
||||||
|
|
||||||
/* Create an on memory content meta database for game cards. */
|
/* Create an on memory content meta database for game cards. */
|
||||||
root->content_meta_database = std::make_shared<OnMemoryContentMetaDatabaseImpl>(std::addressof(*root->kvs));
|
root->content_meta_database = sf::MakeShared<IContentMetaDatabase, OnMemoryContentMetaDatabaseImpl>(std::addressof(*root->kvs));
|
||||||
} else {
|
} else {
|
||||||
/* Mount save data for this root. */
|
/* Mount save data for this root. */
|
||||||
R_TRY(fs::MountSystemSaveData(root->mount_name, root->info.space_id, root->info.id));
|
R_TRY(fs::MountSystemSaveData(root->mount_name, root->info.space_id, root->info.id));
|
||||||
|
@ -630,7 +630,7 @@ namespace ams::ncm {
|
||||||
R_TRY(root->kvs->Load());
|
R_TRY(root->kvs->Load());
|
||||||
|
|
||||||
/* Create the content meta database. */
|
/* Create the content meta database. */
|
||||||
root->content_meta_database = std::make_shared<ContentMetaDatabaseImpl>(std::addressof(*root->kvs), root->mount_name);
|
root->content_meta_database = sf::MakeShared<IContentMetaDatabase, ContentMetaDatabaseImpl>(std::addressof(*root->kvs), root->mount_name);
|
||||||
mount_guard.Cancel();
|
mount_guard.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
namespace ams::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
class ContentMetaDatabaseImplBase : public IContentMetaDatabase {
|
class ContentMetaDatabaseImplBase {
|
||||||
NON_COPYABLE(ContentMetaDatabaseImplBase);
|
NON_COPYABLE(ContentMetaDatabaseImplBase);
|
||||||
NON_MOVEABLE(ContentMetaDatabaseImplBase);
|
NON_MOVEABLE(ContentMetaDatabaseImplBase);
|
||||||
protected:
|
protected:
|
||||||
|
@ -52,6 +52,32 @@ namespace ams::ncm {
|
||||||
R_TRY(this->GetContentMetaSize(out_size, key));
|
R_TRY(this->GetContentMetaSize(out_size, key));
|
||||||
return this->kvs->GetValuePointer(reinterpret_cast<const ContentMetaHeader **>(out_value_ptr), key);
|
return this->kvs->GetValuePointer(reinterpret_cast<const ContentMetaHeader **>(out_value_ptr), key);
|
||||||
}
|
}
|
||||||
|
public:
|
||||||
|
/* Actual commands. */
|
||||||
|
virtual Result Set(const ContentMetaKey &key, sf::InBuffer value) = 0;
|
||||||
|
virtual Result Get(sf::Out<u64> out_size, const ContentMetaKey &key, sf::OutBuffer out_value) = 0;
|
||||||
|
virtual Result Remove(const ContentMetaKey &key) = 0;
|
||||||
|
virtual Result GetContentIdByType(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type) = 0;
|
||||||
|
virtual Result ListContentInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentInfo> &out_info, const ContentMetaKey &key, s32 offset) = 0;
|
||||||
|
virtual Result List(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaKey> &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type) = 0;
|
||||||
|
virtual Result GetLatestContentMetaKey(sf::Out<ContentMetaKey> out_key, u64 id) = 0;
|
||||||
|
virtual Result ListApplication(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ApplicationContentMetaKey> &out_keys, ContentMetaType meta_type) = 0;
|
||||||
|
virtual Result Has(sf::Out<bool> out, const ContentMetaKey &key) = 0;
|
||||||
|
virtual Result HasAll(sf::Out<bool> out, const sf::InArray<ContentMetaKey> &keys) = 0;
|
||||||
|
virtual Result GetSize(sf::Out<u64> out_size, const ContentMetaKey &key) = 0;
|
||||||
|
virtual Result GetRequiredSystemVersion(sf::Out<u32> out_version, const ContentMetaKey &key) = 0;
|
||||||
|
virtual Result GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) = 0;
|
||||||
|
virtual Result DisableForcibly() = 0;
|
||||||
|
virtual Result LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) = 0;
|
||||||
|
virtual Result Commit() = 0;
|
||||||
|
virtual Result HasContent(sf::Out<bool> out, const ContentMetaKey &key, const ContentId &content_id) = 0;
|
||||||
|
virtual Result ListContentMetaInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaInfo> &out_meta_info, const ContentMetaKey &key, s32 offset) = 0;
|
||||||
|
virtual Result GetAttributes(sf::Out<u8> out_attributes, const ContentMetaKey &key) = 0;
|
||||||
|
virtual Result GetRequiredApplicationVersion(sf::Out<u32> out_version, const ContentMetaKey &key) = 0;
|
||||||
|
virtual Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) = 0;
|
||||||
|
virtual Result GetCount(sf::Out<u32> out_count) = 0;
|
||||||
|
virtual Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) = 0;
|
||||||
};
|
};
|
||||||
|
static_assert(ncm::IsIContentMetaDatabase<ContentMetaDatabaseImplBase>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
namespace ams::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
class ContentStorageImplBase : public IContentStorage {
|
class ContentStorageImplBase {
|
||||||
NON_COPYABLE(ContentStorageImplBase);
|
NON_COPYABLE(ContentStorageImplBase);
|
||||||
NON_MOVEABLE(ContentStorageImplBase);
|
NON_MOVEABLE(ContentStorageImplBase);
|
||||||
protected:
|
protected:
|
||||||
|
@ -43,6 +43,39 @@ namespace ams::ncm {
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
public:
|
||||||
|
/* Actual commands. */
|
||||||
|
virtual Result GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) = 0;
|
||||||
|
virtual Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) = 0;
|
||||||
|
virtual Result DeletePlaceHolder(PlaceHolderId placeholder_id) = 0;
|
||||||
|
virtual Result HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) = 0;
|
||||||
|
virtual Result WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, sf::InBuffer data) = 0;
|
||||||
|
virtual Result Register(PlaceHolderId placeholder_id, ContentId content_id) = 0;
|
||||||
|
virtual Result Delete(ContentId content_id) = 0;
|
||||||
|
virtual Result Has(sf::Out<bool> out, ContentId content_id) = 0;
|
||||||
|
virtual Result GetPath(sf::Out<Path> out, ContentId content_id) = 0;
|
||||||
|
virtual Result GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) = 0;
|
||||||
|
virtual Result CleanupAllPlaceHolder() = 0;
|
||||||
|
virtual Result ListPlaceHolder(sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf) = 0;
|
||||||
|
virtual Result GetContentCount(sf::Out<s32> out_count) = 0;
|
||||||
|
virtual Result ListContentId(sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 start_offset) = 0;
|
||||||
|
virtual Result GetSizeFromContentId(sf::Out<s64> out_size, ContentId content_id) = 0;
|
||||||
|
virtual Result DisableForcibly() = 0;
|
||||||
|
virtual Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) = 0;
|
||||||
|
virtual Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) = 0;
|
||||||
|
virtual Result ReadContentIdFile(sf::OutBuffer buf, ContentId content_id, s64 offset) = 0;
|
||||||
|
virtual Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) = 0;
|
||||||
|
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) = 0;
|
||||||
|
virtual Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) = 0;
|
||||||
|
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) = 0;
|
||||||
|
virtual Result WriteContentForDebug(ContentId content_id, s64 offset, sf::InBuffer data) = 0;
|
||||||
|
virtual Result GetFreeSpaceSize(sf::Out<s64> out_size) = 0;
|
||||||
|
virtual Result GetTotalSpaceSize(sf::Out<s64> out_size) = 0;
|
||||||
|
virtual Result FlushPlaceHolder() = 0;
|
||||||
|
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) = 0;
|
||||||
|
virtual Result RepairInvalidFileAttribute() = 0;
|
||||||
|
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) = 0;
|
||||||
};
|
};
|
||||||
|
static_assert(ncm::IsIContentStorage<ContentStorageImplBase>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,80 +20,81 @@
|
||||||
|
|
||||||
namespace ams::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
class RemoteContentManagerImpl final : public IContentManager {
|
class RemoteContentManagerImpl final {
|
||||||
public:
|
public:
|
||||||
RemoteContentManagerImpl() { /* ... */ }
|
RemoteContentManagerImpl() { /* ... */ }
|
||||||
|
|
||||||
~RemoteContentManagerImpl() { /* ... */ }
|
~RemoteContentManagerImpl() { /* ... */ }
|
||||||
public:
|
public:
|
||||||
virtual Result CreateContentStorage(StorageId storage_id) override {
|
Result CreateContentStorage(StorageId storage_id) {
|
||||||
return ::ncmCreateContentStorage(static_cast<NcmStorageId>(storage_id));
|
return ::ncmCreateContentStorage(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result CreateContentMetaDatabase(StorageId storage_id) override {
|
Result CreateContentMetaDatabase(StorageId storage_id) {
|
||||||
return ::ncmCreateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
return ::ncmCreateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result VerifyContentStorage(StorageId storage_id) override {
|
Result VerifyContentStorage(StorageId storage_id) {
|
||||||
return ::ncmVerifyContentStorage(static_cast<NcmStorageId>(storage_id));
|
return ::ncmVerifyContentStorage(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result VerifyContentMetaDatabase(StorageId storage_id) override {
|
Result VerifyContentMetaDatabase(StorageId storage_id) {
|
||||||
return ::ncmVerifyContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
return ::ncmVerifyContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result OpenContentStorage(sf::Out<std::shared_ptr<IContentStorage>> out, StorageId storage_id) override {
|
Result OpenContentStorage(sf::Out<std::shared_ptr<IContentStorage>> out, StorageId storage_id) {
|
||||||
NcmContentStorage cs;
|
NcmContentStorage cs;
|
||||||
R_TRY(::ncmOpenContentStorage(std::addressof(cs), static_cast<NcmStorageId>(storage_id)));
|
R_TRY(::ncmOpenContentStorage(std::addressof(cs), static_cast<NcmStorageId>(storage_id)));
|
||||||
|
|
||||||
out.SetValue(std::make_shared<RemoteContentStorageImpl>(cs));
|
out.SetValue(sf::MakeShared<IContentStorage, RemoteContentStorageImpl>(cs));
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result OpenContentMetaDatabase(sf::Out<std::shared_ptr<IContentMetaDatabase>> out, StorageId storage_id) override {
|
Result OpenContentMetaDatabase(sf::Out<std::shared_ptr<IContentMetaDatabase>> out, StorageId storage_id) {
|
||||||
NcmContentMetaDatabase db;
|
NcmContentMetaDatabase db;
|
||||||
R_TRY(::ncmOpenContentMetaDatabase(std::addressof(db), static_cast<NcmStorageId>(storage_id)));
|
R_TRY(::ncmOpenContentMetaDatabase(std::addressof(db), static_cast<NcmStorageId>(storage_id)));
|
||||||
|
|
||||||
out.SetValue(std::make_shared<RemoteContentMetaDatabaseImpl>(db));
|
out.SetValue(sf::MakeShared<IContentMetaDatabase, RemoteContentMetaDatabaseImpl>(db));
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result CloseContentStorageForcibly(StorageId storage_id) override {
|
Result CloseContentStorageForcibly(StorageId storage_id) {
|
||||||
return ::ncmCloseContentStorageForcibly(static_cast<NcmStorageId>(storage_id));
|
return ::ncmCloseContentStorageForcibly(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result CloseContentMetaDatabaseForcibly(StorageId storage_id) override {
|
Result CloseContentMetaDatabaseForcibly(StorageId storage_id) {
|
||||||
return ::ncmCloseContentMetaDatabaseForcibly(static_cast<NcmStorageId>(storage_id));
|
return ::ncmCloseContentMetaDatabaseForcibly(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result CleanupContentMetaDatabase(StorageId storage_id) override {
|
Result CleanupContentMetaDatabase(StorageId storage_id) {
|
||||||
return ::ncmCleanupContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
return ::ncmCleanupContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ActivateContentStorage(StorageId storage_id) override {
|
Result ActivateContentStorage(StorageId storage_id) {
|
||||||
return ::ncmActivateContentStorage(static_cast<NcmStorageId>(storage_id));
|
return ::ncmActivateContentStorage(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result InactivateContentStorage(StorageId storage_id) override {
|
Result InactivateContentStorage(StorageId storage_id) {
|
||||||
return ::ncmInactivateContentStorage(static_cast<NcmStorageId>(storage_id));
|
return ::ncmInactivateContentStorage(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ActivateContentMetaDatabase(StorageId storage_id) override {
|
Result ActivateContentMetaDatabase(StorageId storage_id) {
|
||||||
return ::ncmActivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
return ::ncmActivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result InactivateContentMetaDatabase(StorageId storage_id) override {
|
Result InactivateContentMetaDatabase(StorageId storage_id) {
|
||||||
return ::ncmInactivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
return ::ncmInactivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result InvalidateRightsIdCache() override {
|
Result InvalidateRightsIdCache() {
|
||||||
return ::ncmInvalidateRightsIdCache();
|
return ::ncmInvalidateRightsIdCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetMemoryReport(sf::Out<MemoryReport> out) override {
|
Result GetMemoryReport(sf::Out<MemoryReport> out) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
static_assert(ncm::IsIContentManager<RemoteContentManagerImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
namespace ams::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
class RemoteContentMetaDatabaseImpl final : public IContentMetaDatabase {
|
class RemoteContentMetaDatabaseImpl final {
|
||||||
private:
|
private:
|
||||||
::NcmContentMetaDatabase srv;
|
::NcmContentMetaDatabase srv;
|
||||||
public:
|
public:
|
||||||
|
@ -71,101 +71,101 @@ namespace ams::ncm {
|
||||||
return reinterpret_cast<const ::NcmContentId *>(std::addressof(c));
|
return reinterpret_cast<const ::NcmContentId *>(std::addressof(c));
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
virtual Result Set(const ContentMetaKey &key, sf::InBuffer value) override {
|
Result Set(const ContentMetaKey &key, sf::InBuffer value) {
|
||||||
return ncmContentMetaDatabaseSet(std::addressof(this->srv), Convert(key), value.GetPointer(), value.GetSize());
|
return ncmContentMetaDatabaseSet(std::addressof(this->srv), Convert(key), value.GetPointer(), value.GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Get(sf::Out<u64> out_size, const ContentMetaKey &key, sf::OutBuffer out_value) override {
|
Result Get(sf::Out<u64> out_size, const ContentMetaKey &key, sf::OutBuffer out_value) {
|
||||||
return ncmContentMetaDatabaseGet(std::addressof(this->srv), Convert(key), out_size.GetPointer(), out_value.GetPointer(), out_value.GetSize());
|
return ncmContentMetaDatabaseGet(std::addressof(this->srv), Convert(key), out_size.GetPointer(), out_value.GetPointer(), out_value.GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Remove(const ContentMetaKey &key) override {
|
Result Remove(const ContentMetaKey &key) {
|
||||||
return ncmContentMetaDatabaseRemove(std::addressof(this->srv), Convert(key));
|
return ncmContentMetaDatabaseRemove(std::addressof(this->srv), Convert(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetContentIdByType(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type) override {
|
Result GetContentIdByType(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type) {
|
||||||
return ncmContentMetaDatabaseGetContentIdByType(std::addressof(this->srv), Convert(out_content_id.GetPointer()), Convert(key), static_cast<::NcmContentType>(type));
|
return ncmContentMetaDatabaseGetContentIdByType(std::addressof(this->srv), Convert(out_content_id.GetPointer()), Convert(key), static_cast<::NcmContentType>(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ListContentInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentInfo> &out_info, const ContentMetaKey &key, s32 offset) override {
|
Result ListContentInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentInfo> &out_info, const ContentMetaKey &key, s32 offset) {
|
||||||
return ncmContentMetaDatabaseListContentInfo(std::addressof(this->srv), out_entries_written.GetPointer(), Convert(out_info.GetPointer()), out_info.GetSize(), Convert(key), offset);
|
return ncmContentMetaDatabaseListContentInfo(std::addressof(this->srv), out_entries_written.GetPointer(), Convert(out_info.GetPointer()), out_info.GetSize(), Convert(key), offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result List(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaKey> &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type) override {
|
Result List(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaKey> &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type) {
|
||||||
return ncmContentMetaDatabaseList(std::addressof(this->srv), out_entries_total.GetPointer(), out_entries_written.GetPointer(), Convert(out_info.GetPointer()), out_info.GetSize(), static_cast<::NcmContentMetaType>(meta_type), application_id.value, min, max, static_cast<::NcmContentInstallType>(install_type));
|
return ncmContentMetaDatabaseList(std::addressof(this->srv), out_entries_total.GetPointer(), out_entries_written.GetPointer(), Convert(out_info.GetPointer()), out_info.GetSize(), static_cast<::NcmContentMetaType>(meta_type), application_id.value, min, max, static_cast<::NcmContentInstallType>(install_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetLatestContentMetaKey(sf::Out<ContentMetaKey> out_key, u64 id) override {
|
Result GetLatestContentMetaKey(sf::Out<ContentMetaKey> out_key, u64 id) {
|
||||||
return ncmContentMetaDatabaseGetLatestContentMetaKey(std::addressof(this->srv), Convert(out_key.GetPointer()), static_cast<u64>(id));
|
return ncmContentMetaDatabaseGetLatestContentMetaKey(std::addressof(this->srv), Convert(out_key.GetPointer()), static_cast<u64>(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ListApplication(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ApplicationContentMetaKey> &out_keys, ContentMetaType meta_type) override {
|
Result ListApplication(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ApplicationContentMetaKey> &out_keys, ContentMetaType meta_type) {
|
||||||
return ncmContentMetaDatabaseListApplication(std::addressof(this->srv), out_entries_total.GetPointer(), out_entries_written.GetPointer(), Convert(out_keys.GetPointer()), out_keys.GetSize(), static_cast<::NcmContentMetaType>(meta_type));
|
return ncmContentMetaDatabaseListApplication(std::addressof(this->srv), out_entries_total.GetPointer(), out_entries_written.GetPointer(), Convert(out_keys.GetPointer()), out_keys.GetSize(), static_cast<::NcmContentMetaType>(meta_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Has(sf::Out<bool> out, const ContentMetaKey &key) override {
|
Result Has(sf::Out<bool> out, const ContentMetaKey &key) {
|
||||||
return ncmContentMetaDatabaseHas(std::addressof(this->srv), out.GetPointer(), Convert(key));
|
return ncmContentMetaDatabaseHas(std::addressof(this->srv), out.GetPointer(), Convert(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result HasAll(sf::Out<bool> out, const sf::InArray<ContentMetaKey> &keys) override {
|
Result HasAll(sf::Out<bool> out, const sf::InArray<ContentMetaKey> &keys) {
|
||||||
return ncmContentMetaDatabaseHasAll(std::addressof(this->srv), out.GetPointer(), Convert(keys.GetPointer()), keys.GetSize());
|
return ncmContentMetaDatabaseHasAll(std::addressof(this->srv), out.GetPointer(), Convert(keys.GetPointer()), keys.GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetSize(sf::Out<u64> out_size, const ContentMetaKey &key) override {
|
Result GetSize(sf::Out<u64> out_size, const ContentMetaKey &key) {
|
||||||
return ncmContentMetaDatabaseGetSize(std::addressof(this->srv), out_size.GetPointer(), Convert(key));
|
return ncmContentMetaDatabaseGetSize(std::addressof(this->srv), out_size.GetPointer(), Convert(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetRequiredSystemVersion(sf::Out<u32> out_version, const ContentMetaKey &key) override {
|
Result GetRequiredSystemVersion(sf::Out<u32> out_version, const ContentMetaKey &key) {
|
||||||
return ncmContentMetaDatabaseGetRequiredSystemVersion(std::addressof(this->srv), out_version.GetPointer(), Convert(key));
|
return ncmContentMetaDatabaseGetRequiredSystemVersion(std::addressof(this->srv), out_version.GetPointer(), Convert(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) override {
|
Result GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) {
|
||||||
return ncmContentMetaDatabaseGetPatchId(std::addressof(this->srv), reinterpret_cast<u64 *>(out_patch_id.GetPointer()), Convert(key));
|
return ncmContentMetaDatabaseGetPatchId(std::addressof(this->srv), reinterpret_cast<u64 *>(out_patch_id.GetPointer()), Convert(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DisableForcibly() override {
|
Result DisableForcibly() {
|
||||||
return ncmContentMetaDatabaseDisableForcibly(std::addressof(this->srv));
|
return ncmContentMetaDatabaseDisableForcibly(std::addressof(this->srv));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) override {
|
Result LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) {
|
||||||
return ncmContentMetaDatabaseLookupOrphanContent(std::addressof(this->srv), out_orphaned.GetPointer(), Convert(content_ids.GetPointer()), std::min(out_orphaned.GetSize(), content_ids.GetSize()));
|
return ncmContentMetaDatabaseLookupOrphanContent(std::addressof(this->srv), out_orphaned.GetPointer(), Convert(content_ids.GetPointer()), std::min(out_orphaned.GetSize(), content_ids.GetSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Commit() override {
|
Result Commit() {
|
||||||
return ncmContentMetaDatabaseCommit(std::addressof(this->srv));
|
return ncmContentMetaDatabaseCommit(std::addressof(this->srv));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result HasContent(sf::Out<bool> out, const ContentMetaKey &key, const ContentId &content_id) override {
|
Result HasContent(sf::Out<bool> out, const ContentMetaKey &key, const ContentId &content_id) {
|
||||||
return ncmContentMetaDatabaseHasContent(std::addressof(this->srv), out.GetPointer(), Convert(key), Convert(content_id));
|
return ncmContentMetaDatabaseHasContent(std::addressof(this->srv), out.GetPointer(), Convert(key), Convert(content_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result ListContentMetaInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaInfo> &out_meta_info, const ContentMetaKey &key, s32 offset) override {
|
Result ListContentMetaInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaInfo> &out_meta_info, const ContentMetaKey &key, s32 offset) {
|
||||||
return ncmContentMetaDatabaseListContentMetaInfo(std::addressof(this->srv), out_entries_written.GetPointer(), out_meta_info.GetPointer(), out_meta_info.GetSize(), Convert(key), offset);
|
return ncmContentMetaDatabaseListContentMetaInfo(std::addressof(this->srv), out_entries_written.GetPointer(), out_meta_info.GetPointer(), out_meta_info.GetSize(), Convert(key), offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetAttributes(sf::Out<u8> out_attributes, const ContentMetaKey &key) override {
|
Result GetAttributes(sf::Out<u8> out_attributes, const ContentMetaKey &key) {
|
||||||
static_assert(sizeof(ContentMetaAttribute) == sizeof(u8));
|
static_assert(sizeof(ContentMetaAttribute) == sizeof(u8));
|
||||||
return ncmContentMetaDatabaseGetAttributes(std::addressof(this->srv), Convert(key), out_attributes.GetPointer());
|
return ncmContentMetaDatabaseGetAttributes(std::addressof(this->srv), Convert(key), out_attributes.GetPointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetRequiredApplicationVersion(sf::Out<u32> out_version, const ContentMetaKey &key) override {
|
Result GetRequiredApplicationVersion(sf::Out<u32> out_version, const ContentMetaKey &key) {
|
||||||
return ncmContentMetaDatabaseGetRequiredApplicationVersion(std::addressof(this->srv), out_version.GetPointer(), Convert(key));
|
return ncmContentMetaDatabaseGetRequiredApplicationVersion(std::addressof(this->srv), out_version.GetPointer(), Convert(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) override {
|
Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) {
|
||||||
return ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset(std::addressof(this->srv), Convert(out_content_id.GetPointer()), Convert(key), static_cast<::NcmContentType>(type), id_offset);
|
return ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset(std::addressof(this->srv), Convert(out_content_id.GetPointer()), Convert(key), static_cast<::NcmContentType>(type), id_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetCount(sf::Out<u32> out_count) override {
|
Result GetCount(sf::Out<u32> out_count) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) override {
|
Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) {
|
||||||
/* TODO: libnx bindings */
|
/* TODO: libnx bindings */
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
static_assert(ncm::IsIContentMetaDatabase<RemoteContentMetaDatabaseImpl>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue