summaryrefslogtreecommitdiffstats
path: root/src/core/loader/nso.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-01-24 16:31:43 +0100
committerGitHub <noreply@github.com>2020-01-24 16:31:43 +0100
commitf64adcfc37f15e31e8c6f772f56d8681512392d3 (patch)
treed0c6aa694aff0c9fe161caac56c3126a009efebd /src/core/loader/nso.cpp
parentMerge pull request #2800 from FearlessTobi/port-4049 (diff)
parentloader: provide default arguments (zero byte) to NSOs (diff)
downloadyuzu-f64adcfc37f15e31e8c6f772f56d8681512392d3.tar
yuzu-f64adcfc37f15e31e8c6f772f56d8681512392d3.tar.gz
yuzu-f64adcfc37f15e31e8c6f772f56d8681512392d3.tar.bz2
yuzu-f64adcfc37f15e31e8c6f772f56d8681512392d3.tar.lz
yuzu-f64adcfc37f15e31e8c6f772f56d8681512392d3.tar.xz
yuzu-f64adcfc37f15e31e8c6f772f56d8681512392d3.tar.zst
yuzu-f64adcfc37f15e31e8c6f772f56d8681512392d3.zip
Diffstat (limited to 'src/core/loader/nso.cpp')
-rw-r--r--src/core/loader/nso.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index 515c5accb..044067a5b 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -97,7 +97,8 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process,
if (nso_header.IsSegmentCompressed(i)) {
data = DecompressSegment(data, nso_header.segments[i]);
}
- program_image.resize(nso_header.segments[i].location + data.size());
+ program_image.resize(nso_header.segments[i].location +
+ PageAlignSize(static_cast<u32>(data.size())));
std::memcpy(program_image.data() + nso_header.segments[i].location, data.data(),
data.size());
codeset.segments[i].addr = nso_header.segments[i].location;
@@ -105,8 +106,12 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process,
codeset.segments[i].size = PageAlignSize(static_cast<u32>(data.size()));
}
- if (should_pass_arguments && !Settings::values.program_args.empty()) {
- const auto arg_data = Settings::values.program_args;
+ if (should_pass_arguments) {
+ std::vector<u8> arg_data{Settings::values.program_args.begin(),
+ Settings::values.program_args.end()};
+ if (arg_data.empty()) {
+ arg_data.resize(NSO_ARGUMENT_DEFAULT_SIZE);
+ }
codeset.DataSegment().size += NSO_ARGUMENT_DATA_ALLOCATION_SIZE;
NSOArgumentHeader args_header{
NSO_ARGUMENT_DATA_ALLOCATION_SIZE, static_cast<u32_le>(arg_data.size()), {}};