From f945e9767cd66567030e9daca13eb96d0a2d47ff Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Fri, 5 Oct 2018 13:52:07 -0400 Subject: nso/nro: Use default allocation size for arg_data --- src/core/loader/nso.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/core/loader/nso.cpp') 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(arg_data.size()), {}}; - program_image.resize(static_cast(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(arg_data.size()), {}}; + const auto end_offset = program_image.size(); + program_image.resize(static_cast(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()); } -- cgit v1.2.3