summaryrefslogtreecommitdiff
path: root/src/core/loader/nso.cpp
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-10-05 13:52:07 -0400
committerGravatar Zach Hilman2018-10-07 14:32:33 -0400
commitf945e9767cd66567030e9daca13eb96d0a2d47ff (patch)
tree1a03308eaa5c3c6bf55d6eee761446b925ae04f6 /src/core/loader/nso.cpp
parentcmd: Support passing game arguments from command line (diff)
downloadyuzu-f945e9767cd66567030e9daca13eb96d0a2d47ff.tar.gz
yuzu-f945e9767cd66567030e9daca13eb96d0a2d47ff.tar.xz
yuzu-f945e9767cd66567030e9daca13eb96d0a2d47ff.zip
nso/nro: Use default allocation size for arg_data
Diffstat (limited to 'src/core/loader/nso.cpp')
-rw-r--r--src/core/loader/nso.cpp14
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,
129 129
130 if (should_pass_arguments && !Settings::values.program_args.empty()) { 130 if (should_pass_arguments && !Settings::values.program_args.empty()) {
131 const auto arg_data = Settings::values.program_args; 131 const auto arg_data = Settings::values.program_args;
132 codeset->DataSegment().size += 0x9000; 132 codeset->DataSegment().size += NSO_ARGUMENT_DATA_ALLOCATION_SIZE;
133 NSOArgumentHeader args_header{0x9000, static_cast<u32_le>(arg_data.size()), {}}; 133 NSOArgumentHeader args_header{
134 program_image.resize(static_cast<u32>(program_image.size()) + 0x9000); 134 NSO_ARGUMENT_DATA_ALLOCATION_SIZE, static_cast<u32_le>(arg_data.size()), {}};
135 std::memcpy(program_image.data() + program_image.size() - 0x9000, &args_header, 135 const auto end_offset = program_image.size();
136 sizeof(NSOArgumentHeader)); 136 program_image.resize(static_cast<u32>(program_image.size()) +
137 std::memcpy(program_image.data() + program_image.size() - 0x8FE0, arg_data.data(), 137 NSO_ARGUMENT_DATA_ALLOCATION_SIZE);
138 std::memcpy(program_image.data() + end_offset, &args_header, sizeof(NSOArgumentHeader));
139 std::memcpy(program_image.data() + end_offset + sizeof(NSOArgumentHeader), arg_data.data(),
138 arg_data.size()); 140 arg_data.size());
139 } 141 }
140 142