diff --git a/stratosphere/ncm/source/impl/lr_manager.cpp b/stratosphere/ncm/source/impl/lr_manager.cpp index 04aef7a93..4ca529681 100644 --- a/stratosphere/ncm/source/impl/lr_manager.cpp +++ b/stratosphere/ncm/source/impl/lr_manager.cpp @@ -66,7 +66,7 @@ namespace ams::lr::impl { std::scoped_lock lk(g_mutex); auto resolver = g_location_resolvers.Find(storage_id); - R_UNLESS(resolver, ResultUnknownStorageId()); + R_UNLESS(resolver, lr::ResultUnknownStorageId()); if (storage_id != ncm::StorageId::Host) { (*resolver)->Refresh(); diff --git a/stratosphere/ncm/source/impl/ncm_content_manager.cpp b/stratosphere/ncm/source/impl/ncm_content_manager.cpp index a275e14e8..287c9581f 100644 --- a/stratosphere/ncm/source/impl/ncm_content_manager.cpp +++ b/stratosphere/ncm/source/impl/ncm_content_manager.cpp @@ -281,11 +281,11 @@ namespace ams::ncm::impl { Result CreateContentStorage(StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentStorageEntry* entry = FindContentStorageEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); R_TRY(fs::MountContentStorage(entry->mount_point, entry->content_storage_id)); ON_SCOPE_EXIT { @@ -301,11 +301,11 @@ namespace ams::ncm::impl { Result VerifyContentStorage(StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentStorageEntry* entry = FindContentStorageEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); MountName mount_name = fs::CreateUniqueMountName(); char mount_root[128] = {0}; @@ -325,11 +325,11 @@ namespace ams::ncm::impl { Result OpenContentStorage(std::shared_ptr* out, StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentStorageEntry* entry = FindContentStorageEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); auto content_storage = entry->content_storage; @@ -365,10 +365,10 @@ namespace ams::ncm::impl { Result CloseContentStorageForcibly(StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); ContentStorageEntry* entry = FindContentStorageEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); R_UNLESS(entry->content_storage, ResultSuccess()); /* N doesn't bother checking the result of this */ @@ -381,11 +381,11 @@ namespace ams::ncm::impl { Result ActivateContentStorage(StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentStorageEntry* entry = FindContentStorageEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); /* Already activated. */ R_UNLESS(entry->content_storage == nullptr, ResultSuccess()); @@ -432,11 +432,11 @@ namespace ams::ncm::impl { Result InactivateContentStorage(StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentStorageEntry* entry = FindContentStorageEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); /* Already inactivated. */ R_UNLESS(entry->content_storage != nullptr, ResultSuccess()); @@ -449,12 +449,12 @@ namespace ams::ncm::impl { Result CreateContentMetaDatabase(StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(storage_id != StorageId::GameCard, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::GameCard, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentMetaDBEntry* entry = FindContentMetaDBEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); /* N doesn't bother checking the result of this. */ fsDisableAutoSaveDataCreation(); @@ -480,11 +480,11 @@ namespace ams::ncm::impl { std::scoped_lock lk(g_mutex); R_UNLESS(storage_id != StorageId::GameCard, ResultSuccess()); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentMetaDBEntry* entry = FindContentMetaDBEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); bool mounted_save_data = false; if (!entry->content_meta_database) { @@ -500,7 +500,7 @@ namespace ams::ncm::impl { bool has_meta_path = false; R_TRY(fs::HasDirectory(&has_meta_path, entry->meta_path)); - R_UNLESS(has_meta_path, ResultInvalidContentMetaDatabase()); + R_UNLESS(has_meta_path, ncm::ResultInvalidContentMetaDatabase()); return ResultSuccess(); } @@ -508,11 +508,11 @@ namespace ams::ncm::impl { Result OpenContentMetaDatabase(std::shared_ptr* out, StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentMetaDBEntry* entry = FindContentMetaDBEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); std::shared_ptr content_meta_db = entry->content_meta_database; @@ -548,10 +548,10 @@ namespace ams::ncm::impl { Result CloseContentMetaDatabaseForcibly(StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); ContentMetaDBEntry* entry = FindContentMetaDBEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); std::shared_ptr content_meta_db = entry->content_meta_database; R_UNLESS(content_meta_db, ResultSuccess()); @@ -571,11 +571,11 @@ namespace ams::ncm::impl { Result CleanupContentMetaDatabase(StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentMetaDBEntry* entry = FindContentMetaDBEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); R_TRY(fsDeleteSaveDataFileSystemBySaveDataSpaceId(entry->save_meta.space_id, entry->save_meta.id)); return ResultSuccess(); @@ -584,11 +584,11 @@ namespace ams::ncm::impl { Result ActivateContentMetaDatabase(StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentMetaDBEntry* entry = FindContentMetaDBEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); /* Already activated. */ R_UNLESS(entry->content_meta_database == nullptr, ResultSuccess()); @@ -617,11 +617,11 @@ namespace ams::ncm::impl { Result InactivateContentMetaDatabase(StorageId storage_id) { std::scoped_lock lk(g_mutex); - R_UNLESS(storage_id != StorageId::None, ResultUnknownStorage()); - R_UNLESS(static_cast(storage_id) != 6, ResultUnknownStorage()); + R_UNLESS(storage_id != StorageId::None, ncm::ResultUnknownStorage()); + R_UNLESS(static_cast(storage_id) != 6, ncm::ResultUnknownStorage()); ContentMetaDBEntry* entry = FindContentMetaDBEntry(storage_id); - R_UNLESS(entry, ResultUnknownStorage()); + R_UNLESS(entry, ncm::ResultUnknownStorage()); /* Already inactivated. */ R_UNLESS(entry->content_meta_database != nullptr, ResultSuccess()); diff --git a/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp b/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp index 1f2f76e3d..eebc7f8bc 100644 --- a/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp +++ b/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp @@ -125,7 +125,7 @@ namespace ams::ncm::impl { this->GetPath(placeholder_path, placeholder_id); R_TRY_CATCH(fsdevCreateFile(placeholder_path, size, FsCreateOption_BigFile)) { - R_CONVERT(ams::fs::ResultPathAlreadyExists, ResultPlaceHolderAlreadyExists()) + R_CONVERT(ams::fs::ResultPathAlreadyExists, ncm::ResultPlaceHolderAlreadyExists()) } R_END_TRY_CATCH; return ResultSuccess(); @@ -138,7 +138,7 @@ namespace ams::ncm::impl { if (std::remove(placeholder_path) != 0) { R_TRY_CATCH(fsdevGetLastResult()) { - R_CONVERT(ams::fs::ResultPathNotFound, ResultPlaceHolderNotFound()) + R_CONVERT(ams::fs::ResultPathNotFound, ncm::ResultPlaceHolderNotFound()) } R_END_TRY_CATCH; } @@ -149,7 +149,7 @@ namespace ams::ncm::impl { FILE* f = nullptr; R_TRY_CATCH(this->Open(&f, placeholder_id)) { - R_CONVERT(ams::fs::ResultPathNotFound, ResultPlaceHolderNotFound()) + R_CONVERT(ams::fs::ResultPathNotFound, ncm::ResultPlaceHolderNotFound()) } R_END_TRY_CATCH; ON_SCOPE_EXIT { @@ -165,7 +165,7 @@ namespace ams::ncm::impl { this->MakePath(placeholder_path, placeholder_id); if (truncate(placeholder_path, size) == -1) { R_TRY_CATCH(fsdevGetLastResult()) { - R_CONVERT(ams::fs::ResultPathNotFound, ResultPlaceHolderNotFound()) + R_CONVERT(ams::fs::ResultPathNotFound, ncm::ResultPlaceHolderNotFound()) } R_END_TRY_CATCH; } diff --git a/stratosphere/ncm/source/lr_addoncontentlocationresolver.cpp b/stratosphere/ncm/source/lr_addoncontentlocationresolver.cpp index 01ff5d29c..1608e25be 100644 --- a/stratosphere/ncm/source/lr_addoncontentlocationresolver.cpp +++ b/stratosphere/ncm/source/lr_addoncontentlocationresolver.cpp @@ -21,7 +21,7 @@ namespace ams::lr { Result AddOnContentLocationResolverInterface::ResolveAddOnContentPath(sf::Out out, ncm::ProgramId id) { ncm::StorageId storage_id = ncm::StorageId::None; - R_UNLESS(this->registered_storages.Find(&storage_id, id), ResultAddOnContentNotFound()); + R_UNLESS(this->registered_storages.Find(&storage_id, id), lr::ResultAddOnContentNotFound()); std::shared_ptr content_meta_database; ncm::ContentId data_content_id; @@ -36,12 +36,12 @@ namespace ams::lr { } Result AddOnContentLocationResolverInterface::RegisterAddOnContentStorageDeprecated(ncm::StorageId storage_id, ncm::ProgramId id) { - R_UNLESS(this->registered_storages.Register(id, storage_id, ncm::ProgramId::Invalid), ResultTooManyRegisteredPaths()); + R_UNLESS(this->registered_storages.Register(id, storage_id, ncm::ProgramId::Invalid), lr::ResultTooManyRegisteredPaths()); return ResultSuccess(); } Result AddOnContentLocationResolverInterface::RegisterAddOnContentStorage(ncm::StorageId storage_id, ncm::ProgramId id, ncm::ProgramId application_id) { - R_UNLESS(this->registered_storages.Register(id, storage_id, application_id), ResultTooManyRegisteredPaths()); + R_UNLESS(this->registered_storages.Register(id, storage_id, application_id), lr::ResultTooManyRegisteredPaths()); return ResultSuccess(); } diff --git a/stratosphere/ncm/source/lr_contentlocationresolver.cpp b/stratosphere/ncm/source/lr_contentlocationresolver.cpp index c8c0312c6..6665cfab0 100644 --- a/stratosphere/ncm/source/lr_contentlocationresolver.cpp +++ b/stratosphere/ncm/source/lr_contentlocationresolver.cpp @@ -32,7 +32,7 @@ namespace ams::lr { ncm::ContentId program_content_id; R_TRY_CATCH(this->content_meta_database->GetLatestProgram(&program_content_id, id)) { - R_CONVERT(ncm::ResultContentMetaNotFound, ResultProgramNotFound()) + R_CONVERT(ncm::ResultContentMetaNotFound, lr::ResultProgramNotFound()) } R_END_TRY_CATCH; this->GetContentStoragePath(out.GetPointer(), program_content_id); @@ -45,12 +45,12 @@ namespace ams::lr { } Result ContentLocationResolverInterface::ResolveApplicationControlPath(sf::Out out, ncm::ProgramId id) { - R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->app_control_redirector, id), ResultControlNotFound()); + R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->app_control_redirector, id), lr::ResultControlNotFound()); return ResultSuccess(); } Result ContentLocationResolverInterface::ResolveApplicationHtmlDocumentPath(sf::Out out, ncm::ProgramId id) { - R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->html_docs_redirector, id), ResultHtmlDocumentNotFound()); + R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->html_docs_redirector, id), lr::ResultHtmlDocumentNotFound()); return ResultSuccess(); } @@ -83,7 +83,7 @@ namespace ams::lr { } Result ContentLocationResolverInterface::ResolveApplicationLegalInformationPath(sf::Out out, ncm::ProgramId id) { - R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->legal_info_redirector, id), ResultLegalInformationNotFound()); + R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->legal_info_redirector, id), lr::ResultLegalInformationNotFound()); return ResultSuccess(); } @@ -153,7 +153,7 @@ namespace ams::lr { R_UNLESS(!this->GetRedirectedPath(out.GetPointer(), &this->debug_program_redirector, id), ResultSuccess()); R_TRY_CATCH(this->ResolveProgramPath(out.GetPointer(), id)) { - R_CONVERT(ResultProgramNotFound, ResultDebugProgramNotFound()) + R_CONVERT(ResultProgramNotFound, lr::ResultDebugProgramNotFound()) } R_END_TRY_CATCH; return ResultSuccess(); diff --git a/stratosphere/ncm/source/lr_redirectonlylocationresolver.cpp b/stratosphere/ncm/source/lr_redirectonlylocationresolver.cpp index 3f11044be..6d13fb150 100644 --- a/stratosphere/ncm/source/lr_redirectonlylocationresolver.cpp +++ b/stratosphere/ncm/source/lr_redirectonlylocationresolver.cpp @@ -28,7 +28,7 @@ namespace ams::lr { } Result RedirectOnlyLocationResolverInterface::ResolveProgramPath(sf::Out out, ncm::ProgramId id) { - R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->program_redirector, id), ResultProgramNotFound()); + R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->program_redirector, id), lr::ResultProgramNotFound()); return ResultSuccess(); } @@ -38,12 +38,12 @@ namespace ams::lr { } Result RedirectOnlyLocationResolverInterface::ResolveApplicationControlPath(sf::Out out, ncm::ProgramId id) { - R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->app_control_redirector, id), ResultControlNotFound()); + R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->app_control_redirector, id), lr::ResultControlNotFound()); return ResultSuccess(); } Result RedirectOnlyLocationResolverInterface::ResolveApplicationHtmlDocumentPath(sf::Out out, ncm::ProgramId id) { - R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->html_docs_redirector, id), ResultHtmlDocumentNotFound()); + R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->html_docs_redirector, id), lr::ResultHtmlDocumentNotFound()); return ResultSuccess(); } @@ -72,7 +72,7 @@ namespace ams::lr { } Result RedirectOnlyLocationResolverInterface::ResolveApplicationLegalInformationPath(sf::Out out, ncm::ProgramId id) { - R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->legal_info_redirector, id), ResultLegalInformationNotFound()); + R_UNLESS(this->GetRedirectedPath(out.GetPointer(), &this->legal_info_redirector, id), lr::ResultLegalInformationNotFound()); return ResultSuccess(); } @@ -143,7 +143,7 @@ namespace ams::lr { R_UNLESS(!this->GetRedirectedPath(out.GetPointer(), &this->debug_program_redirector, id), ResultSuccess()); R_TRY_CATCH(this->ResolveProgramPath(out.GetPointer(), id)) { - R_CONVERT(ResultProgramNotFound, ResultDebugProgramNotFound()) + R_CONVERT(ResultProgramNotFound, lr::ResultDebugProgramNotFound()) } R_END_TRY_CATCH; return ResultSuccess(); diff --git a/stratosphere/ncm/source/lr_registeredlocationresolver.cpp b/stratosphere/ncm/source/lr_registeredlocationresolver.cpp index fe0b69cb3..10c3e23bd 100644 --- a/stratosphere/ncm/source/lr_registeredlocationresolver.cpp +++ b/stratosphere/ncm/source/lr_registeredlocationresolver.cpp @@ -63,7 +63,7 @@ namespace ams::lr { } Result RegisteredLocationResolverInterface::ResolveProgramPath(sf::Out out, ncm::ProgramId id) { - R_UNLESS(this->ResolvePath(out.GetPointer(), &this->program_redirector, &this->registered_program_locations, id), ResultProgramNotFound()); + R_UNLESS(this->ResolvePath(out.GetPointer(), &this->program_redirector, &this->registered_program_locations, id), lr::ResultProgramNotFound()); return ResultSuccess(); } @@ -93,7 +93,7 @@ namespace ams::lr { } Result RegisteredLocationResolverInterface::ResolveHtmlDocumentPath(sf::Out out, ncm::ProgramId id) { - R_UNLESS(this->ResolvePath(out.GetPointer(), &this->html_docs_redirector, &this->registered_html_docs_locations, id), ResultHtmlDocumentNotFound()); + R_UNLESS(this->ResolvePath(out.GetPointer(), &this->html_docs_redirector, &this->registered_html_docs_locations, id), lr::ResultHtmlDocumentNotFound()); return ResultSuccess(); } diff --git a/stratosphere/ncm/source/ncm_contentmetadatabase.cpp b/stratosphere/ncm/source/ncm_contentmetadatabase.cpp index f4696925c..ffd9e027a 100644 --- a/stratosphere/ncm/source/ncm_contentmetadatabase.cpp +++ b/stratosphere/ncm/source/ncm_contentmetadatabase.cpp @@ -74,7 +74,7 @@ namespace ams::ncm { Result GetContentMetaSize(size_t *out, const ContentMetaKey &key, const kvdb::MemoryKeyValueStore *kvs) { R_TRY_CATCH(kvs->GetValueSize(out, key)) { - R_CONVERT(kvdb::ResultKeyNotFound, ResultContentMetaNotFound()) + R_CONVERT(kvdb::ResultKeyNotFound, ncm::ResultContentMetaNotFound()) } R_END_TRY_CATCH; return ResultSuccess(); @@ -92,8 +92,8 @@ namespace ams::ncm { R_TRY(this->EnsureEnabled()); const auto it = this->kvs->lower_bound(key); - R_UNLESS(it != this->kvs->end(), ResultContentMetaNotFound()); - R_UNLESS(it->GetKey().id == key.id, ResultContentMetaNotFound()); + R_UNLESS(it != this->kvs->end(), ncm::ResultContentMetaNotFound()); + R_UNLESS(it->GetKey().id == key.id, ncm::ResultContentMetaNotFound()); const auto stored_key = it->GetKey(); const void* value = nullptr; @@ -102,7 +102,7 @@ namespace ams::ncm { R_TRY(GetContentMetaValuePointer(&value, &value_size, stored_key, this->kvs)); const auto header = GetValueHeader(value); - R_UNLESS(header->content_count != 0, ResultContentNotFound()); + R_UNLESS(header->content_count != 0, ncm::ResultContentNotFound()); const ContentInfo* content_infos = GetValueContentInfos(value); const ContentInfo* found_content_info = nullptr; @@ -130,7 +130,7 @@ namespace ams::ncm { found_content_info = lowest_id_offset_info; } - R_UNLESS(found_content_info, ResultContentNotFound()); + R_UNLESS(found_content_info, ncm::ResultContentNotFound()); *out = found_content_info->content_id; return ResultSuccess(); } @@ -153,7 +153,7 @@ namespace ams::ncm { } } - R_UNLESS(found_key, ResultContentMetaNotFound()); + R_UNLESS(found_key, ncm::ResultContentMetaNotFound()); *out_key = key; return ResultSuccess(); } @@ -184,7 +184,7 @@ namespace ams::ncm { } Result ContentMetaDatabaseInterface::ListContentInfo(sf::Out out_count, const sf::OutArray &out_info, ContentMetaKey key, u32 offset) { - R_UNLESS(offset >> 0x1f == 0, ResultInvalidOffset()); + R_UNLESS(offset >> 0x1f == 0, ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); const void *value = nullptr; @@ -354,11 +354,11 @@ namespace ams::ncm { Result ContentMetaDatabaseInterface::GetSize(sf::Out out_size, ContentMetaKey key) { R_TRY(this->EnsureEnabled()); - R_UNLESS(this->kvs->GetCount() != 0, ResultContentMetaNotFound()); + R_UNLESS(this->kvs->GetCount() != 0, ncm::ResultContentMetaNotFound()); const auto it = this->kvs->lower_bound(key); - R_UNLESS(it != this->kvs->end(), ResultContentMetaNotFound()); - R_UNLESS(it->GetKey() == key, ResultContentMetaNotFound()); + R_UNLESS(it != this->kvs->end(), ncm::ResultContentMetaNotFound()); + R_UNLESS(it->GetKey() == key, ncm::ResultContentMetaNotFound()); out_size.SetValue(it->GetValueSize()); return ResultSuccess(); @@ -366,7 +366,7 @@ namespace ams::ncm { Result ContentMetaDatabaseInterface::GetRequiredSystemVersion(sf::Out out_version, ContentMetaKey key) { R_TRY(this->EnsureEnabled()); - R_UNLESS(key.type == ContentMetaType::Application || key.type == ContentMetaType::Patch, ResultInvalidContentMetaKey()); + R_UNLESS(key.type == ContentMetaType::Application || key.type == ContentMetaType::Patch, ncm::ResultInvalidContentMetaKey()); const void* value = nullptr; size_t value_size = 0; @@ -381,7 +381,7 @@ namespace ams::ncm { Result ContentMetaDatabaseInterface::GetPatchId(sf::Out out_patch_id, ContentMetaKey key) { R_TRY(this->EnsureEnabled()); - R_UNLESS(key.type != ContentMetaType::Application, ResultInvalidContentMetaKey()); + R_UNLESS(key.type != ContentMetaType::Application, ncm::ResultInvalidContentMetaKey()); const void* value = nullptr; size_t value_size = 0; @@ -399,7 +399,7 @@ namespace ams::ncm { Result ContentMetaDatabaseInterface::LookupOrphanContent(const sf::OutArray &out_orphaned, const sf::InArray &content_ids) { R_TRY(this->EnsureEnabled()); - R_UNLESS(out_orphaned.GetSize() >= content_ids.GetSize(), ResultBufferInsufficient()); + R_UNLESS(out_orphaned.GetSize() >= content_ids.GetSize(), ncm::ResultBufferInsufficient()); /* Default to orphaned for all content ids. */ if (out_orphaned.GetSize() > 0) { @@ -470,7 +470,7 @@ namespace ams::ncm { } Result ContentMetaDatabaseInterface::ListContentMetaInfo(sf::Out out_entries_written, const sf::OutArray &out_meta_info, ContentMetaKey key, u32 start_index) { - R_UNLESS(start_index >> 0x1f == 0, ResultInvalidOffset()); + R_UNLESS(start_index >> 0x1f == 0, ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); const void* value = nullptr; @@ -524,7 +524,7 @@ namespace ams::ncm { return ResultSuccess(); } - R_UNLESS(key.type == ContentMetaType::AddOnContent, ResultInvalidContentMetaKey()); + R_UNLESS(key.type == ContentMetaType::AddOnContent, ncm::ResultInvalidContentMetaKey()); const auto ext_header = GetValueExtendedHeader(value); out_version.SetValue(ext_header->required_application_version); return ResultSuccess(); @@ -567,7 +567,7 @@ namespace ams::ncm { found_key = entry->GetKey(); } - R_UNLESS(found_key, ResultContentMetaNotFound()); + R_UNLESS(found_key, ncm::ResultContentMetaNotFound()); *out_key = *found_key; return ResultSuccess(); } diff --git a/stratosphere/ncm/source/ncm_contentstorage.cpp b/stratosphere/ncm/source/ncm_contentstorage.cpp index 846b9a22f..b05b9715d 100644 --- a/stratosphere/ncm/source/ncm_contentstorage.cpp +++ b/stratosphere/ncm/source/ncm_contentstorage.cpp @@ -75,7 +75,7 @@ namespace ams::ncm { this->GetContentPath(content_path, content_id); R_TRY_CATCH(fs::OpenFile(&this->content_cache_file_handle, content_path, FsOpenMode_Read)) { - R_CONVERT(ams::fs::ResultPathNotFound, ResultContentNotFound()) + R_CONVERT(ams::fs::ResultPathNotFound, ncm::ResultContentNotFound()) } R_END_TRY_CATCH; this->cached_content_id = content_id; @@ -123,7 +123,7 @@ namespace ams::ncm { Result ContentStorageInterface::WritePlaceHolder(PlaceHolderId placeholder_id, u64 offset, sf::InBuffer data) { /* Offset is too large */ - R_UNLESS(offset >> 0x3f == 0, ResultInvalidOffset()); + R_UNLESS(offset >> 0x3f == 0, ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); R_TRY(this->placeholder_accessor.Write(placeholder_id, offset, data.GetPointer(), data.GetSize())); return ResultSuccess(); @@ -141,8 +141,8 @@ namespace ams::ncm { if (rename(placeholder_path, content_path) != 0) { R_TRY_CATCH(fsdevGetLastResult()) { - R_CONVERT(ams::fs::ResultPathNotFound, ResultPlaceHolderNotFound()) - R_CONVERT(ams::fs::ResultPathAlreadyExists, ResultContentAlreadyExists()) + R_CONVERT(ams::fs::ResultPathNotFound, ncm::ResultPlaceHolderNotFound()) + R_CONVERT(ams::fs::ResultPathAlreadyExists, ncm::ResultContentAlreadyExists()) } R_END_TRY_CATCH; } @@ -158,7 +158,7 @@ namespace ams::ncm { if (std::remove(content_path) != 0) { R_TRY_CATCH(fsdevGetLastResult()) { - R_CONVERT(ams::fs::ResultPathNotFound, ResultContentNotFound()) + R_CONVERT(ams::fs::ResultPathNotFound, ncm::ResultContentNotFound()) } R_END_TRY_CATCH; } @@ -227,7 +227,7 @@ namespace ams::ncm { *should_retry_dir_read = false; if (dir_entry->d_type == DT_REG) { - R_UNLESS(entry_count <= out_buf.GetSize(), ResultBufferInsufficient()); + R_UNLESS(entry_count <= out_buf.GetSize(), ncm::ResultBufferInsufficient()); PlaceHolderId cur_entry_placeholder_id = {0}; R_TRY(GetPlaceHolderIdFromDirEntry(&cur_entry_placeholder_id, dir_entry)); @@ -265,7 +265,7 @@ namespace ams::ncm { } Result ContentStorageInterface::ListContentId(sf::Out out_count, const sf::OutArray &out_buf, u32 start_offset) { - R_UNLESS(start_offset >> 0x1f == 0, ResultInvalidOffset()); + R_UNLESS(start_offset >> 0x1f == 0, ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); char content_root_path[FS_MAX_PATH] = {0}; @@ -349,8 +349,8 @@ namespace ams::ncm { this->placeholder_accessor.GetPath(placeholder_path, placeholder_id); if (rename(old_content_path, placeholder_path) != 0) { R_TRY_CATCH(fsdevGetLastResult()) { - R_CONVERT(ams::fs::ResultPathNotFound, ResultPlaceHolderNotFound()) - R_CONVERT(ams::fs::ResultPathAlreadyExists, ResultPlaceHolderAlreadyExists()) + R_CONVERT(ams::fs::ResultPathNotFound, ncm::ResultPlaceHolderNotFound()) + R_CONVERT(ams::fs::ResultPathAlreadyExists, ncm::ResultPlaceHolderAlreadyExists()) } R_END_TRY_CATCH; } @@ -365,7 +365,7 @@ namespace ams::ncm { Result ContentStorageInterface::ReadContentIdFile(sf::OutBuffer buf, ContentId content_id, u64 offset) { /* Offset is too large */ - R_UNLESS(offset >> 0x3f == 0, ResultInvalidOffset()); + R_UNLESS(offset >> 0x3f == 0, ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); char content_path[FS_MAX_PATH] = {0}; this->GetContentPath(content_path, content_id); @@ -452,7 +452,7 @@ namespace ams::ncm { Result ContentStorageInterface::WriteContentForDebug(ContentId content_id, u64 offset, sf::InBuffer data) { /* Offset is too large */ - R_UNLESS(offset >> 0x3f == 0, ResultInvalidOffset()); + R_UNLESS(offset >> 0x3f == 0, ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); bool is_development = false; diff --git a/stratosphere/ncm/source/ncm_fs.cpp b/stratosphere/ncm/source/ncm_fs.cpp index 7e476ca1f..61318837e 100644 --- a/stratosphere/ncm/source/ncm_fs.cpp +++ b/stratosphere/ncm/source/ncm_fs.cpp @@ -103,17 +103,17 @@ namespace ams::ncm::fs { bool has_root = false; R_TRY(HasDirectory(&has_root, root_path)); - R_UNLESS(has_root, ResultStorageRootNotFound()); + R_UNLESS(has_root, ncm::ResultStorageRootNotFound()); path::GetContentRootPath(content_root, root_path); bool has_content_root = false; R_TRY(HasDirectory(&has_content_root, content_root)); - R_UNLESS(has_content_root, ResultStoragePathNotFound()); + R_UNLESS(has_content_root, ncm::ResultStoragePathNotFound()); path::GetPlaceHolderRootPath(placeholder_root, root_path); bool has_placeholder_root = false; R_TRY(HasDirectory(&has_placeholder_root, placeholder_root)); - R_UNLESS(has_placeholder_root, ResultStoragePathNotFound()); + R_UNLESS(has_placeholder_root, ncm::ResultStoragePathNotFound()); return ResultSuccess(); } @@ -148,7 +148,7 @@ namespace ams::ncm::fs { size_t path_len = strlen(path); char working_path_buf[FS_MAX_PATH] = {0}; - R_UNLESS(path_len + 1 < FS_MAX_PATH, ResultAllocationFailed()); + R_UNLESS(path_len + 1 < FS_MAX_PATH, ncm::ResultAllocationFailed()); strncpy(working_path_buf + 1, path, FS_MAX_PATH-1); if (path_len != 0) { diff --git a/stratosphere/ncm/source/ncm_icontentmetadatabase.hpp b/stratosphere/ncm/source/ncm_icontentmetadatabase.hpp index 7687f7e99..d4b986c93 100644 --- a/stratosphere/ncm/source/ncm_icontentmetadatabase.hpp +++ b/stratosphere/ncm/source/ncm_icontentmetadatabase.hpp @@ -52,7 +52,7 @@ namespace ams::ncm { bool disabled; protected: Result EnsureEnabled() { - R_UNLESS(!this->disabled, ResultInvalidContentMetaDatabase()); + R_UNLESS(!this->disabled, ncm::ResultInvalidContentMetaDatabase()); return ResultSuccess(); } public: diff --git a/stratosphere/ncm/source/ncm_icontentstorage.hpp b/stratosphere/ncm/source/ncm_icontentstorage.hpp index 1f75a0f24..22fc3471d 100644 --- a/stratosphere/ncm/source/ncm_icontentstorage.hpp +++ b/stratosphere/ncm/source/ncm_icontentstorage.hpp @@ -58,7 +58,7 @@ namespace ams::ncm { bool disabled; protected: Result EnsureEnabled() { - R_UNLESS(!this->disabled, ResultInvalidContentStorage()); + R_UNLESS(!this->disabled, ncm::ResultInvalidContentStorage()); return ResultSuccess(); } public: diff --git a/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp b/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp index 72ab32aa9..47f2ebe48 100644 --- a/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp +++ b/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp @@ -154,7 +154,7 @@ namespace ams::ncm { Result ReadOnlyContentStorageInterface::ReadContentIdFile(sf::OutBuffer buf, ContentId content_id, u64 offset) { /* Offset is too large */ - R_UNLESS(offset >> 0x3f == 0, ResultInvalidOffset()); + R_UNLESS(offset >> 0x3f == 0, ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); char content_path[FS_MAX_PATH] = {0}; diff --git a/stratosphere/ncm/source/ncm_utils.cpp b/stratosphere/ncm/source/ncm_utils.cpp index 888857588..b15d92804 100644 --- a/stratosphere/ncm/source/ncm_utils.cpp +++ b/stratosphere/ncm/source/ncm_utils.cpp @@ -31,8 +31,8 @@ namespace ams::ncm { } Result GetPlaceHolderIdFromDirEntry(PlaceHolderId* out, struct dirent* dir_entry) { - R_UNLESS(strnlen(dir_entry->d_name, 0x30) == 0x24, ResultInvalidPlaceHolderDirectoryEntry()); - R_UNLESS(strncmp(dir_entry->d_name + 0x20, ".nca", 4) == 0, ResultInvalidPlaceHolderDirectoryEntry()); + R_UNLESS(strnlen(dir_entry->d_name, 0x30) == 0x24, ncm::ResultInvalidPlaceHolderDirectoryEntry()); + R_UNLESS(strncmp(dir_entry->d_name + 0x20, ".nca", 4) == 0, ncm::ResultInvalidPlaceHolderDirectoryEntry()); PlaceHolderId placeholder_id = {0}; char byte_string[2];