summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorshinyquagsire23 <mtinc2@gmail.com>2018-02-25 15:01:37 +0100
committershinyquagsire23 <mtinc2@gmail.com>2018-02-25 15:41:36 +0100
commit487f8bc01816e108882e03901f2372f8d8653d7d (patch)
treea798b0594770433de8e8f4338f9930be14063e65 /src
parentloader: Use NPDM information when loading NSOs (diff)
downloadyuzu-487f8bc01816e108882e03901f2372f8d8653d7d.tar
yuzu-487f8bc01816e108882e03901f2372f8d8653d7d.tar.gz
yuzu-487f8bc01816e108882e03901f2372f8d8653d7d.tar.bz2
yuzu-487f8bc01816e108882e03901f2372f8d8653d7d.tar.lz
yuzu-487f8bc01816e108882e03901f2372f8d8653d7d.tar.xz
yuzu-487f8bc01816e108882e03901f2372f8d8653d7d.tar.zst
yuzu-487f8bc01816e108882e03901f2372f8d8653d7d.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp8
-rw-r--r--src/core/loader/nso.cpp6
-rw-r--r--src/core/loader/nso.h2
3 files changed, 10 insertions, 6 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index 83666eb86..864cf25cd 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -114,7 +114,11 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
const std::string directory = filepath.substr(0, filepath.find_last_of("/\\")) + DIR_SEP;
const std::string npdm_path = directory + DIR_SEP + "main.npdm";
- metadata.Load(npdm_path);
+
+ ResultStatus result = metadata.Load(npdm_path);
+ if (result != ResultStatus::Success) {
+ return result;
+ }
metadata.Print();
// Load NSO modules
@@ -123,7 +127,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
"subsdk4", "subsdk5", "subsdk6", "subsdk7", "sdk"}) {
const std::string path = directory + DIR_SEP + module;
const VAddr load_addr = next_load_addr;
- next_load_addr = AppLoader_NSO::LoadModule(path, load_addr);
+ next_load_addr = AppLoader_NSO::LoadModule(path, load_addr, metadata.GetTitleID());
if (next_load_addr) {
LOG_DEBUG(Loader, "loaded module %s @ 0x%" PRIx64, module, load_addr);
} else {
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index 407025da0..7f8d24dd6 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -92,7 +92,7 @@ static constexpr u32 PageAlignSize(u32 size) {
return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK;
}
-VAddr AppLoader_NSO::LoadModule(const std::string& path, VAddr load_base) {
+VAddr AppLoader_NSO::LoadModule(const std::string& path, VAddr load_base, u64 tid) {
FileUtil::IOFile file(path, "rb");
if (!file.IsOpen()) {
return {};
@@ -109,7 +109,7 @@ VAddr AppLoader_NSO::LoadModule(const std::string& path, VAddr load_base) {
}
// Build program image
- Kernel::SharedPtr<Kernel::CodeSet> codeset = Kernel::CodeSet::Create("", 0);
+ Kernel::SharedPtr<Kernel::CodeSet> codeset = Kernel::CodeSet::Create("", tid);
std::vector<u8> program_image;
for (int i = 0; i < nso_header.segments.size(); ++i) {
std::vector<u8> data =
@@ -158,7 +158,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
process = Kernel::Process::Create("main");
// Load module
- LoadModule(filepath, Memory::PROCESS_IMAGE_VADDR);
+ LoadModule(filepath, Memory::PROCESS_IMAGE_VADDR, 0);
LOG_DEBUG(Loader, "loaded module %s @ 0x%" PRIx64, filepath.c_str(),
Memory::PROCESS_IMAGE_VADDR);
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h
index 1ae30a824..14eb1d87e 100644
--- a/src/core/loader/nso.h
+++ b/src/core/loader/nso.h
@@ -29,7 +29,7 @@ public:
return IdentifyType(file, filepath);
}
- static VAddr LoadModule(const std::string& path, VAddr load_base);
+ static VAddr LoadModule(const std::string& path, VAddr load_base, u64 tid);
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;