summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolcaEM <63682805+VolcaEM@users.noreply.github.com>2020-06-16 20:24:58 +0200
committerGitHub <noreply@github.com>2020-06-16 20:24:58 +0200
commitc0d61620506ef4d70b1aa60bc9961f08ce9a939f (patch)
treefd6b18312bb738a1a802ec00eafbf3b3b45ebe49
parentUpdate assert string (diff)
downloadyuzu-c0d61620506ef4d70b1aa60bc9961f08ce9a939f.tar
yuzu-c0d61620506ef4d70b1aa60bc9961f08ce9a939f.tar.gz
yuzu-c0d61620506ef4d70b1aa60bc9961f08ce9a939f.tar.bz2
yuzu-c0d61620506ef4d70b1aa60bc9961f08ce9a939f.tar.lz
yuzu-c0d61620506ef4d70b1aa60bc9961f08ce9a939f.tar.xz
yuzu-c0d61620506ef4d70b1aa60bc9961f08ce9a939f.tar.zst
yuzu-c0d61620506ef4d70b1aa60bc9961f08ce9a939f.zip
-rw-r--r--src/core/hle/service/ldr/ldr.cpp39
1 files changed, 13 insertions, 26 deletions
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp
index 6daea3408..ca53a9923 100644
--- a/src/core/hle/service/ldr/ldr.cpp
+++ b/src/core/hle/service/ldr/ldr.cpp
@@ -615,36 +615,23 @@ private:
}
static bool IsValidNRO(const NROHeader& header, u64 nro_size, u64 bss_size) {
+ return header.magic == Common::MakeMagic('N', 'R', 'O', '0') &&
+ header.nro_size == nro_size && header.bss_size == bss_size &&
- const bool valid_magic = header.magic == Common::MakeMagic('N', 'R', 'O', '0');
+ header.segment_headers[RO_INDEX].memory_offset ==
+ header.segment_headers[TEXT_INDEX].memory_offset +
+ header.segment_headers[TEXT_INDEX].memory_size &&
- const bool valid_nro_size = header.nro_size == nro_size;
+ header.segment_headers[DATA_INDEX].memory_offset ==
+ header.segment_headers[RO_INDEX].memory_offset +
+ header.segment_headers[RO_INDEX].memory_size &&
- const bool valid_bss_size = header.bss_size == bss_size;
+ nro_size == header.segment_headers[DATA_INDEX].memory_offset +
+ header.segment_headers[DATA_INDEX].memory_size &&
- const bool valid_ro_offset = header.segment_headers[RO_INDEX].memory_offset ==
- header.segment_headers[TEXT_INDEX].memory_offset +
- header.segment_headers[TEXT_INDEX].memory_size;
-
- const bool valid_data_offset = header.segment_headers[DATA_INDEX].memory_offset ==
- header.segment_headers[RO_INDEX].memory_offset +
- header.segment_headers[RO_INDEX].memory_size;
-
- const bool valid_nro_calculated_size =
- nro_size == header.segment_headers[DATA_INDEX].memory_offset +
- header.segment_headers[DATA_INDEX].memory_size;
-
- const bool text_aligned =
- Common::Is4KBAligned(header.segment_headers[TEXT_INDEX].memory_size);
-
- const bool ro_aligned = Common::Is4KBAligned(header.segment_headers[RO_INDEX].memory_size);
-
- const bool data_aligned =
- Common::Is4KBAligned(header.segment_headers[DATA_INDEX].memory_size);
-
- return valid_magic && valid_nro_size && valid_bss_size && valid_ro_offset &&
- valid_data_offset && valid_nro_calculated_size && text_aligned && ro_aligned &&
- data_aligned;
+ Common::Is4KBAligned(header.segment_headers[TEXT_INDEX].memory_size) &&
+ Common::Is4KBAligned(header.segment_headers[RO_INDEX].memory_size) &&
+ Common::Is4KBAligned(header.segment_headers[DATA_INDEX].memory_size);
}
Core::System& system;
};