From ab496ed4aaa6d9263717768d1d7c609c8b33e7f0 Mon Sep 17 00:00:00 2001 From: modeco80 Date: Thu, 16 Jan 2025 02:23:52 -0500 Subject: [PATCH] libeuropa/io/pak: Rename ReadData_Impl() to better reflect its purpose Also remove the `version` field from `pak::Reader`. It was never actually used. --- include/europa/io/pak/Reader.hpp | 5 +---- src/libeuropa/io/pak/Reader.cpp | 13 ++++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/europa/io/pak/Reader.hpp b/include/europa/io/pak/Reader.hpp index 18388e3..d989928 100644 --- a/include/europa/io/pak/Reader.hpp +++ b/include/europa/io/pak/Reader.hpp @@ -42,21 +42,18 @@ namespace europa::io::pak { MapType& GetFiles(); const MapType& GetFiles() const; - // implement in cpp later, lazy and just wanna get this out :vvv const structs::PakHeaderVariant& GetHeader() const { return header; } private: template - void ReadData_Impl(); + void ReadHeaderAndTOCImpl(); std::istream& stream; bool invalid { false }; - structs::PakVersion version; structs::PakHeaderVariant header {}; - MapType files; }; diff --git a/src/libeuropa/io/pak/Reader.cpp b/src/libeuropa/io/pak/Reader.cpp index ce1e075..173ea35 100644 --- a/src/libeuropa/io/pak/Reader.cpp +++ b/src/libeuropa/io/pak/Reader.cpp @@ -23,7 +23,7 @@ namespace europa::io::pak { } template - void Reader::ReadData_Impl() { + void Reader::ReadHeaderAndTOCImpl() { auto header_type = impl::ReadStreamType(stream); if(!header_type.Valid()) { @@ -41,9 +41,8 @@ namespace europa::io::pak { auto filename = impl::ReadPString(stream); auto file = File {}; if constexpr(std::is_same_v) { - // Version 5 supports sector aligned packages which have an additional field in them - // so we need to handle it here - // (not feeling quite as hot about all the crazy template magic here anymore) + // Version 5 supports sector aligned packages, which have an additional field in them + // (the start LBA of the file), so we need to handle that here. if(header_type.sectorAlignedFlag) { file.InitWithExistingTocEntry(impl::ReadStreamType(stream)); } else { @@ -65,13 +64,13 @@ namespace europa::io::pak { switch(commonHeader.version) { case structs::PakVersion::Ver3: - ReadData_Impl(); + ReadHeaderAndTOCImpl(); break; case structs::PakVersion::Ver4: - ReadData_Impl(); + ReadHeaderAndTOCImpl(); break; case structs::PakVersion::Ver5: - ReadData_Impl(); + ReadHeaderAndTOCImpl(); break; default: return;