diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-10-05 19:52:07 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-10-07 20:32:33 +0200 |
commit | f945e9767cd66567030e9daca13eb96d0a2d47ff (patch) | |
tree | 1a03308eaa5c3c6bf55d6eee761446b925ae04f6 /src/core/loader/nso.cpp | |
parent | cmd: Support passing game arguments from command line (diff) | |
download | yuzu-f945e9767cd66567030e9daca13eb96d0a2d47ff.tar yuzu-f945e9767cd66567030e9daca13eb96d0a2d47ff.tar.gz yuzu-f945e9767cd66567030e9daca13eb96d0a2d47ff.tar.bz2 yuzu-f945e9767cd66567030e9daca13eb96d0a2d47ff.tar.lz yuzu-f945e9767cd66567030e9daca13eb96d0a2d47ff.tar.xz yuzu-f945e9767cd66567030e9daca13eb96d0a2d47ff.tar.zst yuzu-f945e9767cd66567030e9daca13eb96d0a2d47ff.zip |
Diffstat (limited to 'src/core/loader/nso.cpp')
-rw-r--r-- | src/core/loader/nso.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index c225e2d24..28c6dd9b7 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -129,12 +129,14 @@ VAddr AppLoader_NSO::LoadModule(FileSys::VirtualFile file, VAddr load_base, if (should_pass_arguments && !Settings::values.program_args.empty()) { const auto arg_data = Settings::values.program_args; - codeset->DataSegment().size += 0x9000; - NSOArgumentHeader args_header{0x9000, static_cast<u32_le>(arg_data.size()), {}}; - program_image.resize(static_cast<u32>(program_image.size()) + 0x9000); - std::memcpy(program_image.data() + program_image.size() - 0x9000, &args_header, - sizeof(NSOArgumentHeader)); - std::memcpy(program_image.data() + program_image.size() - 0x8FE0, arg_data.data(), + codeset->DataSegment().size += NSO_ARGUMENT_DATA_ALLOCATION_SIZE; + NSOArgumentHeader args_header{ + NSO_ARGUMENT_DATA_ALLOCATION_SIZE, static_cast<u32_le>(arg_data.size()), {}}; + const auto end_offset = program_image.size(); + program_image.resize(static_cast<u32>(program_image.size()) + + NSO_ARGUMENT_DATA_ALLOCATION_SIZE); + std::memcpy(program_image.data() + end_offset, &args_header, sizeof(NSOArgumentHeader)); + std::memcpy(program_image.data() + end_offset + sizeof(NSOArgumentHeader), arg_data.data(), arg_data.size()); } |