summaryrefslogtreecommitdiffstats
path: root/src/core/loader
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2022-06-12 23:14:27 +0200
committerLiam <byteslice@airmail.cc>2022-06-14 02:09:32 +0200
commitebecdd3a7458dd5a353524dc161f4050d019b7be (patch)
tree0328113f3ceef6a4ccbfd6a98d121cd3c03e1626 /src/core/loader
parentcommon/assert: add unlikely (diff)
downloadyuzu-ebecdd3a7458dd5a353524dc161f4050d019b7be.tar
yuzu-ebecdd3a7458dd5a353524dc161f4050d019b7be.tar.gz
yuzu-ebecdd3a7458dd5a353524dc161f4050d019b7be.tar.bz2
yuzu-ebecdd3a7458dd5a353524dc161f4050d019b7be.tar.lz
yuzu-ebecdd3a7458dd5a353524dc161f4050d019b7be.tar.xz
yuzu-ebecdd3a7458dd5a353524dc161f4050d019b7be.tar.zst
yuzu-ebecdd3a7458dd5a353524dc161f4050d019b7be.zip
Diffstat (limited to 'src/core/loader')
-rw-r--r--src/core/loader/nso.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index 8a938aa83..8dd956fc6 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -128,11 +128,10 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::KProcess& process, Core::
// Apply patches if necessary
if (pm && (pm->HasNSOPatch(nso_header.build_id) || Settings::values.dump_nso)) {
- 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.data(),
- program_image.data() + program_image.size());
+ std::vector<u8> pi_header(sizeof(NSOHeader) + program_image.size());
+ std::memcpy(pi_header.data(), &nso_header, sizeof(NSOHeader));
+ std::memcpy(pi_header.data() + sizeof(NSOHeader), program_image.data(),
+ program_image.size());
pi_header = pm->PatchNSO(pi_header, nso_file.GetName());