More changes

This commit is contained in:
Adubbz 2020-02-26 01:20:37 +11:00
parent d1d910362d
commit b000168cfb
24 changed files with 120 additions and 132 deletions

View File

@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "../lr_contentlocationresolver.hpp" #include "../lr_content_location_resolver.hpp"
#include "../lr_redirectonlylocationresolver.hpp" #include "../lr_redirect_only_location_resolver.hpp"
#include "lr_location_resolver_manager_impl.hpp" #include "lr_location_resolver_manager_impl.hpp"
namespace ams::lr::impl { namespace ams::lr::impl {

View File

@ -18,10 +18,10 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "../lr_addoncontentlocationresolver.hpp" #include "../lr_add_on_content_location_resolver.hpp"
#include "../lr_ilocationresolver.hpp" #include "../lr_i_location_resolver.hpp"
#include "../lr_i_location_resolver_manager.hpp" #include "../lr_i_location_resolver_manager.hpp"
#include "../lr_registeredlocationresolver.hpp" #include "../lr_registered_location_resolver.hpp"
#include "ncm_bounded_map.hpp" #include "ncm_bounded_map.hpp"
namespace ams::lr::impl { namespace ams::lr::impl {

View File

@ -21,8 +21,8 @@
namespace ams::lr::impl { namespace ams::lr::impl {
enum RedirectionFlags { enum RedirectionFlags {
RedirectionFlags_None = (0 << 0), RedirectionFlags_None = (0 << 0),
RedirectionFlags_Application = (1 << 0), RedirectionFlags_Application = (1 << 0),
}; };
class LocationRedirector { class LocationRedirector {

View File

@ -19,11 +19,11 @@
#include <stratosphere/kvdb/kvdb_memory_key_value_store.hpp> #include <stratosphere/kvdb/kvdb_memory_key_value_store.hpp>
#include <optional> #include <optional>
#include "../ncm_contentmetadatabase.hpp" #include "../ncm_content_meta_database.hpp"
#include "../ncm_contentstorage.hpp" #include "../ncm_content_storage.hpp"
#include "../ncm_fs.hpp" #include "../ncm_fs.hpp"
#include "../ncm_make_path.hpp" #include "../ncm_make_path.hpp"
#include "../ncm_readonlycontentstorage.hpp" #include "../ncm_read_only_content_storage.hpp"
#include "ncm_content_manager.hpp" #include "ncm_content_manager.hpp"
#include "ncm_rights_cache.hpp" #include "ncm_rights_cache.hpp"

View File

@ -18,8 +18,8 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "../ncm_icontentmetadatabase.hpp" #include "../ncm_i_content_meta_database.hpp"
#include "../ncm_icontentstorage.hpp" #include "../ncm_i_content_storage.hpp"
namespace ams::ncm::impl { namespace ams::ncm::impl {

View File

@ -15,7 +15,7 @@
*/ */
#include "impl/ncm_content_manager.hpp" #include "impl/ncm_content_manager.hpp"
#include "lr_addoncontentlocationresolver.hpp" #include "lr_add_on_content_location_resolver.hpp"
namespace ams::lr { namespace ams::lr {

View File

@ -25,12 +25,12 @@ namespace ams::lr {
class AddOnContentLocationResolverInterface : public sf::IServiceObject { class AddOnContentLocationResolverInterface : public sf::IServiceObject {
protected: protected:
enum class CommandId { enum class CommandId {
ResolveAddOnContentPath = 0, ResolveAddOnContentPath = 0,
RegisterAddOnContentStorageDeprecated = 1, RegisterAddOnContentStorageDeprecated = 1,
RegisterAddOnContentStorage = 1, RegisterAddOnContentStorage = 1,
UnregisterAllAddOnContentPath = 2, UnregisterAllAddOnContentPath = 2,
RefreshApplicationAddOnContent = 3, RefreshApplicationAddOnContent = 3,
UnregisterApplicationAddOnContent = 4, UnregisterApplicationAddOnContent = 4,
}; };
private: private:
impl::RegisteredStorages<ncm::ProgramId, 0x800> registered_storages; impl::RegisteredStorages<ncm::ProgramId, 0x800> registered_storages;

View File

@ -15,7 +15,7 @@
*/ */
#include "impl/ncm_content_manager.hpp" #include "impl/ncm_content_manager.hpp"
#include "lr_contentlocationresolver.hpp" #include "lr_content_location_resolver.hpp"
namespace ams::lr { namespace ams::lr {

View File

@ -18,9 +18,9 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "lr_ilocationresolver.hpp" #include "lr_i_location_resolver.hpp"
#include "ncm_icontentmetadatabase.hpp" #include "ncm_i_content_meta_database.hpp"
#include "ncm_icontentstorage.hpp" #include "ncm_i_content_storage.hpp"
namespace ams::lr { namespace ams::lr {

View File

@ -25,32 +25,32 @@ namespace ams::lr {
class ILocationResolver : public sf::IServiceObject { class ILocationResolver : public sf::IServiceObject {
protected: protected:
enum class CommandId { enum class CommandId {
ResolveProgramPath = 0, ResolveProgramPath = 0,
RedirectProgramPath = 1, RedirectProgramPath = 1,
ResolveApplicationControlPath = 2, ResolveApplicationControlPath = 2,
ResolveApplicationHtmlDocumentPath = 3, ResolveApplicationHtmlDocumentPath = 3,
ResolveDataPath = 4, ResolveDataPath = 4,
RedirectApplicationControlPathDeprecated = 5, RedirectApplicationControlPathDeprecated = 5,
RedirectApplicationControlPath = 5, RedirectApplicationControlPath = 5,
RedirectApplicationHtmlDocumentPathDeprecated = 6, RedirectApplicationHtmlDocumentPathDeprecated = 6,
RedirectApplicationHtmlDocumentPath = 6, RedirectApplicationHtmlDocumentPath = 6,
ResolveApplicationLegalInformationPath = 7, ResolveApplicationLegalInformationPath = 7,
RedirectApplicationLegalInformationPathDeprecated = 8, RedirectApplicationLegalInformationPathDeprecated = 8,
RedirectApplicationLegalInformationPath = 8, RedirectApplicationLegalInformationPath = 8,
Refresh = 9, Refresh = 9,
RedirectApplicationProgramPathDeprecated = 10, RedirectApplicationProgramPathDeprecated = 10,
RedirectApplicationProgramPath = 10, RedirectApplicationProgramPath = 10,
ClearApplicationRedirectionDeprecated = 11, ClearApplicationRedirectionDeprecated = 11,
ClearApplicationRedirection = 11, ClearApplicationRedirection = 11,
EraseProgramRedirection = 12, EraseProgramRedirection = 12,
EraseApplicationControlRedirection = 13, EraseApplicationControlRedirection = 13,
EraseApplicationHtmlDocumentRedirection = 14, EraseApplicationHtmlDocumentRedirection = 14,
EraseApplicationLegalInformationRedirection = 15, EraseApplicationLegalInformationRedirection = 15,
ResolveProgramPathForDebug = 16, ResolveProgramPathForDebug = 16,
RedirectProgramPathForDebug = 17, RedirectProgramPathForDebug = 17,
RedirectApplicationProgramPathForDebugDeprecated = 18, RedirectApplicationProgramPathForDebugDeprecated = 18,
RedirectApplicationProgramPathForDebug = 18, RedirectApplicationProgramPathForDebug = 18,
EraseProgramRedirectionForDebug = 19, EraseProgramRedirectionForDebug = 19,
}; };
protected: protected:
impl::LocationRedirector program_redirector; impl::LocationRedirector program_redirector;

View File

@ -18,19 +18,19 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "lr_addoncontentlocationresolver.hpp" #include "lr_add_on_content_location_resolver.hpp"
#include "lr_ilocationresolver.hpp" #include "lr_i_location_resolver.hpp"
#include "lr_registeredlocationresolver.hpp" #include "lr_registered_location_resolver.hpp"
namespace ams::lr { namespace ams::lr {
class ILocationResolverManager : public sf::IServiceObject { class ILocationResolverManager : public sf::IServiceObject {
protected: protected:
enum class CommandId { enum class CommandId {
OpenLocationResolver = 0, OpenLocationResolver = 0,
OpenRegisteredLocationResolver = 1, OpenRegisteredLocationResolver = 1,
RefreshLocationResolver = 2, RefreshLocationResolver = 2,
OpenAddOnContentLocationResolver = 3, OpenAddOnContentLocationResolver = 3,
}; };
public: public:
/* Actual commands. */ /* Actual commands. */

View File

@ -15,16 +15,12 @@
*/ */
#include "impl/ncm_content_manager.hpp" #include "impl/ncm_content_manager.hpp"
#include "lr_redirectonlylocationresolver.hpp" #include "lr_redirect_only_location_resolver.hpp"
namespace ams::lr { namespace ams::lr {
RedirectOnlyLocationResolverInterface::~RedirectOnlyLocationResolverInterface() { RedirectOnlyLocationResolverInterface::~RedirectOnlyLocationResolverInterface() {
this->program_redirector.ClearRedirections(); this->ClearRedirections();
this->debug_program_redirector.ClearRedirections();
this->app_control_redirector.ClearRedirections();
this->html_docs_redirector.ClearRedirections();
this->legal_info_redirector.ClearRedirections();
} }
Result RedirectOnlyLocationResolverInterface::ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) { Result RedirectOnlyLocationResolverInterface::ResolveProgramPath(sf::Out<Path> out, ncm::ProgramId id) {
@ -87,11 +83,7 @@ namespace ams::lr {
} }
Result RedirectOnlyLocationResolverInterface::Refresh() { Result RedirectOnlyLocationResolverInterface::Refresh() {
this->program_redirector.ClearRedirections(); this->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();
} }
@ -106,11 +98,7 @@ namespace ams::lr {
} }
Result RedirectOnlyLocationResolverInterface::ClearApplicationRedirectionDeprecated() { Result RedirectOnlyLocationResolverInterface::ClearApplicationRedirectionDeprecated() {
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();
} }

View File

@ -18,7 +18,7 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "lr_contentlocationresolver.hpp" #include "lr_content_location_resolver.hpp"
namespace ams::lr { namespace ams::lr {

View File

@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "lr_registeredlocationresolver.hpp" #include "lr_registered_location_resolver.hpp"
namespace ams::lr { namespace ams::lr {
@ -46,7 +46,7 @@ namespace ams::lr {
Result RegisteredLocationResolverInterface::RefreshImpl(const ncm::ProgramId* excluding_ids, size_t num_ids) { Result RegisteredLocationResolverInterface::RefreshImpl(const ncm::ProgramId* excluding_ids, size_t num_ids) {
/* On < 9.0.0, exclusion lists were not supported yet, so simply clear and return. */ /* On < 9.0.0, exclusion lists were not supported yet, so simply clear and return. */
if (hos::GetVersion < hos::Version_900) { if (hos::GetVersion() < hos::Version_900) {
this->ClearRedirections(); this->ClearRedirections();
return ResultSuccess(); return ResultSuccess();
} }

View File

@ -18,8 +18,8 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "ncm_icontentmetadatabase.hpp" #include "ncm_i_content_meta_database.hpp"
#include "ncm_icontentstorage.hpp" #include "ncm_i_content_storage.hpp"
namespace ams::ncm { namespace ams::ncm {

View File

@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "ncm_contentmetadatabase.hpp" #include "ncm_content_meta_database.hpp"
#include "ncm_utils.hpp" #include "ncm_utils.hpp"
namespace ams::ncm { namespace ams::ncm {

View File

@ -18,7 +18,7 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "ncm_icontentmetadatabase.hpp" #include "ncm_i_content_meta_database.hpp"
namespace ams::ncm { namespace ams::ncm {

View File

@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "ncm_contentstorage.hpp" #include "ncm_content_storage.hpp"
#include "ncm_fs.hpp" #include "ncm_fs.hpp"
#include "ncm_make_path.hpp" #include "ncm_make_path.hpp"
#include "ncm_utils.hpp" #include "ncm_utils.hpp"

View File

@ -20,7 +20,7 @@
#include "impl/ncm_placeholder_accessor.hpp" #include "impl/ncm_placeholder_accessor.hpp"
#include "impl/ncm_rights_cache.hpp" #include "impl/ncm_rights_cache.hpp"
#include "ncm_icontentstorage.hpp" #include "ncm_i_content_storage.hpp"
#include "ncm_path_utils.hpp" #include "ncm_path_utils.hpp"
namespace ams::ncm { namespace ams::ncm {

View File

@ -24,27 +24,27 @@ namespace ams::ncm {
class IContentMetaDatabase : public sf::IServiceObject { class IContentMetaDatabase : public sf::IServiceObject {
protected: protected:
enum class CommandId { enum class CommandId {
Set = 0, Set = 0,
Get = 1, Get = 1,
Remove = 2, Remove = 2,
GetContentIdByType = 3, GetContentIdByType = 3,
ListContentInfo = 4, ListContentInfo = 4,
List = 5, List = 5,
GetLatestContentMetaKey = 6, GetLatestContentMetaKey = 6,
ListApplication = 7, ListApplication = 7,
Has = 8, Has = 8,
HasAll = 9, HasAll = 9,
GetSize = 10, GetSize = 10,
GetRequiredSystemVersion = 11, GetRequiredSystemVersion = 11,
GetPatchId = 12, GetPatchId = 12,
DisableForcibly = 13, DisableForcibly = 13,
LookupOrphanContent = 14, LookupOrphanContent = 14,
Commit = 15, Commit = 15,
HasContent = 16, HasContent = 16,
ListContentMetaInfo = 17, ListContentMetaInfo = 17,
GetAttributes = 18, GetAttributes = 18,
GetRequiredApplicationVersion = 19, GetRequiredApplicationVersion = 19,
GetContentIdByTypeAndIdOffset = 20, GetContentIdByTypeAndIdOffset = 20,
}; };
protected: protected:
ams::kvdb::MemoryKeyValueStore<ContentMetaKey>* kvs; ams::kvdb::MemoryKeyValueStore<ContentMetaKey>* kvs;

View File

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

View File

@ -16,7 +16,7 @@
#include "ncm_fs.hpp" #include "ncm_fs.hpp"
#include "ncm_path_utils.hpp" #include "ncm_path_utils.hpp"
#include "ncm_readonlycontentstorage.hpp" #include "ncm_read_only_content_storage.hpp"
namespace ams::ncm { namespace ams::ncm {

View File

@ -18,7 +18,7 @@
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "ncm_icontentstorage.hpp" #include "ncm_i_content_storage.hpp"
namespace ams::ncm { namespace ams::ncm {