diff --git a/src/core/file_sys/archive_ncch.cpp b/src/core/file_sys/archive_ncch.cpp index 94c0dd5803..a8ad696985 100644 --- a/src/core/file_sys/archive_ncch.cpp +++ b/src/core/file_sys/archive_ncch.cpp @@ -12,6 +12,7 @@ #include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" +#include "common/swap.h" #include "core/core.h" #include "core/file_sys/archive_ncch.h" #include "core/file_sys/errors.h" @@ -35,9 +36,9 @@ struct NCCHArchivePath { static_assert(sizeof(NCCHArchivePath) == 0x10, "NCCHArchivePath has wrong size!"); struct NCCHFilePath { - u32_le open_type; + enum_le open_type; u32_le content_index; - u32_le filepath_type; + enum_le filepath_type; std::array exefs_filepath; }; static_assert(sizeof(NCCHFilePath) == 0x14, "NCCHFilePath has wrong size!"); @@ -55,9 +56,9 @@ Path MakeNCCHArchivePath(u64 tid, Service::FS::MediaType media_type) { Path MakeNCCHFilePath(NCCHFileOpenType open_type, u32 content_index, NCCHFilePathType filepath_type, std::array& exefs_filepath) { NCCHFilePath path; - path.open_type = static_cast(open_type); + path.open_type = open_type; path.content_index = static_cast(content_index); - path.filepath_type = static_cast(filepath_type); + path.filepath_type = filepath_type; path.exefs_filepath = exefs_filepath; std::vector file(sizeof(path)); std::memcpy(&file[0], &path, sizeof(path)); @@ -88,15 +89,14 @@ ResultVal> NCCHArchive::OpenFile(const Path& path, std::unique_ptr file; // NCCH RomFS - NCCHFilePathType filepath_type = static_cast(openfile_path.filepath_type); - if (filepath_type == NCCHFilePathType::RomFS) { + if (openfile_path.filepath_type == NCCHFilePathType::RomFS) { std::shared_ptr romfs_file; result = ncch_container.ReadRomFS(romfs_file); std::unique_ptr delay_generator = std::make_unique(); file = std::make_unique(std::move(romfs_file), std::move(delay_generator)); - } else if (filepath_type == NCCHFilePathType::Code || - filepath_type == NCCHFilePathType::ExeFS) { + } else if (openfile_path.filepath_type == NCCHFilePathType::Code || + openfile_path.filepath_type == NCCHFilePathType::ExeFS) { std::vector buffer; // Load NCCH .code or icon/banner/logo @@ -104,7 +104,8 @@ ResultVal> NCCHArchive::OpenFile(const Path& path, std::unique_ptr delay_generator = std::make_unique(); file = std::make_unique(std::move(buffer), std::move(delay_generator)); } else { - LOG_ERROR(Service_FS, "Unknown NCCH archive type {}!", openfile_path.filepath_type); + LOG_ERROR(Service_FS, "Unknown NCCH archive type {}!", + static_cast(openfile_path.filepath_type)); result = Loader::ResultStatus::Error; }