mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-01 07:18:22 -04: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
|
@ -21,7 +21,7 @@ namespace ams::exosphere {
|
|||
|
||||
ApiInfo GetApiInfo() {
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -29,15 +29,15 @@ namespace ams::exosphere {
|
|||
}
|
||||
|
||||
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() {
|
||||
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() {
|
||||
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) {
|
||||
|
@ -52,7 +52,7 @@ namespace ams::exosphere {
|
|||
|
||||
inline u64 GetU64ConfigItem(spl::ConfigItem cfg) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace ams::capsrv::server {
|
|||
this->server_manager_holder.emplace();
|
||||
|
||||
/* 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. */
|
||||
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 sm::ServiceName ServiceName = sm::ServiceName::Encode("caps:dc");
|
||||
|
||||
using Interface = IDecoderControlService;
|
||||
using Service = DecoderControlService;
|
||||
using ServerOptions = sf::hipc::DefaultServerManagerOptions;
|
||||
using ServerManager = sf::hipc::ServerManager<NumServers, ServerOptions, MaxSessions>;
|
||||
|
|
|
@ -18,17 +18,15 @@
|
|||
|
||||
namespace ams::capsrv::server {
|
||||
|
||||
class DecoderControlService final : public sf::IServiceObject {
|
||||
protected:
|
||||
enum class CommandId {
|
||||
DecodeJpeg = 3001,
|
||||
};
|
||||
#define AMS_CAPSRV_DECODER_CONTROL_SERVICE_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 3001, Result, DecodeJpeg, (const sf::OutNonSecureBuffer &out, const sf::InBuffer &in, u32 width, u32 height, const ScreenShotDecodeOption &option))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(IDecoderControlService, AMS_CAPSRV_DECODER_CONTROL_SERVICE_INTERFACE_INFO)
|
||||
|
||||
class DecoderControlService final {
|
||||
public:
|
||||
/* Actual commands. */
|
||||
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)
|
||||
};
|
||||
Result DecodeJpeg(const sf::OutNonSecureBuffer &out, const sf::InBuffer &in, u32 width, u32 height, const ScreenShotDecodeOption &option);
|
||||
};
|
||||
static_assert(IsIDecoderControlService<DecoderControlService>);
|
||||
|
||||
}
|
|
@ -20,19 +20,20 @@ namespace ams::erpt::srv {
|
|||
|
||||
class Attachment;
|
||||
|
||||
class AttachmentImpl final : public erpt::sf::IAttachment {
|
||||
class AttachmentImpl final {
|
||||
private:
|
||||
Attachment *attachment;
|
||||
public:
|
||||
AttachmentImpl();
|
||||
~AttachmentImpl();
|
||||
public:
|
||||
virtual Result Open(const AttachmentId &attachment_id) override final;
|
||||
virtual Result Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) override final;
|
||||
virtual Result SetFlags(AttachmentFlagSet flags) override final;
|
||||
virtual Result GetFlags(ams::sf::Out<AttachmentFlagSet> out) override final;
|
||||
virtual Result Close() override final;
|
||||
virtual Result GetSize(ams::sf::Out<s64> out) override final;
|
||||
Result Open(const AttachmentId &attachment_id);
|
||||
Result Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer);
|
||||
Result SetFlags(AttachmentFlagSet flags);
|
||||
Result GetFlags(ams::sf::Out<AttachmentFlagSet> out);
|
||||
Result Close();
|
||||
Result GetSize(ams::sf::Out<s64> out);
|
||||
};
|
||||
static_assert(erpt::sf::IsIAttachment<AttachmentImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,19 +18,20 @@
|
|||
|
||||
namespace ams::erpt::srv {
|
||||
|
||||
class ContextImpl final : public erpt::sf::IContext {
|
||||
class ContextImpl final {
|
||||
public:
|
||||
virtual Result SubmitContext(const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer) override final;
|
||||
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;
|
||||
virtual Result SetInitialLaunchSettingsCompletionTime(const time::SteadyClockTimePoint &time_point) override final;
|
||||
virtual Result ClearInitialLaunchSettingsCompletionTime() override final;
|
||||
virtual Result UpdatePowerOnTime() override final;
|
||||
virtual Result UpdateAwakeTime() override final;
|
||||
virtual Result SubmitMultipleCategoryContext(const MultipleCategoryContextEntry &ctx_entry, const ams::sf::InBuffer &str_buffer) override final;
|
||||
virtual Result UpdateApplicationLaunchTime() override final;
|
||||
virtual Result ClearApplicationLaunchTime() override final;
|
||||
virtual Result SubmitAttachment(ams::sf::Out<AttachmentId> out, const ams::sf::InBuffer &attachment_name, const ams::sf::InBuffer &attachment_data) override final;
|
||||
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 SubmitContext(const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer);
|
||||
Result CreateReport(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer);
|
||||
Result SetInitialLaunchSettingsCompletionTime(const time::SteadyClockTimePoint &time_point);
|
||||
Result ClearInitialLaunchSettingsCompletionTime();
|
||||
Result UpdatePowerOnTime();
|
||||
Result UpdateAwakeTime();
|
||||
Result SubmitMultipleCategoryContext(const MultipleCategoryContextEntry &ctx_entry, const ams::sf::InBuffer &str_buffer);
|
||||
Result UpdateApplicationLaunchTime();
|
||||
Result ClearApplicationLaunchTime();
|
||||
Result SubmitAttachment(ams::sf::Out<AttachmentId> out, const ams::sf::InBuffer &attachment_name, const ams::sf::InBuffer &attachment_data);
|
||||
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 {
|
||||
|
||||
class ManagerImpl final : public erpt::sf::IManager, public util::IntrusiveListBaseNode<ManagerImpl> {
|
||||
class ManagerImpl final : public util::IntrusiveListBaseNode<ManagerImpl> {
|
||||
private:
|
||||
os::SystemEvent system_event;
|
||||
public:
|
||||
|
@ -29,12 +29,13 @@ namespace ams::erpt::srv {
|
|||
public:
|
||||
static Result NotifyAll();
|
||||
public:
|
||||
virtual Result GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter) override final;
|
||||
virtual Result GetEvent(ams::sf::OutCopyHandle out) override final;
|
||||
virtual Result CleanupReports() override final;
|
||||
virtual Result DeleteReport(const ReportId &report_id) override final;
|
||||
virtual Result GetStorageUsageStatistics(ams::sf::Out<StorageUsageStatistics> out) override final;
|
||||
virtual Result GetAttachmentList(const ams::sf::OutBuffer &out_buf, const ReportId &report_id) override final;
|
||||
Result GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter);
|
||||
Result GetEvent(ams::sf::OutCopyHandle out);
|
||||
Result CleanupReports();
|
||||
Result DeleteReport(const ReportId &report_id);
|
||||
Result GetStorageUsageStatistics(ams::sf::Out<StorageUsageStatistics> out);
|
||||
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 ReportImpl final : public erpt::sf::IReport {
|
||||
class ReportImpl final {
|
||||
private:
|
||||
Report *report;
|
||||
public:
|
||||
ReportImpl();
|
||||
~ReportImpl();
|
||||
public:
|
||||
virtual Result Open(const ReportId &report_id) override final;
|
||||
virtual Result Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) override final;
|
||||
virtual Result SetFlags(ReportFlagSet flags) override final;
|
||||
virtual Result GetFlags(ams::sf::Out<ReportFlagSet> out) override final;
|
||||
virtual Result Close() override final;
|
||||
virtual Result GetSize(ams::sf::Out<s64> out) override final;
|
||||
Result Open(const ReportId &report_id);
|
||||
Result Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer);
|
||||
Result SetFlags(ReportFlagSet flags);
|
||||
Result GetFlags(ams::sf::Out<ReportFlagSet> out);
|
||||
Result Close();
|
||||
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> {
|
||||
private:
|
||||
os::ThreadType thread;
|
||||
std::shared_ptr<erpt::srv::ContextImpl> context_session_object;
|
||||
std::shared_ptr<erpt::sf::IContext> context_session_object;
|
||||
private:
|
||||
static void ThreadFunction(void *_this) {
|
||||
reinterpret_cast<ErrorReportServiceManager *>(_this)->SetupAndLoopProcess();
|
||||
|
@ -51,14 +51,14 @@ namespace ams::erpt::srv {
|
|||
void SetupAndLoopProcess();
|
||||
public:
|
||||
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() {
|
||||
R_ABORT_UNLESS(this->RegisterServer<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::IContext, erpt::srv::ContextImpl>(ErrorReportContextServiceName, ErrorReportContextSessions, this->context_session_object)));
|
||||
R_ABORT_UNLESS((this->RegisterServer<erpt::sf::ISession, erpt::srv::SessionImpl>(ErrorReportReportServiceName, ErrorReportReportSessions)));
|
||||
|
||||
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));
|
||||
|
||||
}
|
||||
|
|
|
@ -21,34 +21,34 @@
|
|||
|
||||
namespace ams::erpt::srv {
|
||||
|
||||
Result SessionImpl::OpenReport(ams::sf::Out<std::shared_ptr<erpt::sf::IReport>> out) {
|
||||
/* Create an interface. */
|
||||
auto intf = std::shared_ptr<ReportImpl>(new (std::nothrow) ReportImpl);
|
||||
R_UNLESS(intf != nullptr, erpt::ResultOutOfMemory());
|
||||
namespace {
|
||||
|
||||
/* Return it. */
|
||||
out.SetValue(std::move(intf));
|
||||
return ResultSuccess();
|
||||
template<typename Interface, typename Impl>
|
||||
ALWAYS_INLINE Result OpenInterface(ams::sf::Out<std::shared_ptr<Interface>> &out) {
|
||||
/* 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) {
|
||||
/* Create an interface. */
|
||||
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();
|
||||
return OpenInterface<erpt::sf::IManager, ManagerImpl>(out);
|
||||
}
|
||||
|
||||
Result SessionImpl::OpenAttachment(ams::sf::Out<std::shared_ptr<erpt::sf::IAttachment>> out) {
|
||||
/* Create an interface. */
|
||||
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();
|
||||
return OpenInterface<erpt::sf::IAttachment, AttachmentImpl>(out);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,11 +18,12 @@
|
|||
|
||||
namespace ams::erpt::srv {
|
||||
|
||||
class SessionImpl final : public erpt::sf::ISession {
|
||||
class SessionImpl final {
|
||||
public:
|
||||
virtual Result OpenReport(ams::sf::Out<std::shared_ptr<erpt::sf::IReport>> out) override final;
|
||||
virtual Result OpenManager(ams::sf::Out<std::shared_ptr<erpt::sf::IManager>> out) override final;
|
||||
virtual Result OpenAttachment(ams::sf::Out<std::shared_ptr<erpt::sf::IAttachment>> out) override final;
|
||||
Result OpenReport(ams::sf::Out<std::shared_ptr<erpt::sf::IReport>> out);
|
||||
Result OpenManager(ams::sf::Out<std::shared_ptr<erpt::sf::IManager>> out);
|
||||
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. */
|
||||
auto get_size_impl = [&]() -> Result {
|
||||
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();
|
||||
};
|
||||
|
||||
|
@ -214,7 +214,7 @@ namespace ams::fs {
|
|||
/* Get the space size. */
|
||||
auto get_size_impl = [&]() -> Result {
|
||||
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();
|
||||
};
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ namespace ams::fssrv::impl {
|
|||
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();
|
||||
|
||||
std::unique_lock<fssystem::SemaphoreAdapter> open_count_semaphore;
|
||||
|
@ -254,14 +254,14 @@ namespace ams::fssrv::impl {
|
|||
/* TODO: N creates an nn::fssystem::AsynchronousAccessFile here. */
|
||||
|
||||
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());
|
||||
|
||||
out.SetValue(std::move(file_intf), target_object_id);
|
||||
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();
|
||||
|
||||
std::unique_lock<fssystem::SemaphoreAdapter> open_count_semaphore;
|
||||
|
@ -281,7 +281,7 @@ namespace ams::fssrv::impl {
|
|||
const auto target_object_id = dir->GetDomainObjectId();
|
||||
|
||||
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());
|
||||
|
||||
out.SetValue(std::move(dir_intf), target_object_id);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace ams::lr {
|
||||
|
||||
class AddOnContentLocationResolverImpl : public IAddOnContentLocationResolver {
|
||||
class AddOnContentLocationResolverImpl {
|
||||
private:
|
||||
/* Storage for RegisteredData entries by data id. */
|
||||
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) { /* ... */ }
|
||||
|
||||
/* Actual commands. */
|
||||
virtual Result ResolveAddOnContentPath(sf::Out<Path> out, ncm::DataId id) override;
|
||||
virtual Result RegisterAddOnContentStorageDeprecated(ncm::DataId id, ncm::StorageId storage_id) override;
|
||||
virtual Result RegisterAddOnContentStorage(ncm::DataId id, ncm::ApplicationId application_id, ncm::StorageId storage_id) override;
|
||||
virtual Result UnregisterAllAddOnContentPath() override;
|
||||
virtual Result RefreshApplicationAddOnContent(const sf::InArray<ncm::ApplicationId> &ids) override;
|
||||
virtual Result UnregisterApplicationAddOnContent(ncm::ApplicationId id) override;
|
||||
Result ResolveAddOnContentPath(sf::Out<Path> out, ncm::DataId id);
|
||||
Result RegisterAddOnContentStorageDeprecated(ncm::DataId id, ncm::StorageId storage_id);
|
||||
Result RegisterAddOnContentStorage(ncm::DataId id, ncm::ApplicationId application_id, ncm::StorageId storage_id);
|
||||
Result UnregisterAllAddOnContentPath();
|
||||
Result RefreshApplicationAddOnContent(const sf::InArray<ncm::ApplicationId> &ids);
|
||||
Result UnregisterApplicationAddOnContent(ncm::ApplicationId id);
|
||||
};
|
||||
static_assert(lr::IsIAddOnContentLocationResolver<AddOnContentLocationResolverImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace ams::lr {
|
|||
LrLocationResolver 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();
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ namespace ams::lr {
|
|||
LrRegisteredLocationResolver lr;
|
||||
R_TRY(lrOpenRegisteredLocationResolver(std::addressof(lr)));
|
||||
|
||||
*out = RegisteredLocationResolver(std::make_shared<RemoteRegisteredLocationResolverImpl>(lr));
|
||||
*out = RegisteredLocationResolver(sf::MakeShared<IRegisteredLocationResolver, RemoteRegisteredLocationResolverImpl>(lr));
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,32 +35,33 @@ namespace ams::lr {
|
|||
void GetContentStoragePath(Path *out, ncm::ContentId content_id);
|
||||
public:
|
||||
/* Actual commands. */
|
||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id) override;
|
||||
virtual Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result Refresh() override;
|
||||
virtual Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result ClearApplicationRedirectionDeprecated() override;
|
||||
virtual Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids) override;
|
||||
virtual Result EraseProgramRedirection(ncm::ProgramId id) override;
|
||||
virtual Result EraseApplicationControlRedirection(ncm::ProgramId id) override;
|
||||
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) override;
|
||||
virtual Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) override;
|
||||
virtual Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result EraseProgramRedirectionForDebug(ncm::ProgramId id) override;
|
||||
Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result RedirectProgramPath(const Path &path, ncm::ProgramId id);
|
||||
Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id);
|
||||
Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result Refresh();
|
||||
Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result ClearApplicationRedirectionDeprecated();
|
||||
Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids);
|
||||
Result EraseProgramRedirection(ncm::ProgramId id);
|
||||
Result EraseApplicationControlRedirection(ncm::ProgramId id);
|
||||
Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id);
|
||||
Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id);
|
||||
Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result EraseProgramRedirectionForDebug(ncm::ProgramId id);
|
||||
};
|
||||
static_assert(lr::IsILocationResolver<ContentLocationResolverImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
namespace ams::lr {
|
||||
|
||||
class LocationResolverImplBase : public ILocationResolver {
|
||||
class LocationResolverImplBase {
|
||||
NON_COPYABLE(LocationResolverImplBase);
|
||||
NON_MOVEABLE(LocationResolverImplBase);
|
||||
protected:
|
||||
|
|
|
@ -30,10 +30,10 @@ namespace ams::lr {
|
|||
/* No existing resolver is present, create one. */
|
||||
if (!resolver) {
|
||||
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 {
|
||||
auto content_resolver = std::make_shared<ContentLocationResolverImpl>(storage_id);
|
||||
R_TRY(content_resolver->Refresh());
|
||||
auto content_resolver = sf::MakeShared<ILocationResolver, ContentLocationResolverImpl>(storage_id);
|
||||
R_TRY(content_resolver->GetImpl().Refresh());
|
||||
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. */
|
||||
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. */
|
||||
|
@ -79,7 +79,7 @@ namespace ams::lr {
|
|||
|
||||
/* No existing resolver is present, create one. */
|
||||
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. */
|
||||
|
|
|
@ -24,32 +24,33 @@ namespace ams::lr {
|
|||
~RedirectOnlyLocationResolverImpl();
|
||||
public:
|
||||
/* Actual commands. */
|
||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id) override;
|
||||
virtual Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result Refresh() override;
|
||||
virtual Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result ClearApplicationRedirectionDeprecated() override;
|
||||
virtual Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids) override;
|
||||
virtual Result EraseProgramRedirection(ncm::ProgramId id) override;
|
||||
virtual Result EraseApplicationControlRedirection(ncm::ProgramId id) override;
|
||||
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) override;
|
||||
virtual Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) override;
|
||||
virtual Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result EraseProgramRedirectionForDebug(ncm::ProgramId id) override;
|
||||
Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result RedirectProgramPath(const Path &path, ncm::ProgramId id);
|
||||
Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id);
|
||||
Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result Refresh();
|
||||
Result RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result ClearApplicationRedirectionDeprecated();
|
||||
Result ClearApplicationRedirection(const sf::InArray<ncm::ProgramId> &excluding_ids);
|
||||
Result EraseProgramRedirection(ncm::ProgramId id);
|
||||
Result EraseApplicationControlRedirection(ncm::ProgramId id);
|
||||
Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id);
|
||||
Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id);
|
||||
Result ResolveProgramPathForDebug(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result EraseProgramRedirectionForDebug(ncm::ProgramId id);
|
||||
};
|
||||
static_assert(lr::IsILocationResolver<RedirectOnlyLocationResolverImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace ams::lr {
|
||||
|
||||
class RegisteredLocationResolverImpl : public IRegisteredLocationResolver {
|
||||
class RegisteredLocationResolverImpl {
|
||||
private:
|
||||
static constexpr size_t MaxRegisteredLocationsDeprecated = 0x10;
|
||||
static constexpr size_t MaxRegisteredLocations = 0x20;
|
||||
|
@ -49,20 +49,21 @@ namespace ams::lr {
|
|||
~RegisteredLocationResolverImpl();
|
||||
public:
|
||||
/* Actual commands. */
|
||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result RegisterProgramPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RegisterProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result UnregisterProgramPath(ncm::ProgramId id) override;
|
||||
virtual Result RedirectProgramPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result ResolveHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) override;
|
||||
virtual Result RegisterHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RegisterHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result UnregisterHtmlDocumentPath(ncm::ProgramId id) override;
|
||||
virtual Result RedirectHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override;
|
||||
virtual Result RedirectHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) override;
|
||||
virtual Result Refresh() override;
|
||||
virtual Result RefreshExcluding(const sf::InArray<ncm::ProgramId> &ids) override;
|
||||
Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result RegisterProgramPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RegisterProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result UnregisterProgramPath(ncm::ProgramId id);
|
||||
Result RedirectProgramPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result ResolveHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id);
|
||||
Result RegisterHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RegisterHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result UnregisterHtmlDocumentPath(ncm::ProgramId id);
|
||||
Result RedirectHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id);
|
||||
Result RedirectHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id);
|
||||
Result Refresh();
|
||||
Result RefreshExcluding(const sf::InArray<ncm::ProgramId> &ids);
|
||||
};
|
||||
static_assert(lr::IsIRegisteredLocationResolver<RegisteredLocationResolverImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
namespace ams::lr {
|
||||
|
||||
class RemoteLocationResolverImpl : public ILocationResolver {
|
||||
class RemoteLocationResolverImpl {
|
||||
private:
|
||||
::LrLocationResolver srv;
|
||||
public:
|
||||
|
@ -27,121 +27,122 @@ namespace ams::lr {
|
|||
~RemoteLocationResolverImpl() { ::serviceClose(&srv.s); }
|
||||
public:
|
||||
/* Actual commands. */
|
||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
||||
return lrLrResolveProgramPath(std::addressof(this->srv), id.value, out->str);
|
||||
Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||
return ::lrLrResolveProgramPath(std::addressof(this->srv), id.value, out->str);
|
||||
}
|
||||
|
||||
virtual Result RedirectProgramPath(const Path &path, ncm::ProgramId id) override {
|
||||
return lrLrRedirectProgramPath(std::addressof(this->srv), id.value, path.str);
|
||||
Result RedirectProgramPath(const Path &path, ncm::ProgramId id) {
|
||||
return ::lrLrRedirectProgramPath(std::addressof(this->srv), id.value, path.str);
|
||||
}
|
||||
|
||||
virtual Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
||||
return lrLrResolveApplicationControlPath(std::addressof(this->srv), id.value, out->str);
|
||||
Result ResolveApplicationControlPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||
return ::lrLrResolveApplicationControlPath(std::addressof(this->srv), id.value, out->str);
|
||||
}
|
||||
|
||||
virtual Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
||||
return lrLrResolveApplicationHtmlDocumentPath(std::addressof(this->srv), id.value, out->str);
|
||||
Result ResolveApplicationHtmlDocumentPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||
return ::lrLrResolveApplicationHtmlDocumentPath(std::addressof(this->srv), id.value, out->str);
|
||||
}
|
||||
|
||||
virtual Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id) override {
|
||||
return lrLrResolveDataPath(std::addressof(this->srv), id.value, out->str);
|
||||
Result ResolveDataPath(sf::Out<Path> out, ncm::DataId id) {
|
||||
return ::lrLrResolveDataPath(std::addressof(this->srv), id.value, out->str);
|
||||
}
|
||||
|
||||
virtual Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
||||
return lrLrRedirectApplicationControlPath(std::addressof(this->srv), id.value, 0, path.str);
|
||||
Result RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||
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 {
|
||||
return lrLrRedirectApplicationControlPath(std::addressof(this->srv), id.value, owner_id.value, path.str);
|
||||
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);
|
||||
}
|
||||
|
||||
virtual Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
||||
return lrLrRedirectApplicationHtmlDocumentPath(std::addressof(this->srv), id.value, 0, path.str);
|
||||
Result RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||
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 {
|
||||
return lrLrRedirectApplicationHtmlDocumentPath(std::addressof(this->srv), id.value, owner_id.value, path.str);
|
||||
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);
|
||||
}
|
||||
|
||||
virtual Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
||||
return lrLrResolveApplicationLegalInformationPath(std::addressof(this->srv), id.value, out->str);
|
||||
Result ResolveApplicationLegalInformationPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||
return ::lrLrResolveApplicationLegalInformationPath(std::addressof(this->srv), id.value, out->str);
|
||||
}
|
||||
|
||||
virtual Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
||||
return lrLrRedirectApplicationLegalInformationPath(std::addressof(this->srv), id.value, 0, path.str);
|
||||
Result RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||
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 {
|
||||
return lrLrRedirectApplicationLegalInformationPath(std::addressof(this->srv), id.value, owner_id.value, path.str);
|
||||
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);
|
||||
}
|
||||
|
||||
virtual Result Refresh() override {
|
||||
return lrLrRefresh(std::addressof(this->srv));
|
||||
Result Refresh() {
|
||||
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 */
|
||||
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 */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result ClearApplicationRedirectionDeprecated() override {
|
||||
Result ClearApplicationRedirectionDeprecated() {
|
||||
/* TODO: libnx bindings */
|
||||
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 */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result EraseProgramRedirection(ncm::ProgramId id) override {
|
||||
return lrLrEraseProgramRedirection(std::addressof(this->srv), id.value);
|
||||
Result EraseProgramRedirection(ncm::ProgramId id) {
|
||||
return ::lrLrEraseProgramRedirection(std::addressof(this->srv), id.value);
|
||||
}
|
||||
|
||||
virtual Result EraseApplicationControlRedirection(ncm::ProgramId id) override {
|
||||
Result EraseApplicationControlRedirection(ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) override {
|
||||
Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) override {
|
||||
Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
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 */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) override {
|
||||
Result RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) override {
|
||||
Result RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
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 */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result EraseProgramRedirectionForDebug(ncm::ProgramId id) override {
|
||||
Result EraseProgramRedirectionForDebug(ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
};
|
||||
static_assert(lr::IsILocationResolver<RemoteLocationResolverImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
namespace ams::lr {
|
||||
|
||||
class RemoteRegisteredLocationResolverImpl : public IRegisteredLocationResolver {
|
||||
class RemoteRegisteredLocationResolverImpl {
|
||||
private:
|
||||
::LrRegisteredLocationResolver srv;
|
||||
public:
|
||||
|
@ -28,74 +28,75 @@ namespace ams::lr {
|
|||
~RemoteRegisteredLocationResolverImpl() { ::serviceClose(&srv.s); }
|
||||
public:
|
||||
/* Actual commands. */
|
||||
virtual Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) override {
|
||||
return lrRegLrResolveProgramPath(std::addressof(this->srv), static_cast<u64>(id), out->str);
|
||||
Result ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) {
|
||||
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 */
|
||||
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 */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result UnregisterProgramPath(ncm::ProgramId id) override {
|
||||
Result UnregisterProgramPath(ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result RedirectProgramPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
||||
Result RedirectProgramPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
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 */
|
||||
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 */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result RegisterHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
||||
Result RegisterHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
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 */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result UnregisterHtmlDocumentPath(ncm::ProgramId id) override {
|
||||
Result UnregisterHtmlDocumentPath(ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result RedirectHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) override {
|
||||
Result RedirectHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) {
|
||||
/* TODO: libnx bindings */
|
||||
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 */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result Refresh() override {
|
||||
Result Refresh() {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result RefreshExcluding(const sf::InArray<ncm::ProgramId> &ids) override {
|
||||
Result RefreshExcluding(const sf::InArray<ncm::ProgramId> &ids) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
};
|
||||
static_assert(lr::IsIRegisteredLocationResolver<RemoteRegisteredLocationResolverImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace ams::ncm {
|
|||
void Initialize() {
|
||||
AMS_ASSERT(g_content_manager == nullptr);
|
||||
R_ABORT_UNLESS(ncmInitialize());
|
||||
g_content_manager = std::make_shared<RemoteContentManagerImpl>();
|
||||
g_content_manager = sf::MakeShared<IContentManager, RemoteContentManagerImpl>();
|
||||
}
|
||||
|
||||
void Finalize() {
|
||||
|
|
|
@ -553,23 +553,23 @@ namespace ams::ncm {
|
|||
|
||||
if (storage_id == StorageId::GameCard) {
|
||||
/* Game card content storage is read only. */
|
||||
auto content_storage = std::make_shared<ReadOnlyContentStorageImpl>();
|
||||
R_TRY(content_storage->Initialize(root->path, MakeFlatContentFilePath));
|
||||
auto content_storage = sf::MakeShared<IContentStorage, ReadOnlyContentStorageImpl>();
|
||||
R_TRY(content_storage->GetImpl().Initialize(root->path, MakeFlatContentFilePath));
|
||||
root->content_storage = std::move(content_storage);
|
||||
} else {
|
||||
/* 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. */
|
||||
switch (storage_id) {
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -617,7 +617,7 @@ namespace ams::ncm {
|
|||
R_TRY(root->kvs->Initialize(root->max_content_metas, root->memory_resource));
|
||||
|
||||
/* 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 {
|
||||
/* Mount save data for this root. */
|
||||
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());
|
||||
|
||||
/* 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();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
namespace ams::ncm {
|
||||
|
||||
class ContentMetaDatabaseImplBase : public IContentMetaDatabase {
|
||||
class ContentMetaDatabaseImplBase {
|
||||
NON_COPYABLE(ContentMetaDatabaseImplBase);
|
||||
NON_MOVEABLE(ContentMetaDatabaseImplBase);
|
||||
protected:
|
||||
|
@ -52,6 +52,32 @@ namespace ams::ncm {
|
|||
R_TRY(this->GetContentMetaSize(out_size, 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 {
|
||||
|
||||
class ContentStorageImplBase : public IContentStorage {
|
||||
class ContentStorageImplBase {
|
||||
NON_COPYABLE(ContentStorageImplBase);
|
||||
NON_MOVEABLE(ContentStorageImplBase);
|
||||
protected:
|
||||
|
@ -43,6 +43,39 @@ namespace ams::ncm {
|
|||
}
|
||||
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 {
|
||||
|
||||
class RemoteContentManagerImpl final : public IContentManager {
|
||||
class RemoteContentManagerImpl final {
|
||||
public:
|
||||
RemoteContentManagerImpl() { /* ... */ }
|
||||
|
||||
~RemoteContentManagerImpl() { /* ... */ }
|
||||
public:
|
||||
virtual Result CreateContentStorage(StorageId storage_id) override {
|
||||
Result CreateContentStorage(StorageId 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));
|
||||
}
|
||||
|
||||
virtual Result VerifyContentStorage(StorageId storage_id) override {
|
||||
Result VerifyContentStorage(StorageId 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));
|
||||
}
|
||||
|
||||
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;
|
||||
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();
|
||||
}
|
||||
|
||||
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;
|
||||
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();
|
||||
}
|
||||
|
||||
virtual Result CloseContentStorageForcibly(StorageId storage_id) override {
|
||||
Result CloseContentStorageForcibly(StorageId 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));
|
||||
}
|
||||
|
||||
virtual Result CleanupContentMetaDatabase(StorageId storage_id) override {
|
||||
Result CleanupContentMetaDatabase(StorageId 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));
|
||||
}
|
||||
|
||||
virtual Result InactivateContentStorage(StorageId storage_id) override {
|
||||
Result InactivateContentStorage(StorageId 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));
|
||||
}
|
||||
|
||||
virtual Result InactivateContentMetaDatabase(StorageId storage_id) override {
|
||||
Result InactivateContentMetaDatabase(StorageId storage_id) {
|
||||
return ::ncmInactivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result InvalidateRightsIdCache() override {
|
||||
Result InvalidateRightsIdCache() {
|
||||
return ::ncmInvalidateRightsIdCache();
|
||||
}
|
||||
|
||||
virtual Result GetMemoryReport(sf::Out<MemoryReport> out) override {
|
||||
Result GetMemoryReport(sf::Out<MemoryReport> out) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
};
|
||||
static_assert(ncm::IsIContentManager<RemoteContentManagerImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
namespace ams::ncm {
|
||||
|
||||
class RemoteContentMetaDatabaseImpl final : public IContentMetaDatabase {
|
||||
class RemoteContentMetaDatabaseImpl final {
|
||||
private:
|
||||
::NcmContentMetaDatabase srv;
|
||||
public:
|
||||
|
@ -71,101 +71,101 @@ namespace ams::ncm {
|
|||
return reinterpret_cast<const ::NcmContentId *>(std::addressof(c));
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
virtual Result Remove(const ContentMetaKey &key) override {
|
||||
Result Remove(const ContentMetaKey &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));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
virtual Result DisableForcibly() override {
|
||||
Result DisableForcibly() {
|
||||
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()));
|
||||
}
|
||||
|
||||
virtual Result Commit() override {
|
||||
Result Commit() {
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
virtual Result GetCount(sf::Out<u32> out_count) override {
|
||||
Result GetCount(sf::Out<u32> out_count) {
|
||||
/* TODO: libnx bindings */
|
||||
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 */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
};
|
||||
static_assert(ncm::IsIContentMetaDatabase<RemoteContentMetaDatabaseImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
namespace ams::ncm {
|
||||
|
||||
class RemoteContentStorageImpl final : public IContentStorage {
|
||||
class RemoteContentStorageImpl final {
|
||||
private:
|
||||
::NcmContentStorage srv;
|
||||
public:
|
||||
|
@ -46,85 +46,85 @@ namespace ams::ncm {
|
|||
return reinterpret_cast<::NcmContentId *>(std::addressof(c));
|
||||
}
|
||||
public:
|
||||
virtual Result GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) override {
|
||||
Result GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) {
|
||||
return ncmContentStorageGeneratePlaceHolderId(std::addressof(this->srv), Convert(out.GetPointer()));
|
||||
}
|
||||
|
||||
virtual Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) override {
|
||||
Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) {
|
||||
static_assert(alignof(ContentId) < alignof(PlaceHolderId));
|
||||
return ncmContentStorageCreatePlaceHolder(std::addressof(this->srv), Convert(content_id), Convert(placeholder_id), size);
|
||||
}
|
||||
|
||||
virtual Result DeletePlaceHolder(PlaceHolderId placeholder_id) override {
|
||||
Result DeletePlaceHolder(PlaceHolderId placeholder_id) {
|
||||
return ncmContentStorageDeletePlaceHolder(std::addressof(this->srv), Convert(placeholder_id));
|
||||
}
|
||||
|
||||
virtual Result HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) override {
|
||||
Result HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) {
|
||||
return ncmContentStorageHasPlaceHolder(std::addressof(this->srv), out.GetPointer(), Convert(placeholder_id));
|
||||
}
|
||||
|
||||
virtual Result WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, sf::InBuffer data) override {
|
||||
Result WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, sf::InBuffer data) {
|
||||
return ncmContentStorageWritePlaceHolder(std::addressof(this->srv), Convert(placeholder_id), offset, data.GetPointer(), data.GetSize());
|
||||
}
|
||||
|
||||
virtual Result Register(PlaceHolderId placeholder_id, ContentId content_id) override {
|
||||
Result Register(PlaceHolderId placeholder_id, ContentId content_id) {
|
||||
static_assert(alignof(ContentId) < alignof(PlaceHolderId));
|
||||
return ncmContentStorageRegister(std::addressof(this->srv), Convert(content_id), Convert(placeholder_id));
|
||||
}
|
||||
|
||||
virtual Result Delete(ContentId content_id) override {
|
||||
Result Delete(ContentId content_id) {
|
||||
return ncmContentStorageDelete(std::addressof(this->srv), Convert(content_id));
|
||||
}
|
||||
|
||||
virtual Result Has(sf::Out<bool> out, ContentId content_id) override {
|
||||
Result Has(sf::Out<bool> out, ContentId content_id) {
|
||||
return ncmContentStorageHas(std::addressof(this->srv), out.GetPointer(), Convert(content_id));
|
||||
}
|
||||
|
||||
virtual Result GetPath(sf::Out<Path> out, ContentId content_id) override {
|
||||
Result GetPath(sf::Out<Path> out, ContentId content_id) {
|
||||
return ncmContentStorageGetPath(std::addressof(this->srv), out.GetPointer()->str, sizeof(out.GetPointer()->str), Convert(content_id));
|
||||
}
|
||||
|
||||
virtual Result GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) override {
|
||||
Result GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) {
|
||||
return ncmContentStorageGetPlaceHolderPath(std::addressof(this->srv), out.GetPointer()->str, sizeof(out.GetPointer()->str), Convert(placeholder_id));
|
||||
}
|
||||
|
||||
virtual Result CleanupAllPlaceHolder() override {
|
||||
Result CleanupAllPlaceHolder() {
|
||||
return ncmContentStorageCleanupAllPlaceHolder(std::addressof(this->srv));
|
||||
}
|
||||
|
||||
virtual Result ListPlaceHolder(sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf) override {
|
||||
Result ListPlaceHolder(sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf) {
|
||||
return ncmContentStorageListPlaceHolder(std::addressof(this->srv), Convert(out_buf.GetPointer()), out_buf.GetSize(), out_count.GetPointer());
|
||||
}
|
||||
|
||||
virtual Result GetContentCount(sf::Out<s32> out_count) override {
|
||||
Result GetContentCount(sf::Out<s32> out_count) {
|
||||
return ncmContentStorageGetContentCount(std::addressof(this->srv), out_count.GetPointer());
|
||||
}
|
||||
|
||||
virtual Result ListContentId(sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 offset) override {
|
||||
Result ListContentId(sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 offset) {
|
||||
return ncmContentStorageListContentId(std::addressof(this->srv), Convert(out_buf.GetPointer()), out_buf.GetSize(), out_count.GetPointer(), offset);
|
||||
}
|
||||
|
||||
virtual Result GetSizeFromContentId(sf::Out<s64> out_size, ContentId content_id) override {
|
||||
Result GetSizeFromContentId(sf::Out<s64> out_size, ContentId content_id) {
|
||||
return ncmContentStorageGetSizeFromContentId(std::addressof(this->srv), out_size.GetPointer(), Convert(content_id));
|
||||
}
|
||||
|
||||
virtual Result DisableForcibly() override {
|
||||
Result DisableForcibly() {
|
||||
return ncmContentStorageDisableForcibly(std::addressof(this->srv));
|
||||
}
|
||||
|
||||
virtual Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) override {
|
||||
Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) {
|
||||
return ncmContentStorageRevertToPlaceHolder(std::addressof(this->srv), Convert(placeholder_id), Convert(old_content_id), Convert(new_content_id));
|
||||
}
|
||||
|
||||
virtual Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) override {
|
||||
Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) {
|
||||
return ncmContentStorageSetPlaceHolderSize(std::addressof(this->srv), Convert(placeholder_id), size);
|
||||
}
|
||||
|
||||
virtual Result ReadContentIdFile(sf::OutBuffer buf, ContentId content_id, s64 offset) override {
|
||||
Result ReadContentIdFile(sf::OutBuffer buf, ContentId content_id, s64 offset) {
|
||||
return ncmContentStorageReadContentIdFile(std::addressof(this->srv), buf.GetPointer(), buf.GetSize(), Convert(content_id), offset);
|
||||
}
|
||||
|
||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) override {
|
||||
Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromPlaceHolderId(std::addressof(this->srv), std::addressof(rights_id), Convert(placeholder_id)));
|
||||
|
||||
|
@ -133,7 +133,7 @@ namespace ams::ncm {
|
|||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) override {
|
||||
Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromPlaceHolderId(std::addressof(this->srv), std::addressof(rights_id), Convert(placeholder_id)));
|
||||
|
||||
|
@ -142,7 +142,7 @@ namespace ams::ncm {
|
|||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) override {
|
||||
Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromContentId(std::addressof(this->srv), std::addressof(rights_id), Convert(content_id)));
|
||||
|
||||
|
@ -151,7 +151,7 @@ namespace ams::ncm {
|
|||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) override {
|
||||
Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromContentId(std::addressof(this->srv), std::addressof(rights_id), Convert(content_id)));
|
||||
|
||||
|
@ -160,35 +160,36 @@ namespace ams::ncm {
|
|||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result WriteContentForDebug(ContentId content_id, s64 offset, sf::InBuffer data) override {
|
||||
Result WriteContentForDebug(ContentId content_id, s64 offset, sf::InBuffer data) {
|
||||
return ncmContentStorageWriteContentForDebug(std::addressof(this->srv), Convert(content_id), offset, data.GetPointer(), data.GetSize());
|
||||
}
|
||||
|
||||
virtual Result GetFreeSpaceSize(sf::Out<s64> out_size) override {
|
||||
Result GetFreeSpaceSize(sf::Out<s64> out_size) {
|
||||
return ncmContentStorageGetFreeSpaceSize(std::addressof(this->srv), out_size.GetPointer());
|
||||
}
|
||||
|
||||
virtual Result GetTotalSpaceSize(sf::Out<s64> out_size) override {
|
||||
Result GetTotalSpaceSize(sf::Out<s64> out_size) {
|
||||
return ncmContentStorageGetTotalSpaceSize(std::addressof(this->srv), out_size.GetPointer());
|
||||
}
|
||||
|
||||
virtual Result FlushPlaceHolder() override {
|
||||
Result FlushPlaceHolder() {
|
||||
return ncmContentStorageFlushPlaceHolder(std::addressof(this->srv));
|
||||
}
|
||||
|
||||
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out_size, PlaceHolderId placeholder_id) override {
|
||||
Result GetSizeFromPlaceHolderId(sf::Out<s64> out_size, PlaceHolderId placeholder_id) {
|
||||
return ncmContentStorageGetSizeFromPlaceHolderId(std::addressof(this->srv), out_size.GetPointer(), Convert(placeholder_id));
|
||||
}
|
||||
|
||||
virtual Result RepairInvalidFileAttribute() override {
|
||||
Result RepairInvalidFileAttribute() {
|
||||
return ncmContentStorageRepairInvalidFileAttribute(std::addressof(this->srv));
|
||||
}
|
||||
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) override {
|
||||
Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
static_assert(sizeof(::NcmRightsId) == sizeof(ncm::RightsId));
|
||||
::NcmRightsId *out = reinterpret_cast<::NcmRightsId *>(out_rights_id.GetPointer());
|
||||
return ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(std::addressof(this->srv), out, Convert(placeholder_id), Convert(cache_content_id));
|
||||
}
|
||||
};
|
||||
static_assert(ncm::IsIContentStorage<RemoteContentStorageImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,28 +18,29 @@
|
|||
|
||||
namespace ams::pgl {
|
||||
|
||||
class RemoteEventObserver final : public pgl::sf::IEventObserver {
|
||||
class RemoteEventObserver final {
|
||||
NON_COPYABLE(RemoteEventObserver);
|
||||
NON_MOVEABLE(RemoteEventObserver);
|
||||
private:
|
||||
::PglEventObserver observer;
|
||||
public:
|
||||
constexpr RemoteEventObserver(const ::PglEventObserver &o) : observer(o) { /* ... */ }
|
||||
virtual ~RemoteEventObserver() override {
|
||||
~RemoteEventObserver() {
|
||||
::pglEventObserverClose(std::addressof(this->observer));
|
||||
}
|
||||
|
||||
virtual Result GetProcessEventHandle(ams::sf::OutCopyHandle out) override {
|
||||
Result GetProcessEventHandle(ams::sf::OutCopyHandle out) {
|
||||
::Event ev;
|
||||
R_TRY(::pglEventObserverGetProcessEvent(std::addressof(this->observer), std::addressof(ev)));
|
||||
out.SetValue(ev.revent);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) override {
|
||||
Result GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
|
||||
static_assert(sizeof(*out.GetPointer()) == sizeof(::PmProcessEventInfo));
|
||||
return ::pglEventObserverGetProcessEventInfo(std::addressof(this->observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer()));
|
||||
}
|
||||
};
|
||||
static_assert(pgl::sf::IsIEventObserver<RemoteEventObserver>);
|
||||
|
||||
}
|
|
@ -79,7 +79,7 @@ namespace ams::pgl {
|
|||
::PglEventObserver obs;
|
||||
R_TRY(::pglGetEventObserver(std::addressof(obs)));
|
||||
|
||||
auto remote_observer = std::make_shared<RemoteEventObserver>(obs);
|
||||
auto remote_observer = ams::sf::MakeShared<pgl::sf::IEventObserver, RemoteEventObserver>(obs);
|
||||
AMS_ABORT_UNLESS(remote_observer != nullptr);
|
||||
|
||||
*out = pgl::EventObserver(remote_observer);
|
||||
|
|
|
@ -66,13 +66,13 @@ namespace ams::pgl::srv {
|
|||
this->event.Signal();
|
||||
}
|
||||
|
||||
Result EventObserverInterface::GetProcessEventHandle(ams::sf::OutCopyHandle out) {
|
||||
out.SetValue(GetReference(this->observer).GetEvent().GetReadableHandle());
|
||||
Result ShellEventObserver::GetProcessEventHandle(ams::sf::OutCopyHandle out) {
|
||||
out.SetValue(this->GetEvent().GetReadableHandle());
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result EventObserverInterface::GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
|
||||
return GetReference(this->observer).PopEventInfo(out.GetPointer());
|
||||
Result ShellEventObserver::GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
|
||||
return this->PopEventInfo(out.GetPointer());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,23 +56,10 @@ namespace ams::pgl::srv {
|
|||
Result PopEventInfo(pm::ProcessEventInfo *out);
|
||||
|
||||
virtual void Notify(const pm::ProcessEventInfo &info) override final;
|
||||
};
|
||||
|
||||
class EventObserverInterface final : public pgl::sf::IEventObserver {
|
||||
private:
|
||||
TYPED_STORAGE(ShellEventObserver) observer;
|
||||
public:
|
||||
EventObserverInterface() {
|
||||
std::memset(std::addressof(this->observer), 0, sizeof(this->observer));
|
||||
new (GetPointer(this->observer)) ShellEventObserver;
|
||||
}
|
||||
|
||||
~EventObserverInterface() {
|
||||
GetReference(this->observer).~ShellEventObserver();
|
||||
}
|
||||
public:
|
||||
virtual Result GetProcessEventHandle(ams::sf::OutCopyHandle out) override final;
|
||||
virtual Result GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) override final;
|
||||
Result GetProcessEventHandle(ams::sf::OutCopyHandle out);
|
||||
Result GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out);
|
||||
};
|
||||
static_assert(pgl::sf::IsIEventObserver<ShellEventObserver>);
|
||||
|
||||
}
|
||||
|
|
|
@ -69,20 +69,22 @@ namespace ams::pgl::srv {
|
|||
}
|
||||
|
||||
Result ShellInterface::GetShellEventObserver(ams::sf::Out<std::shared_ptr<pgl::sf::IEventObserver>> out) {
|
||||
using Interface = typename pgl::sf::IEventObserver::ImplHolder<ShellEventObserver>;
|
||||
|
||||
/* Allocate a new interface. */
|
||||
auto *observer_memory = this->memory_resource->Allocate(sizeof(EventObserverInterface), alignof(EventObserverInterface));
|
||||
auto *observer_memory = this->memory_resource->Allocate(sizeof(Interface), alignof(Interface));
|
||||
AMS_ABORT_UNLESS(observer_memory != nullptr);
|
||||
|
||||
/* Create the interface object. */
|
||||
new (observer_memory) EventObserverInterface;
|
||||
new (observer_memory) Interface;
|
||||
|
||||
/* Set the output. */
|
||||
out.SetValue(std::shared_ptr<EventObserverInterface>(reinterpret_cast<EventObserverInterface *>(observer_memory), [&](EventObserverInterface *obj) {
|
||||
out.SetValue(std::shared_ptr<pgl::sf::IEventObserver>(reinterpret_cast<Interface *>(observer_memory), [&](Interface *obj) {
|
||||
/* Destroy the object. */
|
||||
obj->~EventObserverInterface();
|
||||
obj->~Interface();
|
||||
|
||||
/* Custom deleter: use the memory resource to free. */
|
||||
this->memory_resource->Deallocate(obj, sizeof(EventObserverInterface), alignof(EventObserverInterface));
|
||||
this->memory_resource->Deallocate(obj, sizeof(Interface), alignof(Interface));
|
||||
}));
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace ams::psc {
|
|||
::PscPmModule module;
|
||||
R_TRY(::pscmGetPmModule(std::addressof(module), static_cast<::PscPmModuleId>(mid), reinterpret_cast<const u16 *>(dependencies), dependency_count, clear_mode == os::EventClearMode_AutoClear));
|
||||
|
||||
this->intf = std::make_shared<RemotePmModule>(module);
|
||||
this->intf = ams::sf::MakeShared<psc::sf::IPmModule, RemotePmModule>(module);
|
||||
this->system_event.AttachReadableHandle(module.event.revent, false, clear_mode);
|
||||
this->initialized = true;
|
||||
return ResultSuccess();
|
||||
|
|
|
@ -18,41 +18,42 @@
|
|||
|
||||
namespace ams::psc {
|
||||
|
||||
class RemotePmModule final : public psc::sf::IPmModule {
|
||||
class RemotePmModule final {
|
||||
NON_COPYABLE(RemotePmModule);
|
||||
NON_MOVEABLE(RemotePmModule);
|
||||
private:
|
||||
::PscPmModule module;
|
||||
public:
|
||||
constexpr RemotePmModule(const ::PscPmModule &m) : module(m) { /* ... */ }
|
||||
virtual ~RemotePmModule() override {
|
||||
~RemotePmModule() {
|
||||
::pscPmModuleClose(std::addressof(this->module));
|
||||
}
|
||||
|
||||
virtual Result Initialize(ams::sf::OutCopyHandle out, psc::PmModuleId module_id, const ams::sf::InBuffer &child_list) override final {
|
||||
Result Initialize(ams::sf::OutCopyHandle out, psc::PmModuleId module_id, const ams::sf::InBuffer &child_list) {
|
||||
/* NOTE: This functionality is already implemented by the libnx command we use to instantiate the PscPmModule. */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result GetRequest(ams::sf::Out<PmState> out_state, ams::sf::Out<PmFlagSet> out_flags) override final {
|
||||
Result GetRequest(ams::sf::Out<PmState> out_state, ams::sf::Out<PmFlagSet> out_flags) {
|
||||
static_assert(sizeof(PmState) == sizeof(::PscPmState));
|
||||
static_assert(sizeof(PmFlagSet) == sizeof(u32));
|
||||
return ::pscPmModuleGetRequest(std::addressof(this->module), reinterpret_cast<::PscPmState *>(out_state.GetPointer()), reinterpret_cast<u32 *>(out_flags.GetPointer()));
|
||||
}
|
||||
|
||||
virtual Result Acknowledge() override final {
|
||||
Result Acknowledge() {
|
||||
/* NOTE: libnx does not separate acknowledge/acknowledgeEx. */
|
||||
return ::pscPmModuleAcknowledge(std::addressof(this->module), static_cast<::PscPmState>(0));
|
||||
}
|
||||
|
||||
virtual Result Finalize() override final {
|
||||
Result Finalize() {
|
||||
return ::pscPmModuleFinalize(std::addressof(this->module));
|
||||
}
|
||||
|
||||
virtual Result AcknowledgeEx(PmState state) override final {
|
||||
Result AcknowledgeEx(PmState state) {
|
||||
static_assert(sizeof(state) == sizeof(::PscPmState));
|
||||
return ::pscPmModuleAcknowledge(std::addressof(this->module), static_cast<::PscPmState>(state));
|
||||
}
|
||||
};
|
||||
static_assert(psc::sf::IsIPmModule<RemotePmModule>);
|
||||
|
||||
}
|
|
@ -20,11 +20,13 @@ namespace ams::sf::hipc::impl {
|
|||
|
||||
namespace {
|
||||
|
||||
class MitmQueryService : public IServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
ShouldMitm = 65000,
|
||||
};
|
||||
#define AMS_SF_HIPC_IMPL_I_MITM_QUERY_SERVICE_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 65000, void, ShouldMitm, (sf::Out<bool> out, const sm::MitmProcessInfo &client_info))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(IMitmQueryService, AMS_SF_HIPC_IMPL_I_MITM_QUERY_SERVICE_INTERFACE_INFO)
|
||||
|
||||
|
||||
class MitmQueryService {
|
||||
private:
|
||||
ServerManagerBase::MitmQueryFunction query_function;
|
||||
public:
|
||||
|
@ -33,11 +35,8 @@ namespace ams::sf::hipc::impl {
|
|||
void ShouldMitm(sf::Out<bool> out, const sm::MitmProcessInfo &client_info) {
|
||||
out.SetValue(this->query_function(client_info));
|
||||
}
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MAKE_SERVICE_COMMAND_META(ShouldMitm),
|
||||
};
|
||||
};
|
||||
static_assert(IsIMitmQueryService<MitmQueryService>);
|
||||
|
||||
/* Globals. */
|
||||
os::Mutex g_query_server_lock(false);
|
||||
|
@ -66,7 +65,7 @@ namespace ams::sf::hipc::impl {
|
|||
g_constructed_server = true;
|
||||
}
|
||||
|
||||
R_ABORT_UNLESS(GetPointer(g_query_server_storage)->RegisterSession(query_handle, cmif::ServiceObjectHolder(std::make_shared<MitmQueryService>(query_func))));
|
||||
R_ABORT_UNLESS(GetPointer(g_query_server_storage)->RegisterSession(query_handle, cmif::ServiceObjectHolder(sf::MakeShared<IMitmQueryService, MitmQueryService>(query_func))));
|
||||
|
||||
if (AMS_UNLIKELY(!g_registered_any)) {
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(g_query_server_process_thread), &QueryServerProcessThreadMain, GetPointer(g_query_server_storage), g_server_process_thread_stack, sizeof(g_server_process_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(mitm_sf, QueryServerProcessThread)));
|
||||
|
|
|
@ -19,15 +19,16 @@ namespace ams::sf::hipc {
|
|||
|
||||
namespace impl {
|
||||
|
||||
class HipcManager : public IServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
ConvertCurrentObjectToDomain = 0,
|
||||
CopyFromCurrentDomain = 1,
|
||||
CloneCurrentObject = 2,
|
||||
QueryPointerBufferSize = 3,
|
||||
CloneCurrentObjectEx = 4,
|
||||
};
|
||||
#define AMS_SF_HIPC_IMPL_I_HIPC_MANAGER_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, ConvertCurrentObjectToDomain, (ams::sf::Out<ams::sf::cmif::DomainObjectId> out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, CopyFromCurrentDomain, (ams::sf::OutMoveHandle out, ams::sf::cmif::DomainObjectId object_id)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2, Result, CloneCurrentObject, (ams::sf::OutMoveHandle out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 3, void, QueryPointerBufferSize, (ams::sf::Out<u16> out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 4, Result, CloneCurrentObjectEx, (ams::sf::OutMoveHandle out, u32 tag))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(IHipcManager, AMS_SF_HIPC_IMPL_I_HIPC_MANAGER_INTERFACE_INFO)
|
||||
|
||||
class HipcManager final {
|
||||
private:
|
||||
ServerDomainSessionManager *manager;
|
||||
ServerSession *session;
|
||||
|
@ -150,16 +151,8 @@ namespace ams::sf::hipc {
|
|||
Result CloneCurrentObjectEx(sf::OutMoveHandle out, u32 tag) {
|
||||
return this->CloneCurrentObjectImpl(out.GetHandlePointer(), this->manager->GetSessionManagerByTag(tag));
|
||||
}
|
||||
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MAKE_SERVICE_COMMAND_META(ConvertCurrentObjectToDomain),
|
||||
MAKE_SERVICE_COMMAND_META(CopyFromCurrentDomain),
|
||||
MAKE_SERVICE_COMMAND_META(CloneCurrentObject),
|
||||
MAKE_SERVICE_COMMAND_META(QueryPointerBufferSize),
|
||||
MAKE_SERVICE_COMMAND_META(CloneCurrentObjectEx),
|
||||
};
|
||||
};
|
||||
static_assert(IsIHipcManager<HipcManager>);
|
||||
|
||||
}
|
||||
|
||||
|
@ -168,7 +161,7 @@ namespace ams::sf::hipc {
|
|||
/* Note: This is safe, as no additional references to the hipc manager can ever be stored. */
|
||||
/* The shared pointer to stack object is definitely gross, though. */
|
||||
impl::HipcManager hipc_manager(this, session);
|
||||
return this->DispatchRequest(cmif::ServiceObjectHolder(std::move(ServiceObjectTraits<impl::HipcManager>::SharedPointerHelper::GetEmptyDeleteSharedPointer(&hipc_manager))), session, in_message, out_message);
|
||||
return this->DispatchRequest(cmif::ServiceObjectHolder(sf::GetSharedPointerTo<impl::IHipcManager>(hipc_manager)), session, in_message, out_message);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
namespace ams::spl::smc {
|
||||
|
||||
Result SetConfig(SplConfigItem which, const u64 *value, size_t num_qwords) {
|
||||
Result SetConfig(spl::ConfigItem which, const u64 *value, size_t num_qwords) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::SetConfig);
|
||||
args.X[1] = which;
|
||||
args.X[1] = static_cast<u64>(which);
|
||||
args.X[2] = 0;
|
||||
for (size_t i = 0; i < std::min(size_t(4), num_qwords); i++) {
|
||||
args.X[3 + i] = value[i];
|
||||
|
@ -31,11 +31,11 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
Result GetConfig(u64 *out, size_t num_qwords, SplConfigItem which) {
|
||||
Result GetConfig(u64 *out, size_t num_qwords, spl::ConfigItem which) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::GetConfig);
|
||||
args.X[1] = which;
|
||||
args.X[1] = static_cast<u64>(which);
|
||||
svcCallSecureMonitor(&args);
|
||||
|
||||
for (size_t i = 0; i < std::min(size_t(4), num_qwords); i++) {
|
||||
|
@ -44,10 +44,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
Result CheckStatus(Result *out, AsyncOperationKey op) {
|
||||
Result GetResult(Result *out, AsyncOperationKey op) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::CheckStatus);
|
||||
args.X[0] = static_cast<u64>(FunctionId::GetResult);
|
||||
args.X[1] = op.value;
|
||||
svcCallSecureMonitor(&args);
|
||||
|
||||
|
@ -55,10 +55,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
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) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::GetResult);
|
||||
args.X[0] = static_cast<u64>(FunctionId::GetResultData);
|
||||
args.X[1] = op.value;
|
||||
args.X[2] = reinterpret_cast<u64>(out_buf);
|
||||
args.X[3] = out_buf_size;
|
||||
|
@ -68,10 +68,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
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) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::ExpMod);
|
||||
args.X[0] = static_cast<u64>(FunctionId::ModularExponentiate);
|
||||
args.X[1] = reinterpret_cast<u64>(base);
|
||||
args.X[2] = reinterpret_cast<u64>(exp);
|
||||
args.X[3] = reinterpret_cast<u64>(mod);
|
||||
|
@ -124,10 +124,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
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) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::CryptAes);
|
||||
args.X[0] = static_cast<u64>(FunctionId::ComputeAes);
|
||||
args.X[1] = mode;
|
||||
args.X[2] = iv_ctr.data64[0];
|
||||
args.X[3] = iv_ctr.data64[1];
|
||||
|
@ -169,10 +169,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
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) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::ReEncryptRsaPrivateKey);
|
||||
args.X[0] = static_cast<u64>(FunctionId::ReencryptDeviceUniqueData);
|
||||
args.X[1] = reinterpret_cast<u64>(&access_key_dec);
|
||||
args.X[2] = reinterpret_cast<u64>(&access_key_enc);
|
||||
args.X[3] = option;
|
||||
|
@ -185,10 +185,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
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) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::DecryptOrImportRsaPrivateKey);
|
||||
args.X[0] = static_cast<u64>(FunctionId::DecryptDeviceUniqueData);
|
||||
args.X[1] = access_key.data64[0];
|
||||
args.X[2] = access_key.data64[1];
|
||||
args.X[3] = static_cast<u32>(mode);
|
||||
|
@ -201,10 +201,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
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) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::SecureExpMod);
|
||||
args.X[0] = static_cast<u64>(FunctionId::ModularExponentiateWithStorageKey);
|
||||
args.X[1] = reinterpret_cast<u64>(base);
|
||||
args.X[2] = reinterpret_cast<u64>(mod);
|
||||
args.X[3] = static_cast<u32>(mode);
|
||||
|
@ -214,10 +214,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
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) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::UnwrapTitleKey);
|
||||
args.X[0] = static_cast<u64>(FunctionId::PrepareEsDeviceUniqueKey);
|
||||
args.X[1] = reinterpret_cast<u64>(base);
|
||||
args.X[2] = reinterpret_cast<u64>(mod);
|
||||
std::memset(&args.X[3], 0, 4 * sizeof(args.X[3]));
|
||||
|
@ -229,10 +229,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
Result LoadTitleKey(u32 keyslot, const AccessKey &access_key) {
|
||||
Result LoadPreparedAesKey(u32 keyslot, const AccessKey &access_key) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::LoadTitleKey);
|
||||
args.X[0] = static_cast<u64>(FunctionId::LoadPreparedAesKey);
|
||||
args.X[1] = keyslot;
|
||||
args.X[2] = access_key.data64[0];
|
||||
args.X[3] = access_key.data64[1];
|
||||
|
@ -241,10 +241,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
Result UnwrapCommonTitleKey(AccessKey *out, const KeySource &source, u32 generation) {
|
||||
Result PrepareCommonEsTitleKey(AccessKey *out, const KeySource &source, u32 generation) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::UnwrapCommonTitleKey);
|
||||
args.X[0] = static_cast<u64>(FunctionId::PrepareCommonEsTitleKey);
|
||||
args.X[1] = source.data64[0];
|
||||
args.X[2] = source.data64[1];
|
||||
args.X[3] = generation;
|
||||
|
@ -257,10 +257,10 @@ namespace ams::spl::smc {
|
|||
|
||||
|
||||
/* 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) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::ImportEsKey);
|
||||
args.X[0] = static_cast<u64>(FunctionId::LoadEsDeviceKey);
|
||||
args.X[1] = access_key.data64[0];
|
||||
args.X[2] = access_key.data64[1];
|
||||
args.X[3] = option;
|
||||
|
@ -273,10 +273,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
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) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::DecryptRsaPrivateKey);
|
||||
args.X[0] = static_cast<u64>(FunctionId::DecryptDeviceUniqueData);
|
||||
args.X[1] = access_key.data64[0];
|
||||
args.X[2] = access_key.data64[1];
|
||||
args.X[3] = option;
|
||||
|
@ -290,10 +290,10 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
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) {
|
||||
SecmonArgs args;
|
||||
|
||||
args.X[0] = static_cast<u64>(FunctionId::ImportSecureExpModKey);
|
||||
args.X[0] = static_cast<u64>(FunctionId::DecryptAndStoreGcKey);
|
||||
args.X[1] = access_key.data64[0];
|
||||
args.X[2] = access_key.data64[1];
|
||||
args.X[3] = option;
|
||||
|
@ -348,19 +348,6 @@ namespace ams::spl::smc {
|
|||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
Result AtmosphereWriteAddress(void *dst, const void *src, size_t size) {
|
||||
AMS_ABORT_UNLESS(size <= sizeof(u64));
|
||||
|
||||
SecmonArgs args;
|
||||
args.X[0] = static_cast<u64>(FunctionId::AtmosphereWriteAddress);
|
||||
args.X[1] = reinterpret_cast<uintptr_t>(dst);
|
||||
__builtin_memcpy(&args.X[1], src, size);
|
||||
args.X[3] = size;
|
||||
svcCallSecureMonitor(&args);
|
||||
|
||||
return static_cast<Result>(args.X[0]);
|
||||
}
|
||||
|
||||
Result AtmosphereGetEmummcConfig(void *out_config, void *out_paths, u32 storage_id) {
|
||||
const u64 paths = reinterpret_cast<u64>(out_paths);
|
||||
AMS_ABORT_UNLESS(util::IsAligned(paths, os::MemoryPageSize));
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace ams::spl {
|
|||
auto is_event_initialized = false;
|
||||
while (true) {
|
||||
R_TRY_CATCH(static_cast<::ams::Result>(f())) {
|
||||
R_CATCH(spl::ResultOutOfKeyslots) {
|
||||
R_CATCH(spl::ResultOutOfKeySlots) {
|
||||
if (!is_event_initialized) {
|
||||
GetAesKeySlotAvailableEvent(std::addressof(event));
|
||||
is_event_initialized = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue