mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-07-06 17:42:14 +02:00
lr: Various helpers
This commit is contained in:
parent
32dc7ff59c
commit
d1138d43c9
@ -20,15 +20,15 @@
|
|||||||
namespace sts::lr {
|
namespace sts::lr {
|
||||||
|
|
||||||
ContentLocationResolverInterface::~ContentLocationResolverInterface() {
|
ContentLocationResolverInterface::~ContentLocationResolverInterface() {
|
||||||
this->program_redirector.ClearRedirections();
|
this->ClearRedirections();
|
||||||
this->debug_program_redirector.ClearRedirections();
|
}
|
||||||
this->app_control_redirector.ClearRedirections();
|
|
||||||
this->html_docs_redirector.ClearRedirections();
|
void ContentLocationResolverInterface::GetContentStoragePath(Path* out, ncm::ContentId content_id) {
|
||||||
this->legal_info_redirector.ClearRedirections();
|
R_ASSERT(this->content_storage->GetPath(out, content_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContentLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
Result ContentLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||||
if (this->program_redirector.FindRedirection(out.pointer, tid)) {
|
if (this->GetRedirectedPath(out.pointer, &this->program_redirector, tid)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
R_ASSERT(this->content_storage->GetPath(out.pointer, program_content_id));
|
this->GetContentStoragePath(out.pointer, program_content_id);
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result ContentLocationResolverInterface::ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
Result ContentLocationResolverInterface::ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||||
if (this->app_control_redirector.FindRedirection(out.pointer, tid)) {
|
if (this->GetRedirectedPath(out.pointer, &this->app_control_redirector, tid)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result ContentLocationResolverInterface::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
Result ContentLocationResolverInterface::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||||
if (this->html_docs_redirector.FindRedirection(out.pointer, tid)) {
|
if (this->GetRedirectedPath(out.pointer, &this->html_docs_redirector, tid)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ namespace sts::lr {
|
|||||||
ncm::ContentId data_content_id;
|
ncm::ContentId data_content_id;
|
||||||
|
|
||||||
R_TRY(this->content_meta_database->GetLatestData(&data_content_id, tid));
|
R_TRY(this->content_meta_database->GetLatestData(&data_content_id, tid));
|
||||||
R_ASSERT(this->content_storage->GetPath(out.pointer, data_content_id));
|
this->GetContentStoragePath(out.pointer, data_content_id);
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result ContentLocationResolverInterface::ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
Result ContentLocationResolverInterface::ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||||
if (this->legal_info_redirector.FindRedirection(out.pointer, tid)) {
|
if (this->GetRedirectedPath(out.pointer, &this->legal_info_redirector, tid)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,16 +99,12 @@ namespace sts::lr {
|
|||||||
Result ContentLocationResolverInterface::Refresh() {
|
Result ContentLocationResolverInterface::Refresh() {
|
||||||
std::shared_ptr<ncm::IContentMetaDatabase> content_meta_database;
|
std::shared_ptr<ncm::IContentMetaDatabase> content_meta_database;
|
||||||
std::shared_ptr<ncm::IContentStorage> content_storage;
|
std::shared_ptr<ncm::IContentStorage> content_storage;
|
||||||
|
|
||||||
R_TRY(ncm::impl::OpenContentMetaDatabase(&content_meta_database, this->storage_id));
|
R_TRY(ncm::impl::OpenContentMetaDatabase(&content_meta_database, this->storage_id));
|
||||||
R_TRY(ncm::impl::OpenContentStorage(&content_storage, this->storage_id));
|
R_TRY(ncm::impl::OpenContentStorage(&content_storage, this->storage_id));
|
||||||
this->content_meta_database = std::move(content_meta_database);
|
this->content_meta_database = std::move(content_meta_database);
|
||||||
this->content_storage = std::move(content_storage);
|
this->content_storage = std::move(content_storage);
|
||||||
|
this->ClearRedirections();
|
||||||
this->program_redirector.ClearRedirections();
|
|
||||||
this->debug_program_redirector.ClearRedirections();
|
|
||||||
this->app_control_redirector.ClearRedirections();
|
|
||||||
this->html_docs_redirector.ClearRedirections();
|
|
||||||
this->legal_info_redirector.ClearRedirections();
|
|
||||||
|
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
@ -119,11 +115,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result ContentLocationResolverInterface::ClearApplicationRedirection() {
|
Result ContentLocationResolverInterface::ClearApplicationRedirection() {
|
||||||
this->program_redirector.ClearRedirections(impl::RedirectionFlags_Application);
|
this->ClearRedirections(impl::RedirectionFlags_Application);
|
||||||
this->debug_program_redirector.ClearRedirections(impl::RedirectionFlags_Application);
|
|
||||||
this->app_control_redirector.ClearRedirections(impl::RedirectionFlags_Application);
|
|
||||||
this->html_docs_redirector.ClearRedirections(impl::RedirectionFlags_Application);
|
|
||||||
this->legal_info_redirector.ClearRedirections(impl::RedirectionFlags_Application);
|
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +140,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result ContentLocationResolverInterface::ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
Result ContentLocationResolverInterface::ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||||
if (this->debug_program_redirector.FindRedirection(out.pointer, tid)) {
|
if (this->GetRedirectedPath(out.pointer, &this->debug_program_redirector, tid)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ namespace sts::lr {
|
|||||||
ContentLocationResolverInterface(ncm::StorageId storage_id) : storage_id(storage_id) { /* ... */ }
|
ContentLocationResolverInterface(ncm::StorageId storage_id) : storage_id(storage_id) { /* ... */ }
|
||||||
|
|
||||||
~ContentLocationResolverInterface();
|
~ContentLocationResolverInterface();
|
||||||
|
private:
|
||||||
|
void GetContentStoragePath(Path* out, ncm::ContentId content_id);
|
||||||
public:
|
public:
|
||||||
virtual Result ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
|
virtual Result ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) override;
|
||||||
virtual Result RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid) override;
|
virtual Result RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid) override;
|
||||||
|
@ -52,6 +52,18 @@ namespace sts::lr {
|
|||||||
impl::LocationRedirector app_control_redirector;
|
impl::LocationRedirector app_control_redirector;
|
||||||
impl::LocationRedirector html_docs_redirector;
|
impl::LocationRedirector html_docs_redirector;
|
||||||
impl::LocationRedirector legal_info_redirector;
|
impl::LocationRedirector legal_info_redirector;
|
||||||
|
protected:
|
||||||
|
bool GetRedirectedPath(Path* out, impl::LocationRedirector* redirector, ncm::TitleId tid) {
|
||||||
|
return redirector->FindRedirection(out, tid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearRedirections(u32 flags = impl::RedirectionFlags_None) {
|
||||||
|
this->program_redirector.ClearRedirections(flags);
|
||||||
|
this->debug_program_redirector.ClearRedirections(flags);
|
||||||
|
this->app_control_redirector.ClearRedirections(flags);
|
||||||
|
this->html_docs_redirector.ClearRedirections(flags);
|
||||||
|
this->legal_info_redirector.ClearRedirections(flags);
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
virtual Result ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid);
|
virtual Result ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid);
|
||||||
virtual Result RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid);
|
virtual Result RedirectProgramPath(InPointer<const Path> path, ncm::TitleId tid);
|
||||||
|
@ -28,7 +28,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result RedirectOnlyLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
Result RedirectOnlyLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||||
if (this->program_redirector.FindRedirection(out.pointer, tid)) {
|
if (this->GetRedirectedPath(out.pointer, &this->program_redirector, tid)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result RedirectOnlyLocationResolverInterface::ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
Result RedirectOnlyLocationResolverInterface::ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||||
if (this->app_control_redirector.FindRedirection(out.pointer, tid)) {
|
if (this->GetRedirectedPath(out.pointer, &this->app_control_redirector, tid)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result RedirectOnlyLocationResolverInterface::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
Result RedirectOnlyLocationResolverInterface::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||||
if (this->html_docs_redirector.FindRedirection(out.pointer, tid)) {
|
if (this->GetRedirectedPath(out.pointer, &this->html_docs_redirector, tid)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result RedirectOnlyLocationResolverInterface::ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
Result RedirectOnlyLocationResolverInterface::ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||||
if (this->legal_info_redirector.FindRedirection(out.pointer, tid)) {
|
if (this->GetRedirectedPath(out.pointer, &this->legal_info_redirector, tid)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ namespace sts::lr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result RedirectOnlyLocationResolverInterface::ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
Result RedirectOnlyLocationResolverInterface::ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
|
||||||
if (this->debug_program_redirector.FindRedirection(out.pointer, tid)) {
|
if (this->GetRedirectedPath(out.pointer, &this->debug_program_redirector, tid)) {
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user