diff options
Diffstat (limited to 'src/core/loader/nro.cpp')
| -rw-r--r-- | src/core/loader/nro.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 0115ed0c4..0597cfa60 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -72,7 +72,7 @@ struct AssetHeader { | |||
| 72 | }; | 72 | }; |
| 73 | static_assert(sizeof(AssetHeader) == 0x38, "AssetHeader has incorrect size."); | 73 | static_assert(sizeof(AssetHeader) == 0x38, "AssetHeader has incorrect size."); |
| 74 | 74 | ||
| 75 | AppLoader_NRO::AppLoader_NRO(FileSys::VirtualFile file) : AppLoader(file) { | 75 | AppLoader_NRO::AppLoader_NRO(FileSys::VirtualFile file_) : AppLoader(std::move(file_)) { |
| 76 | NroHeader nro_header{}; | 76 | NroHeader nro_header{}; |
| 77 | if (file->ReadObject(&nro_header) != sizeof(NroHeader)) { | 77 | if (file->ReadObject(&nro_header) != sizeof(NroHeader)) { |
| 78 | return; | 78 | return; |
| @@ -114,10 +114,10 @@ AppLoader_NRO::AppLoader_NRO(FileSys::VirtualFile file) : AppLoader(file) { | |||
| 114 | 114 | ||
| 115 | AppLoader_NRO::~AppLoader_NRO() = default; | 115 | AppLoader_NRO::~AppLoader_NRO() = default; |
| 116 | 116 | ||
| 117 | FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& file) { | 117 | FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& nro_file) { |
| 118 | // Read NSO header | 118 | // Read NSO header |
| 119 | NroHeader nro_header{}; | 119 | NroHeader nro_header{}; |
| 120 | if (sizeof(NroHeader) != file->ReadObject(&nro_header)) { | 120 | if (sizeof(NroHeader) != nro_file->ReadObject(&nro_header)) { |
| 121 | return FileType::Error; | 121 | return FileType::Error; |
| 122 | } | 122 | } |
| 123 | if (nro_header.magic == Common::MakeMagic('N', 'R', 'O', '0')) { | 123 | if (nro_header.magic == Common::MakeMagic('N', 'R', 'O', '0')) { |
| @@ -130,8 +130,7 @@ static constexpr u32 PageAlignSize(u32 size) { | |||
| 130 | return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK); | 130 | return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data, | 133 | static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data) { |
| 134 | const std::string& name) { | ||
| 135 | if (data.size() < sizeof(NroHeader)) { | 134 | if (data.size() < sizeof(NroHeader)) { |
| 136 | return {}; | 135 | return {}; |
| 137 | } | 136 | } |
| @@ -200,8 +199,8 @@ static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data, | |||
| 200 | return true; | 199 | return true; |
| 201 | } | 200 | } |
| 202 | 201 | ||
| 203 | bool AppLoader_NRO::LoadNro(Kernel::Process& process, const FileSys::VfsFile& file) { | 202 | bool AppLoader_NRO::LoadNro(Kernel::Process& process, const FileSys::VfsFile& nro_file) { |
| 204 | return LoadNroImpl(process, file.ReadAllBytes(), file.GetName()); | 203 | return LoadNroImpl(process, nro_file.ReadAllBytes()); |
| 205 | } | 204 | } |
| 206 | 205 | ||
| 207 | AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process, Core::System& system) { | 206 | AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process, Core::System& system) { |