diff options
Diffstat (limited to 'src/core/loader')
-rw-r--r-- | src/core/loader/deconstructed_rom_directory.cpp | 4 | ||||
-rw-r--r-- | src/core/loader/nca.cpp | 4 | ||||
-rw-r--r-- | src/core/loader/nro.cpp | 4 | ||||
-rw-r--r-- | src/core/loader/nso.cpp | 3 | ||||
-rw-r--r-- | src/core/loader/nsp.cpp | 31 | ||||
-rw-r--r-- | src/core/loader/xci.cpp | 4 |
6 files changed, 29 insertions, 21 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index f9e88be2b..d19c3623c 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp @@ -7,6 +7,7 @@ #include "common/common_funcs.h" #include "common/file_util.h" #include "common/logging/log.h" +#include "core/core.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/patch_manager.h" @@ -176,7 +177,8 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect // Register the RomFS if a ".romfs" file was found if (romfs_iter != files.end() && *romfs_iter != nullptr) { romfs = *romfs_iter; - Service::FileSystem::RegisterRomFS(std::make_unique<FileSys::RomFSFactory>(*this)); + Core::System::GetInstance().GetFileSystemController().RegisterRomFS( + std::make_unique<FileSys::RomFSFactory>(*this)); } is_loaded = true; diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp index 0f65fb637..5a0469978 100644 --- a/src/core/loader/nca.cpp +++ b/src/core/loader/nca.cpp @@ -6,6 +6,7 @@ #include "common/file_util.h" #include "common/logging/log.h" +#include "core/core.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/romfs_factory.h" #include "core/hle/kernel/process.h" @@ -57,7 +58,8 @@ AppLoader_NCA::LoadResult AppLoader_NCA::Load(Kernel::Process& process) { } if (nca->GetRomFS() != nullptr && nca->GetRomFS()->GetSize() > 0) { - Service::FileSystem::RegisterRomFS(std::make_unique<FileSys::RomFSFactory>(*this)); + Core::System::GetInstance().GetFileSystemController().RegisterRomFS( + std::make_unique<FileSys::RomFSFactory>(*this)); } is_loaded = true; diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 3a5361fdd..175898b91 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp @@ -10,6 +10,7 @@ #include "common/file_util.h" #include "common/logging/log.h" #include "common/swap.h" +#include "core/core.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/romfs_factory.h" #include "core/file_sys/vfs_offset.h" @@ -214,7 +215,8 @@ AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process) { } if (romfs != nullptr) { - Service::FileSystem::RegisterRomFS(std::make_unique<FileSys::RomFSFactory>(*this)); + Core::System::GetInstance().GetFileSystemController().RegisterRomFS( + std::make_unique<FileSys::RomFSFactory>(*this)); } is_loaded = true; diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 70c90109f..e75c700ad 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -152,8 +152,7 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, auto& system = Core::System::GetInstance(); const auto cheats = pm->CreateCheatList(system, nso_header.build_id); if (!cheats.empty()) { - system.RegisterCheatList(cheats, Common::HexToString(nso_header.build_id), load_base, - load_base + program_image.size()); + system.RegisterCheatList(cheats, nso_header.build_id, load_base, image_size); } } diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index b1171ce65..13950fc08 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp @@ -5,6 +5,7 @@ #include <vector> #include "common/common_types.h" +#include "core/core.h" #include "core/file_sys/card_image.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/control_metadata.h" @@ -26,20 +27,18 @@ AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file) if (nsp->GetStatus() != ResultStatus::Success) return; - if (nsp->IsExtractedType()) - return; - - const auto control_nca = - nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Control); - if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) - return; - - std::tie(nacp_file, icon_file) = - FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(*control_nca); if (nsp->IsExtractedType()) { secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(nsp->GetExeFS()); } else { + const auto control_nca = + nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Control); + if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) + return; + + std::tie(nacp_file, icon_file) = + FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(*control_nca); + if (title_id == 0) return; @@ -56,11 +55,11 @@ FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& file) { if (nsp.GetStatus() == ResultStatus::Success) { // Extracted Type case if (nsp.IsExtractedType() && nsp.GetExeFS() != nullptr && - FileSys::IsDirectoryExeFS(nsp.GetExeFS()) && nsp.GetRomFS() != nullptr) { + FileSys::IsDirectoryExeFS(nsp.GetExeFS())) { return FileType::NSP; } - // Non-Ectracted Type case + // Non-Extracted Type case if (!nsp.IsExtractedType() && nsp.GetNCA(nsp.GetFirstTitleID(), FileSys::ContentRecordType::Program) != nullptr && AppLoader_NCA::IdentifyType(nsp.GetNCAFile( @@ -77,7 +76,7 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::Process& process) { return {ResultStatus::ErrorAlreadyLoaded, {}}; } - if (title_id == 0) { + if (!nsp->IsExtractedType() && title_id == 0) { return {ResultStatus::ErrorNSPMissingProgramNCA, {}}; } @@ -91,7 +90,8 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::Process& process) { return {nsp_program_status, {}}; } - if (nsp->GetNCA(title_id, FileSys::ContentRecordType::Program) == nullptr) { + if (!nsp->IsExtractedType() && + nsp->GetNCA(title_id, FileSys::ContentRecordType::Program) == nullptr) { if (!Core::Crypto::KeyManager::KeyFileExists(false)) { return {ResultStatus::ErrorMissingProductionKeyFile, {}}; } @@ -106,7 +106,8 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::Process& process) { FileSys::VirtualFile update_raw; if (ReadUpdateRaw(update_raw) == ResultStatus::Success && update_raw != nullptr) { - Service::FileSystem::SetPackedUpdate(std::move(update_raw)); + Core::System::GetInstance().GetFileSystemController().SetPackedUpdate( + std::move(update_raw)); } is_loaded = true; diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp index 5e8553db9..7186ad1ff 100644 --- a/src/core/loader/xci.cpp +++ b/src/core/loader/xci.cpp @@ -5,6 +5,7 @@ #include <vector> #include "common/common_types.h" +#include "core/core.h" #include "core/file_sys/card_image.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/control_metadata.h" @@ -72,7 +73,8 @@ AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::Process& process) { FileSys::VirtualFile update_raw; if (ReadUpdateRaw(update_raw) == ResultStatus::Success && update_raw != nullptr) { - Service::FileSystem::SetPackedUpdate(std::move(update_raw)); + Core::System::GetInstance().GetFileSystemController().SetPackedUpdate( + std::move(update_raw)); } is_loaded = true; |