diff options
| author | 2017-10-15 00:11:38 -0400 | |
|---|---|---|
| committer | 2017-10-15 00:11:38 -0400 | |
| commit | 746c2a3ae769c6172700e4f9e10ba01fa0df4ccb (patch) | |
| tree | fc17369ecf7eae3ba8567f3098223a40ab860ff4 /src/core/loader/nso.cpp | |
| parent | hle: Add service stubs for apm and appletOE. (diff) | |
| download | yuzu-746c2a3ae769c6172700e4f9e10ba01fa0df4ccb.tar.gz yuzu-746c2a3ae769c6172700e4f9e10ba01fa0df4ccb.tar.xz yuzu-746c2a3ae769c6172700e4f9e10ba01fa0df4ccb.zip | |
core: Refactor MakeMagic usage and remove dead code.
Diffstat (limited to 'src/core/loader/nso.cpp')
| -rw-r--r-- | src/core/loader/nso.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 5ebbde19a..0d16d4b8c 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <vector> | 5 | #include <vector> |
| 6 | #include <lz4.h> | 6 | #include <lz4.h> |
| 7 | 7 | ||
| 8 | #include "common/common_funcs.h" | ||
| 8 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 9 | #include "common/swap.h" | 10 | #include "common/swap.h" |
| 10 | #include "core/hle/kernel/process.h" | 11 | #include "core/hle/kernel/process.h" |
| @@ -50,7 +51,7 @@ FileType AppLoader_NSO::IdentifyType(FileUtil::IOFile& file) { | |||
| 50 | return FileType::Error; | 51 | return FileType::Error; |
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | if (MakeMagic('N', 'S', 'O', '0') == magic) { | 54 | if (Common::MakeMagic('N', 'S', 'O', '0') == magic) { |
| 54 | return FileType::NSO; | 55 | return FileType::NSO; |
| 55 | } | 56 | } |
| 56 | 57 | ||
| @@ -96,7 +97,7 @@ VAddr AppLoader_NSO::LoadNso(const std::string& path, VAddr load_base, bool relo | |||
| 96 | if (sizeof(NsoHeader) != file.ReadBytes(&nso_header, sizeof(NsoHeader))) { | 97 | if (sizeof(NsoHeader) != file.ReadBytes(&nso_header, sizeof(NsoHeader))) { |
| 97 | return {}; | 98 | return {}; |
| 98 | } | 99 | } |
| 99 | if (nso_header.magic != MakeMagic('N', 'S', 'O', '0')) { | 100 | if (nso_header.magic != Common::MakeMagic('N', 'S', 'O', '0')) { |
| 100 | return {}; | 101 | return {}; |
| 101 | } | 102 | } |
| 102 | 103 | ||
| @@ -121,7 +122,7 @@ VAddr AppLoader_NSO::LoadNso(const std::string& path, VAddr load_base, bool relo | |||
| 121 | ModHeader mod_header{}; | 122 | ModHeader mod_header{}; |
| 122 | u32 bss_size{Memory::PAGE_SIZE}; // Default .bss to page size if MOD0 section doesn't exist | 123 | u32 bss_size{Memory::PAGE_SIZE}; // Default .bss to page size if MOD0 section doesn't exist |
| 123 | std::memcpy(&mod_header, program_image.data() + module_offset, sizeof(ModHeader)); | 124 | std::memcpy(&mod_header, program_image.data() + module_offset, sizeof(ModHeader)); |
| 124 | const bool has_mod_header{mod_header.magic == MakeMagic('M', 'O', 'D', '0')}; | 125 | const bool has_mod_header{mod_header.magic == Common::MakeMagic('M', 'O', 'D', '0')}; |
| 125 | if (has_mod_header) { | 126 | if (has_mod_header) { |
| 126 | // Resize program image to include .bss section and page align each section | 127 | // Resize program image to include .bss section and page align each section |
| 127 | bss_size = PageAlignSize(mod_header.bss_end_offset - mod_header.bss_start_offset); | 128 | bss_size = PageAlignSize(mod_header.bss_end_offset - mod_header.bss_start_offset); |