diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/loader/deconstructed_rom_directory.cpp | 17 | ||||
| -rw-r--r-- | src/core/loader/deconstructed_rom_directory.h | 2 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index 661803b5f..83666eb86 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp | |||
| @@ -53,6 +53,7 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileUti | |||
| 53 | FileType AppLoader_DeconstructedRomDirectory::IdentifyType(FileUtil::IOFile& file, | 53 | FileType AppLoader_DeconstructedRomDirectory::IdentifyType(FileUtil::IOFile& file, |
| 54 | const std::string& filepath) { | 54 | const std::string& filepath) { |
| 55 | bool is_main_found{}; | 55 | bool is_main_found{}; |
| 56 | bool is_npdm_found{}; | ||
| 56 | bool is_rtld_found{}; | 57 | bool is_rtld_found{}; |
| 57 | bool is_sdk_found{}; | 58 | bool is_sdk_found{}; |
| 58 | 59 | ||
| @@ -67,6 +68,9 @@ FileType AppLoader_DeconstructedRomDirectory::IdentifyType(FileUtil::IOFile& fil | |||
| 67 | // Verify filename | 68 | // Verify filename |
| 68 | if (Common::ToLower(virtual_name) == "main") { | 69 | if (Common::ToLower(virtual_name) == "main") { |
| 69 | is_main_found = true; | 70 | is_main_found = true; |
| 71 | } else if (Common::ToLower(virtual_name) == "main.npdm") { | ||
| 72 | is_npdm_found = true; | ||
| 73 | return true; | ||
| 70 | } else if (Common::ToLower(virtual_name) == "rtld") { | 74 | } else if (Common::ToLower(virtual_name) == "rtld") { |
| 71 | is_rtld_found = true; | 75 | is_rtld_found = true; |
| 72 | } else if (Common::ToLower(virtual_name) == "sdk") { | 76 | } else if (Common::ToLower(virtual_name) == "sdk") { |
| @@ -83,14 +87,14 @@ FileType AppLoader_DeconstructedRomDirectory::IdentifyType(FileUtil::IOFile& fil | |||
| 83 | } | 87 | } |
| 84 | 88 | ||
| 85 | // We are done if we've found and verified all required NSOs | 89 | // We are done if we've found and verified all required NSOs |
| 86 | return !(is_main_found && is_rtld_found && is_sdk_found); | 90 | return !(is_main_found && is_npdm_found && is_rtld_found && is_sdk_found); |
| 87 | }; | 91 | }; |
| 88 | 92 | ||
| 89 | // Search the directory recursively, looking for the required modules | 93 | // Search the directory recursively, looking for the required modules |
| 90 | const std::string directory = filepath.substr(0, filepath.find_last_of("/\\")) + DIR_SEP; | 94 | const std::string directory = filepath.substr(0, filepath.find_last_of("/\\")) + DIR_SEP; |
| 91 | FileUtil::ForeachDirectoryEntry(nullptr, directory, callback); | 95 | FileUtil::ForeachDirectoryEntry(nullptr, directory, callback); |
| 92 | 96 | ||
| 93 | if (is_main_found && is_rtld_found && is_sdk_found) { | 97 | if (is_main_found && is_npdm_found && is_rtld_found && is_sdk_found) { |
| 94 | return FileType::DeconstructedRomDirectory; | 98 | return FileType::DeconstructedRomDirectory; |
| 95 | } | 99 | } |
| 96 | 100 | ||
| @@ -108,9 +112,13 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load( | |||
| 108 | 112 | ||
| 109 | process = Kernel::Process::Create("main"); | 113 | process = Kernel::Process::Create("main"); |
| 110 | 114 | ||
| 115 | const std::string directory = filepath.substr(0, filepath.find_last_of("/\\")) + DIR_SEP; | ||
| 116 | const std::string npdm_path = directory + DIR_SEP + "main.npdm"; | ||
| 117 | metadata.Load(npdm_path); | ||
| 118 | metadata.Print(); | ||
| 119 | |||
| 111 | // Load NSO modules | 120 | // Load NSO modules |
| 112 | VAddr next_load_addr{Memory::PROCESS_IMAGE_VADDR}; | 121 | VAddr next_load_addr{Memory::PROCESS_IMAGE_VADDR}; |
| 113 | const std::string directory = filepath.substr(0, filepath.find_last_of("/\\")) + DIR_SEP; | ||
| 114 | for (const auto& module : {"rtld", "main", "subsdk0", "subsdk1", "subsdk2", "subsdk3", | 122 | for (const auto& module : {"rtld", "main", "subsdk0", "subsdk1", "subsdk2", "subsdk3", |
| 115 | "subsdk4", "subsdk5", "subsdk6", "subsdk7", "sdk"}) { | 123 | "subsdk4", "subsdk5", "subsdk6", "subsdk7", "sdk"}) { |
| 116 | const std::string path = directory + DIR_SEP + module; | 124 | const std::string path = directory + DIR_SEP + module; |
| @@ -127,7 +135,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load( | |||
| 127 | process->address_mappings = default_address_mappings; | 135 | process->address_mappings = default_address_mappings; |
| 128 | process->resource_limit = | 136 | process->resource_limit = |
| 129 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); | 137 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); |
| 130 | process->Run(Memory::PROCESS_IMAGE_VADDR, 48, Kernel::DEFAULT_STACK_SIZE); | 138 | process->Run(Memory::PROCESS_IMAGE_VADDR, metadata.GetMainThreadPriority(), |
| 139 | metadata.GetMainThreadStackSize()); | ||
| 131 | 140 | ||
| 132 | // Find the RomFS by searching for a ".romfs" file in this directory | 141 | // Find the RomFS by searching for a ".romfs" file in this directory |
| 133 | filepath_romfs = FindRomFS(directory); | 142 | filepath_romfs = FindRomFS(directory); |
diff --git a/src/core/loader/deconstructed_rom_directory.h b/src/core/loader/deconstructed_rom_directory.h index 536a2dab7..23295d911 100644 --- a/src/core/loader/deconstructed_rom_directory.h +++ b/src/core/loader/deconstructed_rom_directory.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/file_sys/program_metadata.h" | ||
| 9 | #include "core/hle/kernel/kernel.h" | 10 | #include "core/hle/kernel/kernel.h" |
| 10 | #include "core/loader/loader.h" | 11 | #include "core/loader/loader.h" |
| 11 | 12 | ||
| @@ -41,6 +42,7 @@ public: | |||
| 41 | private: | 42 | private: |
| 42 | std::string filepath_romfs; | 43 | std::string filepath_romfs; |
| 43 | std::string filepath; | 44 | std::string filepath; |
| 45 | FileSys::ProgramMetadata metadata; | ||
| 44 | }; | 46 | }; |
| 45 | 47 | ||
| 46 | } // namespace Loader | 48 | } // namespace Loader |