diff options
| author | 2018-10-15 17:48:36 -0400 | |
|---|---|---|
| committer | 2018-10-15 17:48:36 -0400 | |
| commit | 50e6205c21e398da6554b8c70b801f98035cc456 (patch) | |
| tree | 4929a2300446ae6965191ac5c600a3f767468089 /src/core/loader/nro.cpp | |
| parent | Merge pull request #1500 from DarkLordZach/key-derivation-6.0.0 (diff) | |
| parent | nso: Return an optional address from LoadModule (diff) | |
| download | yuzu-50e6205c21e398da6554b8c70b801f98035cc456.tar.gz yuzu-50e6205c21e398da6554b8c70b801f98035cc456.tar.xz yuzu-50e6205c21e398da6554b8c70b801f98035cc456.zip | |
Merge pull request #1499 from lioncash/nro
nro/nso: Minor error handling changes
Diffstat (limited to 'src/core/loader/nro.cpp')
| -rw-r--r-- | src/core/loader/nro.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 576fe692a..243b499f2 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -127,10 +127,10 @@ static constexpr u32 PageAlignSize(u32 size) { | |||
| 127 | return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; | 127 | return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | bool AppLoader_NRO::LoadNro(FileSys::VirtualFile file, VAddr load_base) { | 130 | bool AppLoader_NRO::LoadNro(const FileSys::VfsFile& file, VAddr load_base) { |
| 131 | // Read NSO header | 131 | // Read NSO header |
| 132 | NroHeader nro_header{}; | 132 | NroHeader nro_header{}; |
| 133 | if (sizeof(NroHeader) != file->ReadObject(&nro_header)) { | 133 | if (sizeof(NroHeader) != file.ReadObject(&nro_header)) { |
| 134 | return {}; | 134 | return {}; |
| 135 | } | 135 | } |
| 136 | if (nro_header.magic != Common::MakeMagic('N', 'R', 'O', '0')) { | 136 | if (nro_header.magic != Common::MakeMagic('N', 'R', 'O', '0')) { |
| @@ -138,7 +138,7 @@ bool AppLoader_NRO::LoadNro(FileSys::VirtualFile file, VAddr load_base) { | |||
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | // Build program image | 140 | // Build program image |
| 141 | std::vector<u8> program_image = file->ReadBytes(PageAlignSize(nro_header.file_size)); | 141 | std::vector<u8> program_image = file.ReadBytes(PageAlignSize(nro_header.file_size)); |
| 142 | if (program_image.size() != PageAlignSize(nro_header.file_size)) { | 142 | if (program_image.size() != PageAlignSize(nro_header.file_size)) { |
| 143 | return {}; | 143 | return {}; |
| 144 | } | 144 | } |
| @@ -182,7 +182,7 @@ bool AppLoader_NRO::LoadNro(FileSys::VirtualFile file, VAddr load_base) { | |||
| 182 | Core::CurrentProcess()->LoadModule(std::move(codeset), load_base); | 182 | Core::CurrentProcess()->LoadModule(std::move(codeset), load_base); |
| 183 | 183 | ||
| 184 | // Register module with GDBStub | 184 | // Register module with GDBStub |
| 185 | GDBStub::RegisterModule(file->GetName(), load_base, load_base); | 185 | GDBStub::RegisterModule(file.GetName(), load_base, load_base); |
| 186 | 186 | ||
| 187 | return true; | 187 | return true; |
| 188 | } | 188 | } |
| @@ -195,7 +195,7 @@ ResultStatus AppLoader_NRO::Load(Kernel::Process& process) { | |||
| 195 | // Load NRO | 195 | // Load NRO |
| 196 | const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress(); | 196 | const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress(); |
| 197 | 197 | ||
| 198 | if (!LoadNro(file, base_address)) { | 198 | if (!LoadNro(*file, base_address)) { |
| 199 | return ResultStatus::ErrorLoadingNRO; | 199 | return ResultStatus::ErrorLoadingNRO; |
| 200 | } | 200 | } |
| 201 | 201 | ||