diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/loader/loader.cpp | 4 | ||||
-rw-r--r-- | src/core/loader/loader.h | 6 | ||||
-rw-r--r-- | src/core/loader/nso.cpp | 10 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 1574345a1..e70f37677 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -87,8 +87,8 @@ const char* GetFileTypeString(FileType type) { * Get a loader for a file with a specific type * @param file The file to load * @param type The type of the file - * @param filename the file name (without path) - * @param filepath the file full path (with name) + * @param file the file to retrieve the loader for + * @param type the file type * @return std::unique_ptr<AppLoader> a pointer to a loader object; nullptr for unsupported type */ static std::unique_ptr<AppLoader> GetFileLoader(FileSys::VirtualFile file, FileType type) { diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 1da9e8099..6f517ca8c 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -154,7 +154,7 @@ public: /** * Get the RomFS of the application * Since the RomFS can be huge, we return a file reference instead of copying to a buffer - * @param file The file containing the RomFS + * @param dir The directory containing the RomFS * @return ResultStatus result of function */ virtual ResultStatus ReadRomFS(FileSys::VirtualFile& dir) { @@ -193,8 +193,8 @@ extern const std::initializer_list<Kernel::AddressMapping> default_address_mappi /** * Identifies a bootable file and return a suitable loader - * @param filename String filename of bootable file - * @return best loader for this file + * @param file The bootable file + * @return the best loader for this file */ std::unique_ptr<AppLoader> GetLoader(FileSys::VirtualFile file); diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index f7752e0e3..c66561bf4 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -55,13 +55,15 @@ AppLoader_NSO::AppLoader_NSO(FileSys::VirtualFile file) : AppLoader(std::move(fi FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) { u32 magic = 0; - file->ReadObject(&magic); + if (file->ReadObject(&magic) != sizeof(magic)) { + return FileType::Error; + } - if (Common::MakeMagic('N', 'S', 'O', '0') == magic) { - return FileType::NSO; + if (Common::MakeMagic('N', 'S', 'O', '0') != magic) { + return FileType::Error; } - return FileType::Error; + return FileType::NSO; } static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, |