diff options
Diffstat (limited to 'src/core/hle/service/ldr/ldr.cpp')
-rw-r--r-- | src/core/hle/service/ldr/ldr.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index 453d90a22..9df7ac50f 100644 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp @@ -318,14 +318,18 @@ public: return; } - ASSERT(process->MirrorMemory(*map_address, nro_addr, nro_size, - Kernel::MemoryState::ModuleCodeStatic) == RESULT_SUCCESS); - ASSERT(process->UnmapMemory(nro_addr, 0, nro_size) == RESULT_SUCCESS); + ASSERT(vm_manager + .MirrorMemory(*map_address, nro_addr, nro_size, + Kernel::MemoryState::ModuleCodeStatic) + .IsSuccess()); + ASSERT(vm_manager.UnmapRange(nro_addr, nro_size).IsSuccess()); if (bss_size > 0) { - ASSERT(process->MirrorMemory(*map_address + nro_size, bss_addr, bss_size, - Kernel::MemoryState::ModuleCodeStatic) == RESULT_SUCCESS); - ASSERT(process->UnmapMemory(bss_addr, 0, bss_size) == RESULT_SUCCESS); + ASSERT(vm_manager + .MirrorMemory(*map_address + nro_size, bss_addr, bss_size, + Kernel::MemoryState::ModuleCodeStatic) + .IsSuccess()); + ASSERT(vm_manager.UnmapRange(bss_addr, bss_size).IsSuccess()); } vm_manager.ReprotectRange(*map_address, header.text_size, @@ -380,13 +384,14 @@ public: return; } - auto* process = Core::CurrentProcess(); - auto& vm_manager = process->VMManager(); + auto& vm_manager = Core::CurrentProcess()->VMManager(); const auto& nro_size = iter->second.size; - ASSERT(process->MirrorMemory(heap_addr, mapped_addr, nro_size, - Kernel::MemoryState::ModuleCodeStatic) == RESULT_SUCCESS); - ASSERT(process->UnmapMemory(mapped_addr, 0, nro_size) == RESULT_SUCCESS); + ASSERT(vm_manager + .MirrorMemory(heap_addr, mapped_addr, nro_size, + Kernel::MemoryState::ModuleCodeStatic) + .IsSuccess()); + ASSERT(vm_manager.UnmapRange(mapped_addr, nro_size).IsSuccess()); Core::System::GetInstance().InvalidateCpuInstructionCaches(); @@ -408,13 +413,13 @@ private: using SHA256Hash = std::array<u8, 0x20>; struct NROHeader { - u32_le entrypoint_insn; + INSERT_PADDING_WORDS(1); u32_le mod_offset; INSERT_PADDING_WORDS(2); u32_le magic; - INSERT_PADDING_WORDS(1); + u32_le version; u32_le nro_size; - INSERT_PADDING_WORDS(1); + u32_le flags; u32_le text_offset; u32_le text_size; u32_le ro_offset; @@ -430,9 +435,10 @@ private: struct NRRHeader { u32_le magic; - INSERT_PADDING_BYTES(0x1C); + INSERT_PADDING_BYTES(12); u64_le title_id_mask; u64_le title_id_pattern; + INSERT_PADDING_BYTES(16); std::array<u8, 0x100> modulus; std::array<u8, 0x100> signature_1; std::array<u8, 0x100> signature_2; |