summaryrefslogtreecommitdiff
path: root/src/core/loader/nro.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2017-10-15 00:11:38 -0400
committerGravatar bunnei2017-10-15 00:11:38 -0400
commit746c2a3ae769c6172700e4f9e10ba01fa0df4ccb (patch)
treefc17369ecf7eae3ba8567f3098223a40ab860ff4 /src/core/loader/nro.cpp
parenthle: Add service stubs for apm and appletOE. (diff)
downloadyuzu-746c2a3ae769c6172700e4f9e10ba01fa0df4ccb.tar.gz
yuzu-746c2a3ae769c6172700e4f9e10ba01fa0df4ccb.tar.xz
yuzu-746c2a3ae769c6172700e4f9e10ba01fa0df4ccb.zip
core: Refactor MakeMagic usage and remove dead code.
Diffstat (limited to 'src/core/loader/nro.cpp')
-rw-r--r--src/core/loader/nro.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp
index 24c2c55a9..b37c3a092 100644
--- a/src/core/loader/nro.cpp
+++ b/src/core/loader/nro.cpp
@@ -4,6 +4,7 @@
4 4
5#include <vector> 5#include <vector>
6 6
7#include "common/common_funcs.h"
7#include "common/logging/log.h" 8#include "common/logging/log.h"
8#include "common/swap.h" 9#include "common/swap.h"
9#include "core/hle/kernel/process.h" 10#include "core/hle/kernel/process.h"
@@ -51,7 +52,7 @@ FileType AppLoader_NRO::IdentifyType(FileUtil::IOFile& file) {
51 if (sizeof(NroHeader) != file.ReadBytes(&nro_header, sizeof(NroHeader))) { 52 if (sizeof(NroHeader) != file.ReadBytes(&nro_header, sizeof(NroHeader))) {
52 return FileType::Error; 53 return FileType::Error;
53 } 54 }
54 if (nro_header.magic == MakeMagic('N', 'R', 'O', '0')) { 55 if (nro_header.magic == Common::MakeMagic('N', 'R', 'O', '0')) {
55 return FileType::NRO; 56 return FileType::NRO;
56 } 57 }
57 return FileType::Error; 58 return FileType::Error;
@@ -87,7 +88,7 @@ bool AppLoader_NRO::LoadNro(const std::string& path, VAddr load_base) {
87 if (sizeof(NroHeader) != file.ReadBytes(&nro_header, sizeof(NroHeader))) { 88 if (sizeof(NroHeader) != file.ReadBytes(&nro_header, sizeof(NroHeader))) {
88 return {}; 89 return {};
89 } 90 }
90 if (nro_header.magic != MakeMagic('N', 'R', 'O', '0')) { 91 if (nro_header.magic != Common::MakeMagic('N', 'R', 'O', '0')) {
91 return {}; 92 return {};
92 } 93 }
93 94
@@ -109,7 +110,7 @@ bool AppLoader_NRO::LoadNro(const std::string& path, VAddr load_base) {
109 u32 bss_size{Memory::PAGE_SIZE}; // Default .bss to page size if MOD0 section doesn't exist 110 u32 bss_size{Memory::PAGE_SIZE}; // Default .bss to page size if MOD0 section doesn't exist
110 std::memcpy(&mod_header, program_image.data() + nro_header.module_header_offset, 111 std::memcpy(&mod_header, program_image.data() + nro_header.module_header_offset,
111 sizeof(ModHeader)); 112 sizeof(ModHeader));
112 const bool has_mod_header{mod_header.magic == MakeMagic('M', 'O', 'D', '0')}; 113 const bool has_mod_header{mod_header.magic == Common::MakeMagic('M', 'O', 'D', '0')};
113 if (has_mod_header) { 114 if (has_mod_header) {
114 // Resize program image to include .bss section and page align each section 115 // Resize program image to include .bss section and page align each section
115 bss_size = PageAlignSize(mod_header.bss_end_offset - mod_header.bss_start_offset); 116 bss_size = PageAlignSize(mod_header.bss_end_offset - mod_header.bss_start_offset);