2020-03-08 08:06:23 +00:00
|
|
|
/*
|
2021-10-04 19:59:10 +00:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2020-03-08 08:06:23 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <stratosphere/lr/lr_types.hpp>
|
|
|
|
#include <stratosphere/lr/lr_i_location_resolver.hpp>
|
|
|
|
|
|
|
|
namespace ams::lr {
|
|
|
|
|
|
|
|
class LocationResolver {
|
|
|
|
NON_COPYABLE(LocationResolver);
|
|
|
|
private:
|
2021-10-10 07:14:06 +00:00
|
|
|
sf::SharedPointer<ILocationResolver> m_interface;
|
2020-03-08 08:06:23 +00:00
|
|
|
public:
|
2022-03-22 21:02:14 +00:00
|
|
|
LocationResolver() : m_interface(nullptr) { /* ... */ }
|
2021-10-10 07:14:06 +00:00
|
|
|
explicit LocationResolver(sf::SharedPointer<ILocationResolver> intf) : m_interface(intf) { /* ... */ }
|
2020-03-08 08:06:23 +00:00
|
|
|
|
|
|
|
LocationResolver(LocationResolver &&rhs) {
|
2021-10-10 07:14:06 +00:00
|
|
|
m_interface = std::move(rhs.m_interface);
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LocationResolver &operator=(LocationResolver &&rhs) {
|
2021-01-17 15:55:32 +00:00
|
|
|
LocationResolver(std::move(rhs)).swap(*this);
|
2020-03-08 08:06:23 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2021-01-17 15:55:32 +00:00
|
|
|
void swap(LocationResolver &rhs) {
|
2021-10-10 07:14:06 +00:00
|
|
|
std::swap(m_interface, rhs.m_interface);
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
public:
|
|
|
|
Result ResolveProgramPath(Path *out, ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->ResolveProgramPath(out, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RedirectProgramPath(const Path &path, ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
|
|
|
R_ABORT_UNLESS(m_interface->RedirectProgramPath(path, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result ResolveApplicationControlPath(Path *out, ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->ResolveApplicationControlPath(out, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result ResolveApplicationHtmlDocumentPath(Path *out, ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->ResolveApplicationHtmlDocumentPath(out, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result ResolveDataPath(Path *out, ncm::DataId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->ResolveDataPath(out, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2020-04-14 05:19:44 +00:00
|
|
|
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
2021-10-10 07:14:06 +00:00
|
|
|
R_ABORT_UNLESS(m_interface->RedirectApplicationControlPath(path, id, owner_id));
|
2020-03-08 08:06:23 +00:00
|
|
|
} else {
|
2021-10-10 07:14:06 +00:00
|
|
|
R_ABORT_UNLESS(m_interface->RedirectApplicationControlPathDeprecated(path, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2020-04-14 05:19:44 +00:00
|
|
|
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
2021-10-10 07:14:06 +00:00
|
|
|
R_ABORT_UNLESS(m_interface->RedirectApplicationHtmlDocumentPath(path, id, owner_id));
|
2020-03-08 08:06:23 +00:00
|
|
|
} else {
|
2021-10-10 07:14:06 +00:00
|
|
|
R_ABORT_UNLESS(m_interface->RedirectApplicationHtmlDocumentPathDeprecated(path, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Result ResolveApplicationLegalInformationPath(Path *out, ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->ResolveApplicationLegalInformationPath(out, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2020-04-14 05:19:44 +00:00
|
|
|
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
2021-10-10 07:14:06 +00:00
|
|
|
R_ABORT_UNLESS(m_interface->RedirectApplicationLegalInformationPath(path, id, owner_id));
|
2020-03-08 08:06:23 +00:00
|
|
|
} else {
|
2021-10-10 07:14:06 +00:00
|
|
|
R_ABORT_UNLESS(m_interface->RedirectApplicationLegalInformationPathDeprecated(path, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Result Refresh() {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->Refresh());
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2020-04-14 05:19:44 +00:00
|
|
|
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
2021-10-10 07:14:06 +00:00
|
|
|
R_ABORT_UNLESS(m_interface->RedirectApplicationProgramPath(path, id, owner_id));
|
2020-03-08 08:06:23 +00:00
|
|
|
} else {
|
2021-10-10 07:14:06 +00:00
|
|
|
R_ABORT_UNLESS(m_interface->RedirectApplicationProgramPathDeprecated(path, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Result ClearApplicationRedirection() {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2020-04-14 05:19:44 +00:00
|
|
|
AMS_ASSERT(hos::GetVersion() < hos::Version_9_0_0);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(this->ClearApplicationRedirection(nullptr, 0));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result ClearApplicationRedirection(const ncm::ProgramId *excluding_ids, size_t num_ids) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2020-04-14 05:19:44 +00:00
|
|
|
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->ClearApplicationRedirection(sf::InArray<ncm::ProgramId>(excluding_ids, num_ids)));
|
2020-03-08 08:06:23 +00:00
|
|
|
} else {
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->ClearApplicationRedirectionDeprecated());
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Result EraseProgramRedirection(ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->EraseProgramRedirection(id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result EraseApplicationControlRedirection(ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->EraseApplicationControlRedirection(id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->EraseApplicationHtmlDocumentRedirection(id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->EraseApplicationLegalInformationRedirection(id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result ResolveProgramPathForDebug(Path *out, ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->ResolveProgramPathForDebug(out, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
|
|
|
R_ABORT_UNLESS(m_interface->RedirectProgramPathForDebug(path, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2020-04-14 05:19:44 +00:00
|
|
|
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
2021-10-10 07:14:06 +00:00
|
|
|
R_ABORT_UNLESS(m_interface->RedirectApplicationProgramPathForDebug(path, id, owner_id));
|
2020-03-08 08:06:23 +00:00
|
|
|
} else {
|
2021-10-10 07:14:06 +00:00
|
|
|
R_ABORT_UNLESS(m_interface->RedirectApplicationProgramPathForDebugDeprecated(path, id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Result EraseProgramRedirectionForDebug(ncm::ProgramId id) {
|
2021-10-10 07:14:06 +00:00
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(m_interface->EraseProgramRedirectionForDebug(id));
|
2020-03-08 08:06:23 +00:00
|
|
|
}
|
2022-10-11 17:47:40 +00:00
|
|
|
|
|
|
|
Result Disable() {
|
|
|
|
AMS_ASSERT(m_interface != nullptr);
|
|
|
|
R_RETURN(m_interface->Disable());
|
|
|
|
}
|
2020-03-08 08:06:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|