Various command improvements

This commit is contained in:
Adubbz 2019-07-27 21:56:10 +10:00
parent 0169e3e3d6
commit e1023a59ba
15 changed files with 610 additions and 185 deletions

View file

@ -48,7 +48,7 @@ namespace sts::lr {
return ResultSuccess;
}
Result ContentLocationResolverInterface::RedirectProgramPath(ncm::TitleId tid, InPointer<const Path> path) {
Result ContentLocationResolverInterface::RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid) {
this->program_redirector.SetRedirection(tid, *path.pointer);
return ResultSuccess;
}
@ -85,12 +85,12 @@ namespace sts::lr {
return ResultSuccess;
}
Result ContentLocationResolverInterface::RedirectApplicationControlPath(ncm::TitleId tid, InPointer<const Path> path) {
Result ContentLocationResolverInterface::RedirectApplicationControlPath(InPointer<const Path> path, ncm::TitleId tid) {
this->app_control_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
return ResultSuccess;
}
Result ContentLocationResolverInterface::RedirectApplicationHtmlDocumentPath(ncm::TitleId tid, InPointer<const Path> path) {
Result ContentLocationResolverInterface::RedirectApplicationHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid) {
this->html_docs_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
return ResultSuccess;
}
@ -106,7 +106,7 @@ namespace sts::lr {
return ResultLrLegalInformationNotFound;
}
Result ContentLocationResolverInterface::RedirectApplicationLegalInformationPath(ncm::TitleId tid, InPointer<const Path> path) {
Result ContentLocationResolverInterface::RedirectApplicationLegalInformationPath(InPointer<const Path> path, ncm::TitleId tid) {
this->legal_info_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
return ResultSuccess;
}
@ -128,7 +128,7 @@ namespace sts::lr {
return ResultSuccess;
}
Result ContentLocationResolverInterface::RedirectApplicationProgramPath(ncm::TitleId tid, InPointer<const Path> path) {
Result ContentLocationResolverInterface::RedirectApplicationProgramPath(InPointer<const Path> path, ncm::TitleId tid) {
this->program_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
return ResultSuccess;
}
@ -180,12 +180,12 @@ namespace sts::lr {
return ResultSuccess;
}
Result ContentLocationResolverInterface::RedirectProgramPathForDebug(ncm::TitleId tid, InPointer<const Path> path) {
Result ContentLocationResolverInterface::RedirectProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) {
this->debug_program_redirector.SetRedirection(tid, *path.pointer);
return ResultSuccess;
}
Result ContentLocationResolverInterface::RedirectApplicationProgramPathForDebug(ncm::TitleId tid, InPointer<const Path> path) {
Result ContentLocationResolverInterface::RedirectApplicationProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) {
this->debug_program_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
return ResultSuccess;
}

View file

@ -26,6 +26,29 @@
namespace sts::lr {
class ContentLocationResolverInterface : public ILocationResolver {
private:
enum class CommandId {
ResolveProgramPath = 0,
RedirectProgramPath = 1,
ResolveApplicationControlPath = 2,
ResolveApplicationHtmlDocumentPath = 3,
ResolveDataPath = 4,
RedirectApplicationControlPath = 5,
RedirectApplicationHtmlDocumentPath = 6,
ResolveApplicationLegalInformationPath = 7,
RedirectApplicationLegalInformationPath = 8,
Refresh = 9,
RedirectApplicationProgramPath = 10,
ClearApplicationRedirection = 11,
EraseProgramRedirection = 12,
EraseApplicationControlRedirection = 13,
EraseApplicationHtmlDocumentRedirection = 14,
EraseApplicationLegalInformationRedirection = 15,
ResolveProgramPathForDebug = 16,
RedirectProgramPathForDebug = 17,
RedirectApplicationProgramPathForDebug = 18,
EraseProgramRedirectionForDebug = 19,
};
private:
ncm::StorageId storage_id;
std::shared_ptr<ncm::IContentMetaDatabase> content_meta_database;
@ -37,24 +60,24 @@ namespace sts::lr {
~ContentLocationResolverInterface();
public:
virtual Result ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result RedirectProgramPath(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result ResolveDataPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result RedirectApplicationControlPath(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectApplicationHtmlDocumentPath(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectApplicationControlPath(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result RedirectApplicationHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result RedirectApplicationLegalInformationPath(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectApplicationLegalInformationPath(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result Refresh() override;
virtual Result RedirectApplicationProgramPath(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectApplicationProgramPath(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result ClearApplicationRedirection() override;
virtual Result EraseProgramRedirection(ncm::TitleId tid) override;
virtual Result EraseApplicationControlRedirection(ncm::TitleId tid) override;
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::TitleId tid) override;
virtual Result EraseApplicationLegalInformationRedirection(ncm::TitleId tid) override;
virtual Result ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result RedirectProgramPathForDebug(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectApplicationProgramPathForDebug(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result RedirectApplicationProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result EraseProgramRedirectionForDebug(ncm::TitleId tid) override;
public:
DEFINE_SERVICE_DISPATCH_TABLE {

View file

@ -0,0 +1,101 @@
/*
* Copyright (c) 2019 Adubbz
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "lr_ilocationresolver.hpp"
namespace sts::lr {
Result ILocationResolver::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::ResolveDataPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::RedirectApplicationControlPath(InPointer<const Path> path, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::RedirectApplicationHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::RedirectApplicationLegalInformationPath(InPointer<const Path> path, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::Refresh() {
std::abort();
}
Result ILocationResolver::RedirectApplicationProgramPath(InPointer<const Path> path, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::ClearApplicationRedirection() {
std::abort();
}
Result ILocationResolver::EraseProgramRedirection(ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::EraseApplicationControlRedirection(ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::EraseApplicationHtmlDocumentRedirection(ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::EraseApplicationLegalInformationRedirection(ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::RedirectProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::RedirectApplicationProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) {
std::abort();
}
Result ILocationResolver::EraseProgramRedirectionForDebug(ncm::TitleId tid) {
std::abort();
}
}

View file

@ -23,29 +23,6 @@
namespace sts::lr {
class ILocationResolver : public IServiceObject {
protected:
enum class CommandId {
ResolveProgramPath = 0,
RedirectProgramPath = 1,
ResolveApplicationControlPath = 2,
ResolveApplicationHtmlDocumentPath = 3,
ResolveDataPath = 4,
RedirectApplicationControlPath = 5,
RedirectApplicationHtmlDocumentPath = 6,
ResolveApplicationLegalInformationPath = 7,
RedirectApplicationLegalInformationPath = 8,
Refresh = 9,
RedirectApplicationProgramPath = 10,
ClearApplicationRedirection = 11,
EraseProgramRedirection = 12,
EraseApplicationControlRedirection = 13,
EraseApplicationHtmlDocumentRedirection = 14,
EraseApplicationLegalInformationRedirection = 15,
ResolveProgramPathForDebug = 16,
RedirectProgramPathForDebug = 17,
RedirectApplicationProgramPathForDebug = 18,
EraseProgramRedirectionForDebug = 19,
};
protected:
impl::LocationRedirector program_redirector;
impl::LocationRedirector debug_program_redirector;
@ -53,26 +30,26 @@ namespace sts::lr {
impl::LocationRedirector html_docs_redirector;
impl::LocationRedirector legal_info_redirector;
public:
virtual Result ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) = 0;
virtual Result RedirectProgramPath(ncm::TitleId tid, InPointer<const Path> path) = 0;
virtual Result ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) = 0;
virtual Result ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) = 0;
virtual Result ResolveDataPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) = 0;
virtual Result RedirectApplicationControlPath(ncm::TitleId tid, InPointer<const Path> path) = 0;
virtual Result RedirectApplicationHtmlDocumentPath(ncm::TitleId tid, InPointer<const Path> path) = 0;
virtual Result ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) = 0;
virtual Result RedirectApplicationLegalInformationPath(ncm::TitleId tid, InPointer<const Path> path) = 0;
virtual Result Refresh() = 0;
virtual Result RedirectApplicationProgramPath(ncm::TitleId tid, InPointer<const Path> path) = 0;
virtual Result ClearApplicationRedirection() = 0;
virtual Result EraseProgramRedirection(ncm::TitleId tid) = 0;
virtual Result EraseApplicationControlRedirection(ncm::TitleId tid) = 0;
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::TitleId tid) = 0;
virtual Result EraseApplicationLegalInformationRedirection(ncm::TitleId tid) = 0;
virtual Result ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) = 0;
virtual Result RedirectProgramPathForDebug(ncm::TitleId tid, InPointer<const Path> path) = 0;
virtual Result RedirectApplicationProgramPathForDebug(ncm::TitleId tid, InPointer<const Path> path) = 0;
virtual Result EraseProgramRedirectionForDebug(ncm::TitleId tid) = 0;
virtual Result ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid);
virtual Result RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid);
virtual Result ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid);
virtual Result ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid);
virtual Result ResolveDataPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid);
virtual Result RedirectApplicationControlPath(InPointer<const Path> path, ncm::TitleId tid);
virtual Result RedirectApplicationHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid);
virtual Result ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid);
virtual Result RedirectApplicationLegalInformationPath(InPointer<const Path> path, ncm::TitleId tid);
virtual Result Refresh();
virtual Result RedirectApplicationProgramPath(InPointer<const Path> path, ncm::TitleId tid);
virtual Result ClearApplicationRedirection();
virtual Result EraseProgramRedirection(ncm::TitleId tid);
virtual Result EraseApplicationControlRedirection(ncm::TitleId tid);
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::TitleId tid);
virtual Result EraseApplicationLegalInformationRedirection(ncm::TitleId tid);
virtual Result ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid);
virtual Result RedirectProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid);
virtual Result RedirectApplicationProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid);
virtual Result EraseProgramRedirectionForDebug(ncm::TitleId tid);
public:
DEFINE_SERVICE_DISPATCH_TABLE {};

View file

@ -38,7 +38,7 @@ namespace sts::lr {
return ResultLrProgramNotFound;
}
Result RedirectOnlyLocationResolverInterface::RedirectProgramPath(ncm::TitleId tid, InPointer<const Path> path) {
Result RedirectOnlyLocationResolverInterface::RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid) {
this->program_redirector.SetRedirection(tid, *path.pointer);
return ResultSuccess;
}
@ -69,12 +69,12 @@ namespace sts::lr {
return ResultLrDataNotFound;
}
Result RedirectOnlyLocationResolverInterface::RedirectApplicationControlPath(ncm::TitleId tid, InPointer<const Path> path) {
Result RedirectOnlyLocationResolverInterface::RedirectApplicationControlPath(InPointer<const Path> path, ncm::TitleId tid) {
this->app_control_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
return ResultSuccess;
}
Result RedirectOnlyLocationResolverInterface::RedirectApplicationHtmlDocumentPath(ncm::TitleId tid, InPointer<const Path> path) {
Result RedirectOnlyLocationResolverInterface::RedirectApplicationHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid) {
this->html_docs_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
return ResultSuccess;
}
@ -90,7 +90,7 @@ namespace sts::lr {
return ResultLrLegalInformationNotFound;
}
Result RedirectOnlyLocationResolverInterface::RedirectApplicationLegalInformationPath(ncm::TitleId tid, InPointer<const Path> path) {
Result RedirectOnlyLocationResolverInterface::RedirectApplicationLegalInformationPath(InPointer<const Path> path, ncm::TitleId tid) {
this->legal_info_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
return ResultSuccess;
}
@ -104,7 +104,7 @@ namespace sts::lr {
return ResultSuccess;
}
Result RedirectOnlyLocationResolverInterface::RedirectApplicationProgramPath(ncm::TitleId tid, InPointer<const Path> path) {
Result RedirectOnlyLocationResolverInterface::RedirectApplicationProgramPath(InPointer<const Path> path, ncm::TitleId tid) {
this->program_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
return ResultSuccess;
}
@ -156,12 +156,12 @@ namespace sts::lr {
return ResultSuccess;
}
Result RedirectOnlyLocationResolverInterface::RedirectProgramPathForDebug(ncm::TitleId tid, InPointer<const Path> path) {
Result RedirectOnlyLocationResolverInterface::RedirectProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) {
this->debug_program_redirector.SetRedirection(tid, *path.pointer);
return ResultSuccess;
}
Result RedirectOnlyLocationResolverInterface::RedirectApplicationProgramPathForDebug(ncm::TitleId tid, InPointer<const Path> path) {
Result RedirectOnlyLocationResolverInterface::RedirectApplicationProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) {
this->debug_program_redirector.SetRedirection(tid, *path.pointer, impl::RedirectionFlags_Application);
return ResultSuccess;
}

View file

@ -23,28 +23,51 @@
namespace sts::lr {
class RedirectOnlyLocationResolverInterface : public ILocationResolver {
private:
enum class CommandId {
ResolveProgramPath = 0,
RedirectProgramPath = 1,
ResolveApplicationControlPath = 2,
ResolveApplicationHtmlDocumentPath = 3,
ResolveDataPath = 4,
RedirectApplicationControlPath = 5,
RedirectApplicationHtmlDocumentPath = 6,
ResolveApplicationLegalInformationPath = 7,
RedirectApplicationLegalInformationPath = 8,
Refresh = 9,
RedirectApplicationProgramPath = 10,
ClearApplicationRedirection = 11,
EraseProgramRedirection = 12,
EraseApplicationControlRedirection = 13,
EraseApplicationHtmlDocumentRedirection = 14,
EraseApplicationLegalInformationRedirection = 15,
ResolveProgramPathForDebug = 16,
RedirectProgramPathForDebug = 17,
RedirectApplicationProgramPathForDebug = 18,
EraseProgramRedirectionForDebug = 19,
};
public:
~RedirectOnlyLocationResolverInterface();
public:
virtual Result ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result RedirectProgramPath(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result ResolveDataPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result RedirectApplicationControlPath(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectApplicationHtmlDocumentPath(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectApplicationControlPath(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result RedirectApplicationHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result RedirectApplicationLegalInformationPath(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectApplicationLegalInformationPath(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result Refresh() override;
virtual Result RedirectApplicationProgramPath(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectApplicationProgramPath(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result ClearApplicationRedirection() override;
virtual Result EraseProgramRedirection(ncm::TitleId tid) override;
virtual Result EraseApplicationControlRedirection(ncm::TitleId tid) override;
virtual Result EraseApplicationHtmlDocumentRedirection(ncm::TitleId tid) override;
virtual Result EraseApplicationLegalInformationRedirection(ncm::TitleId tid) override;
virtual Result ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
virtual Result RedirectProgramPathForDebug(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectApplicationProgramPathForDebug(ncm::TitleId tid, InPointer<const Path> path) override;
virtual Result RedirectProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result RedirectApplicationProgramPathForDebug(InPointer<const Path> path, ncm::TitleId tid) override;
virtual Result EraseProgramRedirectionForDebug(ncm::TitleId tid) override;
public:
DEFINE_SERVICE_DISPATCH_TABLE {

View file

@ -42,7 +42,7 @@ namespace sts::lr {
return ResultSuccess;
}
Result RegisteredLocationResolverInterface::RegisterProgramPath(ncm::TitleId tid, InPointer<const Path> path) {
Result RegisteredLocationResolverInterface::RegisterProgramPath(InPointer<const Path> path, ncm::TitleId tid) {
Path tmp_path = *path.pointer;
if (!this->registered_program_redirector.SetRedirection(tid, tmp_path)) {
@ -58,7 +58,7 @@ namespace sts::lr {
return ResultSuccess;
}
Result RegisteredLocationResolverInterface::RedirectProgramPath(ncm::TitleId tid, InPointer<const Path> path) {
Result RegisteredLocationResolverInterface::RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid) {
Path tmp_path = *path.pointer;
this->program_redirector.SetRedirection(tid, tmp_path);
return ResultSuccess;
@ -77,7 +77,7 @@ namespace sts::lr {
return ResultLrHtmlDocumentNotFound;
}
Result RegisteredLocationResolverInterface::RegisterHtmlDocumentPath(ncm::TitleId tid, InPointer<const Path> path) {
Result RegisteredLocationResolverInterface::RegisterHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid) {
Path tmp_path = *path.pointer;
if (!this->registered_html_docs_redirector.SetRedirection(tid, tmp_path)) {
@ -93,7 +93,7 @@ namespace sts::lr {
return ResultSuccess;
}
Result RegisteredLocationResolverInterface::RedirectHtmlDocumentPath(ncm::TitleId tid, InPointer<const Path> path) {
Result RegisteredLocationResolverInterface::RedirectHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid) {
Path tmp_path = *path.pointer;
this->html_docs_redirector.SetRedirection(tid, tmp_path);
return ResultSuccess;

View file

@ -46,13 +46,13 @@ namespace sts::lr {
~RegisteredLocationResolverInterface();
Result ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid);
Result RegisterProgramPath(ncm::TitleId tid, InPointer<const Path> path);
Result RegisterProgramPath(InPointer<const Path> path, ncm::TitleId tid);
Result UnregisterProgramPath(ncm::TitleId tid);
Result RedirectProgramPath(ncm::TitleId tid, InPointer<const Path> path);
Result RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid);
Result ResolveHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid);
Result RegisterHtmlDocumentPath(ncm::TitleId tid, InPointer<const Path> path);
Result RegisterHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid);
Result UnregisterHtmlDocumentPath(ncm::TitleId tid);
Result RedirectHtmlDocumentPath(ncm::TitleId tid, InPointer<const Path> path);
Result RedirectHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid);
Result Refresh();
public:
DEFINE_SERVICE_DISPATCH_TABLE {

View file

@ -23,6 +23,30 @@
namespace sts::ncm {
class ContentMetaDatabaseInterface : public IContentMetaDatabase {
private:
enum class CommandId {
Set = 0,
Get = 1,
Remove = 2,
GetContentIdByType = 3,
ListContentInfo = 4,
List = 5,
GetLatestContentMetaKey = 6,
ListApplication = 7,
Has = 8,
HasAll = 9,
GetSize = 10,
GetRequiredSystemVersion = 11,
GetPatchId = 12,
DisableForcibly = 13,
LookupOrphanContent = 14,
Commit = 15,
HasContent = 16,
ListContentMetaInfo = 17,
GetAttributes = 18,
GetRequiredApplicationVersion = 19,
GetContentIdByTypeAndIdOffset = 20,
};
public:
ContentMetaDatabaseInterface(sts::kvdb::MemoryKeyValueStore<ContentMetaKey>* kvs, const char* mount_name) : IContentMetaDatabase(kvs, mount_name) {
}
@ -84,6 +108,30 @@ namespace sts::ncm {
};
class OnMemoryContentMetaDatabaseInterface : public ContentMetaDatabaseInterface {
private:
enum class CommandId {
Set = 0,
Get = 1,
Remove = 2,
GetContentIdByType = 3,
ListContentInfo = 4,
List = 5,
GetLatestContentMetaKey = 6,
ListApplication = 7,
Has = 8,
HasAll = 9,
GetSize = 10,
GetRequiredSystemVersion = 11,
GetPatchId = 12,
DisableForcibly = 13,
LookupOrphanContent = 14,
Commit = 15,
HasContent = 16,
ListContentMetaInfo = 17,
GetAttributes = 18,
GetRequiredApplicationVersion = 19,
GetContentIdByTypeAndIdOffset = 20,
};
public:
OnMemoryContentMetaDatabaseInterface(sts::kvdb::MemoryKeyValueStore<ContentMetaKey>* kvs) : ContentMetaDatabaseInterface(kvs) {
}

View file

@ -25,6 +25,37 @@
namespace sts::ncm {
class ContentStorageInterface : public IContentStorage {
private:
enum class CommandId {
GeneratePlaceHolderId = 0,
CreatePlaceHolder = 1,
DeletePlaceHolder = 2,
HasPlaceHolder = 3,
WritePlaceHolder = 4,
Register = 5,
Delete = 6,
Has = 7,
GetPath = 8,
GetPlaceHolderPath = 9,
CleanupAllPlaceHolder = 10,
ListPlaceHolder = 11,
GetContentCount = 12,
ListContentId = 13,
GetSizeFromContentId = 14,
DisableForcibly = 15,
RevertToPlaceHolder = 16,
SetPlaceHolderSize = 17,
ReadContentIdFile = 18,
GetRightsIdFromPlaceHolderId = 19,
GetRightsIdFromContentId = 20,
WriteContentForDebug = 21,
GetFreeSpaceSize = 22,
GetTotalSpaceSize = 23,
FlushPlaceHolder = 24,
GetSizeFromPlaceHolderId = 25,
RepairInvalidFileAttribute = 26,
GetRightsIdFromPlaceHolderIdWithCache = 27,
};
protected:
impl::PlaceHolderAccessor placeholder_accessor;
ContentId cached_content_id;

View file

@ -0,0 +1,113 @@
/*
* Copyright (c) 2019 Adubbz
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ncm_icontentmetadatabase.hpp"
namespace sts::ncm {
Result IContentMetaDatabase::Set(ContentMetaKey key, InBuffer<u8> value) {
std::abort();
}
Result IContentMetaDatabase::Get(Out<u64> out_size, ContentMetaKey key, OutBuffer<u8> out_value) {
std::abort();
}
Result IContentMetaDatabase::Remove(ContentMetaKey key) {
std::abort();
}
Result IContentMetaDatabase::GetContentIdByType(Out<ContentId> out_content_id, ContentMetaKey key, ContentType type) {
std::abort();
}
Result IContentMetaDatabase::ListContentInfo(Out<u32> out_entries_written, OutBuffer<ContentInfo> out_info, ContentMetaKey key, u32 start_index) {
std::abort();
}
Result IContentMetaDatabase::List(Out<u32> out_entries_total, Out<u32> out_entries_written, OutBuffer<ContentMetaKey> out_info, ContentMetaType type, TitleId application_title_id, TitleId title_id_min, TitleId title_id_max, ContentInstallType install_type) {
std::abort();
}
Result IContentMetaDatabase::GetLatestContentMetaKey(Out<ContentMetaKey> out_key, TitleId title_id) {
std::abort();
}
Result IContentMetaDatabase::ListApplication(Out<u32> out_entries_total, Out<u32> out_entries_written, OutBuffer<ApplicationContentMetaKey> out_keys, ContentMetaType type) {
std::abort();
}
Result IContentMetaDatabase::Has(Out<bool> out, ContentMetaKey key) {
std::abort();
}
Result IContentMetaDatabase::HasAll(Out<bool> out, InBuffer<ContentMetaKey> keys) {
std::abort();
}
Result IContentMetaDatabase::GetSize(Out<u64> out_size, ContentMetaKey key) {
std::abort();
}
Result IContentMetaDatabase::GetRequiredSystemVersion(Out<u32> out_version, ContentMetaKey key) {
std::abort();
}
Result IContentMetaDatabase::GetPatchId(Out<TitleId> out_patch_id, ContentMetaKey key) {
std::abort();
}
Result IContentMetaDatabase::DisableForcibly() {
std::abort();
}
Result IContentMetaDatabase::LookupOrphanContent(OutBuffer<bool> out_orphaned, InBuffer<ContentId> content_ids) {
std::abort();
}
Result IContentMetaDatabase::Commit() {
std::abort();
}
Result IContentMetaDatabase::HasContent(Out<bool> out, ContentMetaKey key, ContentId content_id) {
std::abort();
}
Result IContentMetaDatabase::ListContentMetaInfo(Out<u32> out_entries_written, OutBuffer<ContentMetaInfo> out_meta_info, ContentMetaKey key, u32 start_index) {
std::abort();
}
Result IContentMetaDatabase::GetAttributes(Out<ContentMetaAttribute> out_attributes, ContentMetaKey key) {
std::abort();
}
Result IContentMetaDatabase::GetRequiredApplicationVersion(Out<u32> out_version, ContentMetaKey key) {
std::abort();
}
Result IContentMetaDatabase::GetContentIdByTypeAndIdOffset(Out<ContentId> out_content_id, ContentMetaKey key, ContentType type, u8 id_offset) {
std::abort();
}
Result IContentMetaDatabase::GetLatestProgram(ContentId* out_content_id, TitleId title_id) {
std::abort();
}
Result IContentMetaDatabase::GetLatestData(ContentId* out_content_id, TitleId title_id) {
std::abort();
}
}

View file

@ -24,30 +24,6 @@
namespace sts::ncm {
class IContentMetaDatabase : public IServiceObject {
protected:
enum class CommandId {
Set = 0,
Get = 1,
Remove = 2,
GetContentIdByType = 3,
ListContentInfo = 4,
List = 5,
GetLatestContentMetaKey = 6,
ListApplication = 7,
Has = 8,
HasAll = 9,
GetSize = 10,
GetRequiredSystemVersion = 11,
GetPatchId = 12,
DisableForcibly = 13,
LookupOrphanContent = 14,
Commit = 15,
HasContent = 16,
ListContentMetaInfo = 17,
GetAttributes = 18,
GetRequiredApplicationVersion = 19,
GetContentIdByTypeAndIdOffset = 20,
};
protected:
sts::kvdb::MemoryKeyValueStore<ContentMetaKey>* kvs;
char mount_name[16];
@ -65,31 +41,31 @@ namespace sts::ncm {
}
public:
/* Actual commands. */
virtual Result Set(ContentMetaKey key, InBuffer<u8> value) = 0;
virtual Result Get(Out<u64> out_size, ContentMetaKey key, OutBuffer<u8> out_value) = 0;
virtual Result Remove(ContentMetaKey key) = 0;
virtual Result GetContentIdByType(Out<ContentId> out_content_id, ContentMetaKey key, ContentType type) = 0;
virtual Result ListContentInfo(Out<u32> out_entries_written, OutBuffer<ContentInfo> out_info, ContentMetaKey key, u32 start_index) = 0;
virtual Result List(Out<u32> out_entries_total, Out<u32> out_entries_written, OutBuffer<ContentMetaKey> out_info, ContentMetaType meta_type, TitleId application_title_id, TitleId title_id_min, TitleId title_id_max, ContentInstallType install_type) = 0;
virtual Result GetLatestContentMetaKey(Out<ContentMetaKey> out_key, TitleId tid) = 0;
virtual Result ListApplication(Out<u32> out_entries_total, Out<u32> out_entries_written, OutBuffer<ApplicationContentMetaKey> out_keys, ContentMetaType meta_type) = 0;
virtual Result Has(Out<bool> out, ContentMetaKey key) = 0;
virtual Result HasAll(Out<bool> out, InBuffer<ContentMetaKey> keys) = 0;
virtual Result GetSize(Out<u64> out_size, ContentMetaKey key) = 0;
virtual Result GetRequiredSystemVersion(Out<u32> out_version, ContentMetaKey key) = 0;
virtual Result GetPatchId(Out<TitleId> out_patch_id, ContentMetaKey key) = 0;
virtual Result DisableForcibly() = 0;
virtual Result LookupOrphanContent(OutBuffer<bool> out_orphaned, InBuffer<ContentId> content_ids) = 0;
virtual Result Commit() = 0;
virtual Result HasContent(Out<bool> out, ContentMetaKey key, ContentId content_id) = 0;
virtual Result ListContentMetaInfo(Out<u32> out_entries_written, OutBuffer<ContentMetaInfo> out_meta_info, ContentMetaKey key, u32 start_index) = 0;
virtual Result GetAttributes(Out<ContentMetaAttribute> out_attributes, ContentMetaKey key) = 0;
virtual Result GetRequiredApplicationVersion(Out<u32> out_version, ContentMetaKey key) = 0;
virtual Result GetContentIdByTypeAndIdOffset(Out<ContentId> out_content_id, ContentMetaKey key, ContentType type, u8 id_offset) = 0;
virtual Result Set(ContentMetaKey key, InBuffer<u8> value);
virtual Result Get(Out<u64> out_size, ContentMetaKey key, OutBuffer<u8> out_value);
virtual Result Remove(ContentMetaKey key);
virtual Result GetContentIdByType(Out<ContentId> out_content_id, ContentMetaKey key, ContentType type);
virtual Result ListContentInfo(Out<u32> out_entries_written, OutBuffer<ContentInfo> out_info, ContentMetaKey key, u32 start_index);
virtual Result List(Out<u32> out_entries_total, Out<u32> out_entries_written, OutBuffer<ContentMetaKey> out_info, ContentMetaType meta_type, TitleId application_title_id, TitleId title_id_min, TitleId title_id_max, ContentInstallType install_type);
virtual Result GetLatestContentMetaKey(Out<ContentMetaKey> out_key, TitleId tid);
virtual Result ListApplication(Out<u32> out_entries_total, Out<u32> out_entries_written, OutBuffer<ApplicationContentMetaKey> out_keys, ContentMetaType meta_type);
virtual Result Has(Out<bool> out, ContentMetaKey key);
virtual Result HasAll(Out<bool> out, InBuffer<ContentMetaKey> keys);
virtual Result GetSize(Out<u64> out_size, ContentMetaKey key);
virtual Result GetRequiredSystemVersion(Out<u32> out_version, ContentMetaKey key);
virtual Result GetPatchId(Out<TitleId> out_patch_id, ContentMetaKey key);
virtual Result DisableForcibly();
virtual Result LookupOrphanContent(OutBuffer<bool> out_orphaned, InBuffer<ContentId> content_ids);
virtual Result Commit();
virtual Result HasContent(Out<bool> out, ContentMetaKey key, ContentId content_id);
virtual Result ListContentMetaInfo(Out<u32> out_entries_written, OutBuffer<ContentMetaInfo> out_meta_info, ContentMetaKey key, u32 start_index);
virtual Result GetAttributes(Out<ContentMetaAttribute> out_attributes, ContentMetaKey key);
virtual Result GetRequiredApplicationVersion(Out<u32> out_version, ContentMetaKey key);
virtual Result GetContentIdByTypeAndIdOffset(Out<ContentId> out_content_id, ContentMetaKey key, ContentType type, u8 id_offset);
/* APIs. */
virtual Result GetLatestProgram(ContentId* out_content_id, TitleId title_id) = 0;
virtual Result GetLatestData(ContentId* out_content_id, TitleId title_id) = 0;
virtual Result GetLatestProgram(ContentId* out_content_id, TitleId title_id);
virtual Result GetLatestData(ContentId* out_content_id, TitleId title_id);
public:
DEFINE_SERVICE_DISPATCH_TABLE {};
};

View file

@ -0,0 +1,133 @@
/*
* Copyright (c) 2019 Adubbz
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ncm_icontentstorage.hpp"
namespace sts::ncm {
Result IContentStorage::GeneratePlaceHolderId(Out<PlaceHolderId> out) {
std::abort();
}
Result IContentStorage::CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, u64 size) {
std::abort();
}
Result IContentStorage::DeletePlaceHolder(PlaceHolderId placeholder_id) {
std::abort();
}
Result IContentStorage::HasPlaceHolder(Out<bool> out, PlaceHolderId placeholder_id) {
std::abort();
}
Result IContentStorage::WritePlaceHolder(PlaceHolderId placeholder_id, u64 offset, InBuffer<u8> data) {
std::abort();
}
Result IContentStorage::Register(PlaceHolderId placeholder_id, ContentId content_id) {
std::abort();
}
Result IContentStorage::Delete(ContentId content_id) {
std::abort();
}
Result IContentStorage::Has(Out<bool> out, ContentId content_id) {
std::abort();
}
Result IContentStorage::GetPath(OutPointerWithServerSize<lr::Path, 0x1> out, ContentId content_id) {
std::abort();
}
Result IContentStorage::GetPlaceHolderPath(OutPointerWithServerSize<lr::Path, 0x1> out, PlaceHolderId placeholder_id) {
std::abort();
}
Result IContentStorage::CleanupAllPlaceHolder() {
std::abort();
}
Result IContentStorage::ListPlaceHolder(Out<u32> out_count, OutBuffer<PlaceHolderId> out_buf) {
std::abort();
}
Result IContentStorage::GetContentCount(Out<u32> out_count) {
std::abort();
}
Result IContentStorage::ListContentId(Out<u32> out_count, OutBuffer<ContentId> out_buf, u32 start_offset) {
std::abort();
}
Result IContentStorage::GetSizeFromContentId(Out<u64> out_size, ContentId content_id) {
std::abort();
}
Result IContentStorage::DisableForcibly() {
std::abort();
}
Result IContentStorage::RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) {
std::abort();
}
Result IContentStorage::SetPlaceHolderSize(PlaceHolderId placeholder_id, u64 size) {
std::abort();
}
Result IContentStorage::ReadContentIdFile(OutBuffer<u8> buf, ContentId content_id, u64 offset) {
std::abort();
}
Result IContentStorage::GetRightsIdFromPlaceHolderId(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, PlaceHolderId placeholder_id) {
std::abort();
}
Result IContentStorage::GetRightsIdFromContentId(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, ContentId content_id) {
std::abort();
}
Result IContentStorage::WriteContentForDebug(ContentId content_id, u64 offset, InBuffer<u8> data) {
std::abort();
}
Result IContentStorage::GetFreeSpaceSize(Out<u64> out_size) {
std::abort();
}
Result IContentStorage::GetTotalSpaceSize(Out<u64> out_size) {
std::abort();
}
Result IContentStorage::FlushPlaceHolder() {
std::abort();
}
Result IContentStorage::GetSizeFromPlaceHolderId(Out<u64> out_size, PlaceHolderId placeholder_id) {
std::abort();
}
Result IContentStorage::RepairInvalidFileAttribute() {
std::abort();
}
Result IContentStorage::GetRightsIdFromPlaceHolderIdWithCache(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, PlaceHolderId placeholder_id, ContentId cache_content_id) {
std::abort();
}
}

View file

@ -24,70 +24,39 @@
namespace sts::ncm {
class IContentStorage : public IServiceObject {
protected:
enum class CommandId {
GeneratePlaceHolderId = 0,
CreatePlaceHolder = 1,
DeletePlaceHolder = 2,
HasPlaceHolder = 3,
WritePlaceHolder = 4,
Register = 5,
Delete = 6,
Has = 7,
GetPath = 8,
GetPlaceHolderPath = 9,
CleanupAllPlaceHolder = 10,
ListPlaceHolder = 11,
GetContentCount = 12,
ListContentId = 13,
GetSizeFromContentId = 14,
DisableForcibly = 15,
RevertToPlaceHolder = 16,
SetPlaceHolderSize = 17,
ReadContentIdFile = 18,
GetRightsIdFromPlaceHolderId = 19,
GetRightsIdFromContentId = 20,
WriteContentForDebug = 21,
GetFreeSpaceSize = 22,
GetTotalSpaceSize = 23,
FlushPlaceHolder = 24,
GetSizeFromPlaceHolderId = 25,
RepairInvalidFileAttribute = 26,
GetRightsIdFromPlaceHolderIdWithCache = 27,
};
protected:
char root_path[FS_MAX_PATH-1];
MakeContentPathFunc make_content_path_func;
bool disabled;
public:
virtual Result GeneratePlaceHolderId(Out<PlaceHolderId> out) = 0;
virtual Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, u64 size) = 0;
virtual Result DeletePlaceHolder(PlaceHolderId placeholder_id) = 0;
virtual Result HasPlaceHolder(Out<bool> out, PlaceHolderId placeholder_id) = 0;
virtual Result WritePlaceHolder(PlaceHolderId placeholder_id, u64 offset, InBuffer<u8> data) = 0;
virtual Result Register(PlaceHolderId placeholder_id, ContentId content_id) = 0;
virtual Result Delete(ContentId content_id) = 0;
virtual Result Has(Out<bool> out, ContentId content_id) = 0;
virtual Result GetPath(OutPointerWithServerSize<lr::Path, 0x1> out, ContentId content_id) = 0;
virtual Result GetPlaceHolderPath(OutPointerWithServerSize<lr::Path, 0x1> out, PlaceHolderId placeholder_id) = 0;
virtual Result CleanupAllPlaceHolder() = 0;
virtual Result ListPlaceHolder(Out<u32> out_count, OutBuffer<PlaceHolderId> out_buf) = 0;
virtual Result GetContentCount(Out<u32> out_count) = 0;
virtual Result ListContentId(Out<u32> out_count, OutBuffer<ContentId> out_buf, u32 start_offset) = 0;
virtual Result GetSizeFromContentId(Out<u64> 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, u64 size) = 0;
virtual Result ReadContentIdFile(OutBuffer<u8> buf, ContentId content_id, u64 offset) = 0;
virtual Result GetRightsIdFromPlaceHolderId(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, PlaceHolderId placeholder_id) = 0;
virtual Result GetRightsIdFromContentId(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, ContentId content_id) = 0;
virtual Result WriteContentForDebug(ContentId content_id, u64 offset, InBuffer<u8> data) = 0;
virtual Result GetFreeSpaceSize(Out<u64> out_size) = 0;
virtual Result GetTotalSpaceSize(Out<u64> out_size) = 0;
virtual Result FlushPlaceHolder() = 0;
virtual Result GetSizeFromPlaceHolderId(Out<u64> out, PlaceHolderId placeholder_id) = 0;
virtual Result RepairInvalidFileAttribute() = 0;
virtual Result GetRightsIdFromPlaceHolderIdWithCache(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, PlaceHolderId placeholder_id, ContentId cache_content_id) = 0;
virtual Result GeneratePlaceHolderId(Out<PlaceHolderId> out);
virtual Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, u64 size);
virtual Result DeletePlaceHolder(PlaceHolderId placeholder_id);
virtual Result HasPlaceHolder(Out<bool> out, PlaceHolderId placeholder_id);
virtual Result WritePlaceHolder(PlaceHolderId placeholder_id, u64 offset, InBuffer<u8> data);
virtual Result Register(PlaceHolderId placeholder_id, ContentId content_id);
virtual Result Delete(ContentId content_id);
virtual Result Has(Out<bool> out, ContentId content_id);
virtual Result GetPath(OutPointerWithServerSize<lr::Path, 0x1> out, ContentId content_id);
virtual Result GetPlaceHolderPath(OutPointerWithServerSize<lr::Path, 0x1> out, PlaceHolderId placeholder_id);
virtual Result CleanupAllPlaceHolder();
virtual Result ListPlaceHolder(Out<u32> out_count, OutBuffer<PlaceHolderId> out_buf);
virtual Result GetContentCount(Out<u32> out_count);
virtual Result ListContentId(Out<u32> out_count, OutBuffer<ContentId> out_buf, u32 start_offset);
virtual Result GetSizeFromContentId(Out<u64> out_size, ContentId content_id);
virtual Result DisableForcibly();
virtual Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id);
virtual Result SetPlaceHolderSize(PlaceHolderId placeholder_id, u64 size);
virtual Result ReadContentIdFile(OutBuffer<u8> buf, ContentId content_id, u64 offset);
virtual Result GetRightsIdFromPlaceHolderId(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, PlaceHolderId placeholder_id);
virtual Result GetRightsIdFromContentId(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, ContentId content_id);
virtual Result WriteContentForDebug(ContentId content_id, u64 offset, InBuffer<u8> data);
virtual Result GetFreeSpaceSize(Out<u64> out_size);
virtual Result GetTotalSpaceSize(Out<u64> out_size);
virtual Result FlushPlaceHolder();
virtual Result GetSizeFromPlaceHolderId(Out<u64> out, PlaceHolderId placeholder_id);
virtual Result RepairInvalidFileAttribute();
virtual Result GetRightsIdFromPlaceHolderIdWithCache(Out<FsRightsId> out_rights_id, Out<u64> out_key_generation, PlaceHolderId placeholder_id, ContentId cache_content_id);
public:
DEFINE_SERVICE_DISPATCH_TABLE {};
};

View file

@ -23,6 +23,37 @@
namespace sts::ncm {
class ReadOnlyContentStorageInterface : public IContentStorage {
private:
enum class CommandId {
GeneratePlaceHolderId = 0,
CreatePlaceHolder = 1,
DeletePlaceHolder = 2,
HasPlaceHolder = 3,
WritePlaceHolder = 4,
Register = 5,
Delete = 6,
Has = 7,
GetPath = 8,
GetPlaceHolderPath = 9,
CleanupAllPlaceHolder = 10,
ListPlaceHolder = 11,
GetContentCount = 12,
ListContentId = 13,
GetSizeFromContentId = 14,
DisableForcibly = 15,
RevertToPlaceHolder = 16,
SetPlaceHolderSize = 17,
ReadContentIdFile = 18,
GetRightsIdFromPlaceHolderId = 19,
GetRightsIdFromContentId = 20,
WriteContentForDebug = 21,
GetFreeSpaceSize = 22,
GetTotalSpaceSize = 23,
FlushPlaceHolder = 24,
GetSizeFromPlaceHolderId = 25,
RepairInvalidFileAttribute = 26,
GetRightsIdFromPlaceHolderIdWithCache = 27,
};
public:
Result Initialize(const char* root_path, MakeContentPathFunc content_path_func);
public: