diff --git a/include/europa/io/YatfReader.hpp b/include/europa/io/yatf/Reader.hpp similarity index 80% rename from include/europa/io/YatfReader.hpp rename to include/europa/io/yatf/Reader.hpp index e5592e9..1ed91de 100644 --- a/include/europa/io/YatfReader.hpp +++ b/include/europa/io/yatf/Reader.hpp @@ -14,11 +14,11 @@ #include #include -namespace europa::io { +namespace europa::io::yatf { - /// Reader for PS2 Europa .tex files. - struct YatfReader { - explicit YatfReader(std::istream& is); + /// Reader for PS2 Europa .tex (YATF - Yet Another Texture Format) files. + struct Reader { + explicit Reader(std::istream& is); void InitFromStream(std::istream& is); diff --git a/src/libeuropa/CMakeLists.txt b/src/libeuropa/CMakeLists.txt index 50f05e4..958ed15 100644 --- a/src/libeuropa/CMakeLists.txt +++ b/src/libeuropa/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(europa io/pak/Writer.cpp # Yatf IO - io/YatfReader.cpp + io/yatf/Reader.cpp ) target_include_directories(europa PUBLIC ${PROJECT_SOURCE_DIR}/include) diff --git a/src/libeuropa/io/YatfReader.cpp b/src/libeuropa/io/yatf/Reader.cpp similarity index 80% rename from src/libeuropa/io/YatfReader.cpp rename to src/libeuropa/io/yatf/Reader.cpp index 3b02400..010f807 100644 --- a/src/libeuropa/io/YatfReader.cpp +++ b/src/libeuropa/io/yatf/Reader.cpp @@ -10,19 +10,19 @@ // we should just use stbiw directly and provide our own // simpler/faster utilities for image buffers. -#include +#include #include -#include "StreamUtils.h" +#include "../StreamUtils.h" -namespace europa::io { +namespace europa::io::yatf { - YatfReader::YatfReader(std::istream& is) + Reader::Reader(std::istream& is) : stream(is) { InitFromStream(stream); } - void YatfReader::InitFromStream(std::istream& is) { + void Reader::InitFromStream(std::istream& is) { // Read the image header. header = impl::ReadStreamType(is); @@ -30,7 +30,7 @@ namespace europa::io { invalid = true; } - void YatfReader::ReadImage() { + void Reader::ReadImage() { if(header.flags & structs::YatfHeader::TextureFlag_NoPalette) { image.Resize({ static_cast(header.width), static_cast(header.height) }); stream.read(reinterpret_cast(image.GetBuffer()), (header.width * header.height) * sizeof(pixel::RgbaColor)); @@ -52,12 +52,12 @@ namespace europa::io { } } - pixel::RgbaImage& YatfReader::GetImage() { + pixel::RgbaImage& Reader::GetImage() { return image; } - const structs::YatfHeader& YatfReader::GetHeader() const { + const structs::YatfHeader& Reader::GetHeader() const { return header; } -} // namespace europa::io \ No newline at end of file +} // namespace europa::io::yatf \ No newline at end of file diff --git a/src/tools/texdump.cpp b/src/tools/texdump.cpp index 82cf540..648a29f 100644 --- a/src/tools/texdump.cpp +++ b/src/tools/texdump.cpp @@ -8,12 +8,15 @@ #include -#include +#include #include #include #include +namespace eio = europa::io; +namespace yatf = eio::yatf; namespace fs = std::filesystem; + int main(int argc, char** argv) { if(argc != 2) { std::cout << "Usage: " << argv[0] << " [path to Europa PAK file]"; @@ -27,7 +30,7 @@ int main(int argc, char** argv) { return 1; } - europa::io::YatfReader reader(ifs); + yatf::Reader reader(ifs); if(reader.Invalid()) { std::cout << "Invalid YATF file \"" << argv[1] << "\"\n";