summaryrefslogtreecommitdiffstats
path: root/src/core/loader/nso.cpp
diff options
context:
space:
mode:
authorMarkus Wick <markus@selfnet.de>2020-01-12 16:51:07 +0100
committerMarkus Wick <markus@selfnet.de>2020-01-18 08:29:19 +0100
commit7e94e544f40ee8fc58fdea7c71fe48d8edd6fcb6 (patch)
treed98500be6d85b3b32653180ba9021464403e400f /src/core/loader/nso.cpp
parentMerge pull request #3305 from ReinUsesLisp/point-size-program (diff)
downloadyuzu-7e94e544f40ee8fc58fdea7c71fe48d8edd6fcb6.tar
yuzu-7e94e544f40ee8fc58fdea7c71fe48d8edd6fcb6.tar.gz
yuzu-7e94e544f40ee8fc58fdea7c71fe48d8edd6fcb6.tar.bz2
yuzu-7e94e544f40ee8fc58fdea7c71fe48d8edd6fcb6.tar.lz
yuzu-7e94e544f40ee8fc58fdea7c71fe48d8edd6fcb6.tar.xz
yuzu-7e94e544f40ee8fc58fdea7c71fe48d8edd6fcb6.tar.zst
yuzu-7e94e544f40ee8fc58fdea7c71fe48d8edd6fcb6.zip
Diffstat (limited to '')
-rw-r--r--src/core/loader/nso.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index f629892ae..515c5accb 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <cinttypes>
+#include <cstring>
#include <vector>
#include "common/common_funcs.h"
@@ -96,8 +97,9 @@ 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);
- program_image.insert(program_image.end(), data.begin(), data.end());
+ program_image.resize(nso_header.segments[i].location + 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;
codeset.segments[i].offset = nso_header.segments[i].location;
codeset.segments[i].size = PageAlignSize(static_cast<u32>(data.size()));
@@ -139,12 +141,12 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process,
std::vector<u8> pi_header;
pi_header.insert(pi_header.begin(), reinterpret_cast<u8*>(&nso_header),
reinterpret_cast<u8*>(&nso_header) + sizeof(NSOHeader));
- pi_header.insert(pi_header.begin() + sizeof(NSOHeader), program_image.begin(),
- program_image.end());
+ pi_header.insert(pi_header.begin() + sizeof(NSOHeader), program_image.data(),
+ program_image.data() + program_image.size());
pi_header = pm->PatchNSO(pi_header, file.GetName());
- std::copy(pi_header.begin() + sizeof(NSOHeader), pi_header.end(), program_image.begin());
+ std::copy(pi_header.begin() + sizeof(NSOHeader), pi_header.end(), program_image.data());
}
// Apply cheats if they exist and the program has a valid title ID