diff --git a/src/ObjWriting/Dumping/AbstractAssetDumper.h b/src/ObjWriting/Dumping/AbstractAssetDumper.h index 8a70eaa2..2cebdf8b 100644 --- a/src/ObjWriting/Dumping/AbstractAssetDumper.h +++ b/src/ObjWriting/Dumping/AbstractAssetDumper.h @@ -10,24 +10,22 @@ template class AbstractAssetDumper : public IAssetDumper { protected: - virtual bool ShouldDump(T* asset) = 0; - virtual std::string GetFileNameForAsset(Zone* zone, T* asset) = 0; - virtual void DumpAsset(Zone* zone, T* asset, FileAPI::File* out) = 0; + virtual bool ShouldDump(XAssetInfo* asset) = 0; + virtual std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) = 0; + virtual void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) = 0; public: void DumpPool(Zone* zone, AssetPool* pool, const std::string& basePath) override { for(auto assetInfo : *pool) { - T* asset = assetInfo->Asset(); - if(assetInfo->m_name[0] == ',' - || !ShouldDump(asset)) + || !ShouldDump(assetInfo)) { continue; } - std::string assetFilePath = utils::Path::Combine(basePath, GetFileNameForAsset(zone, asset)); + std::string assetFilePath = utils::Path::Combine(basePath, GetFileNameForAsset(zone, assetInfo)); FileAPI::DirectoryCreate(utils::Path::GetDirectory(assetFilePath)); @@ -35,7 +33,7 @@ public: if(file.IsOpen()) { - DumpAsset(zone, asset, &file); + DumpAsset(zone, assetInfo, &file); file.Close(); } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.cpp index 99bcd65f..0569a01f 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.cpp @@ -5,17 +5,18 @@ using namespace IW4; -bool AssetDumperAddonMapEnts::ShouldDump(AddonMapEnts* asset) +bool AssetDumperAddonMapEnts::ShouldDump(XAssetInfo* asset) { return true; } -std::string AssetDumperAddonMapEnts::GetFileNameForAsset(Zone* zone, AddonMapEnts* asset) +std::string AssetDumperAddonMapEnts::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return std::string(asset->name); + return asset->m_name; } -void AssetDumperAddonMapEnts::DumpAsset(Zone* zone, AddonMapEnts* asset, FileAPI::File* out) +void AssetDumperAddonMapEnts::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { - out->Write(asset->entityString, 1, std::max(asset->numEntityChars - 1, 0)); + const auto* addonMapEnts = asset->Asset(); + out->Write(addonMapEnts->entityString, 1, std::max(addonMapEnts->numEntityChars - 1, 0)); } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h index b51021e6..cdaeca5d 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h @@ -8,8 +8,8 @@ namespace IW4 class AssetDumperAddonMapEnts final : public AbstractAssetDumper { protected: - bool ShouldDump(AddonMapEnts* asset) override; - std::string GetFileNameForAsset(Zone* zone, AddonMapEnts* asset) override; - void DumpAsset(Zone* zone, AddonMapEnts* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; }; } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.cpp index c21ed552..834342d0 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.cpp @@ -31,17 +31,19 @@ AssetDumperGfxImage::~AssetDumperGfxImage() m_writer = nullptr; } -bool AssetDumperGfxImage::ShouldDump(GfxImage* asset) +bool AssetDumperGfxImage::ShouldDump(XAssetInfo* asset) { - return asset->cardMemory.platform[0] > 0; + const auto* image = asset->Asset(); + return image->cardMemory.platform[0] > 0; } -std::string AssetDumperGfxImage::GetFileNameForAsset(Zone* zone, GfxImage* asset) +std::string AssetDumperGfxImage::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return "images/" + std::string(asset->name) + m_writer->GetFileExtension(); + return "images/" + asset->m_name + m_writer->GetFileExtension(); } -void AssetDumperGfxImage::DumpAsset(Zone* zone, GfxImage* asset, FileAPI::File* out) +void AssetDumperGfxImage::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { - m_writer->DumpImage(out, asset->texture.texture); + const auto* image = asset->Asset(); + m_writer->DumpImage(out, image->texture.texture); } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.h index 082d4476..cba50f79 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.h @@ -6,18 +6,18 @@ namespace IW4 { - class AssetDumperGfxImage final : public AbstractAssetDumper + class AssetDumperGfxImage final : public AbstractAssetDumper { IImageWriter* m_writer; protected: - bool ShouldDump(IW4::GfxImage* asset) override; - std::string GetFileNameForAsset(Zone* zone, IW4::GfxImage* asset) override; - void DumpAsset(Zone* zone, IW4::GfxImage* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; public: AssetDumperGfxImage(); - ~AssetDumperGfxImage(); + ~AssetDumperGfxImage() override; AssetDumperGfxImage(const AssetDumperGfxImage& other) = delete; AssetDumperGfxImage(AssetDumperGfxImage&& other) noexcept = delete; diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.cpp index 66b4ba7b..9515db79 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.cpp @@ -4,17 +4,17 @@ using namespace IW4; -bool AssetDumperLoadedSound::ShouldDump(LoadedSound* asset) +bool AssetDumperLoadedSound::ShouldDump(XAssetInfo* asset) { return true; } -std::string AssetDumperLoadedSound::GetFileNameForAsset(Zone* zone, LoadedSound* asset) +std::string AssetDumperLoadedSound::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return "sound/" + std::string(asset->name); + return "sound/" + asset->m_name; } -void AssetDumperLoadedSound::DumpWavPcm(Zone* zone, LoadedSound* asset, FileAPI::File* out) +void AssetDumperLoadedSound::DumpWavPcm(Zone* zone, const LoadedSound* asset, FileAPI::File* out) { const uint32_t riffMasterChunkSize = sizeof WAV_CHUNK_ID_RIFF + sizeof uint32_t @@ -55,16 +55,17 @@ void AssetDumperLoadedSound::DumpWavPcm(Zone* zone, LoadedSound* asset, FileAPI: out->Write(asset->sound.data, 1, asset->sound.info.data_len); } -void AssetDumperLoadedSound::DumpAsset(Zone* zone, LoadedSound* asset, FileAPI::File* out) +void AssetDumperLoadedSound::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { - switch (static_cast(asset->sound.info.format)) + const auto* loadedSound = asset->Asset(); + switch (static_cast(loadedSound->sound.info.format)) { case WavFormat::PCM: - DumpWavPcm(zone, asset, out); + DumpWavPcm(zone, loadedSound, out); break; default: - printf("Unknown format %i for loaded sound: %s\n", asset->sound.info.format, asset->name); + printf("Unknown format %i for loaded sound: %s\n", loadedSound->sound.info.format, loadedSound->name); break; } } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.h index e7562a0b..356146bf 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.h @@ -7,10 +7,10 @@ namespace IW4 { class AssetDumperLoadedSound final : public AbstractAssetDumper { - static void DumpWavPcm(Zone* zone, LoadedSound* asset, FileAPI::File* out); + static void DumpWavPcm(Zone* zone, const LoadedSound* asset, FileAPI::File* out); protected: - bool ShouldDump(LoadedSound* asset) override; - std::string GetFileNameForAsset(Zone* zone, LoadedSound* asset) override; - void DumpAsset(Zone* zone, LoadedSound* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; }; } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.h index 5355f354..53fd6bad 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.h @@ -5,9 +5,9 @@ namespace IW4 { - class AssetDumperLocalizeEntry final : public IAssetDumper + class AssetDumperLocalizeEntry final : public IAssetDumper { public: - void DumpPool(Zone* zone, AssetPool* pool, const std::string& basePath) override; + void DumpPool(Zone* zone, AssetPool* pool, const std::string& basePath) override; }; } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.cpp index 0e4b927c..095cb0f4 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.cpp @@ -4,19 +4,20 @@ using namespace IW4; -bool AssetDumperRawFile::ShouldDump(RawFile* asset) +bool AssetDumperRawFile::ShouldDump(XAssetInfo* asset) { return true; } -std::string AssetDumperRawFile::GetFileNameForAsset(Zone* zone, RawFile* asset) +std::string AssetDumperRawFile::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return std::string(asset->name); + return asset->m_name; } -void AssetDumperRawFile::DumpAsset(Zone* zone, RawFile* asset, FileAPI::File* out) +void AssetDumperRawFile::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { - if (asset->compressedLen > 0) + const auto* rawFile = asset->Asset(); + if (rawFile->compressedLen > 0) { z_stream_s zs{}; @@ -33,12 +34,12 @@ void AssetDumperRawFile::DumpAsset(Zone* zone, RawFile* asset, FileAPI::File* ou throw std::exception("Initializing inflate failed"); } - zs.next_in = reinterpret_cast(asset->data.compressedBuffer); - zs.avail_in = asset->compressedLen; + zs.next_in = reinterpret_cast(rawFile->data.compressedBuffer); + zs.avail_in = rawFile->compressedLen; Bytef buffer[0x1000]; - while(zs.avail_in > 0) + while (zs.avail_in > 0) { zs.next_out = buffer; zs.avail_out = sizeof buffer; @@ -46,7 +47,7 @@ void AssetDumperRawFile::DumpAsset(Zone* zone, RawFile* asset, FileAPI::File* ou if (ret < 0) { - printf("Inflate failed for dumping rawfile '%s'\n", asset->name); + printf("Inflate failed for dumping rawfile '%s'\n", rawFile->name); inflateEnd(&zs); return; } @@ -56,8 +57,8 @@ void AssetDumperRawFile::DumpAsset(Zone* zone, RawFile* asset, FileAPI::File* ou inflateEnd(&zs); } - else if (asset->len > 0) + else if (rawFile->len > 0) { - out->Write(asset->data.buffer, 1, asset->len); + out->Write(rawFile->data.buffer, 1, rawFile->len); } } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.h index 1216321e..4296ecc2 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.h @@ -8,8 +8,8 @@ namespace IW4 class AssetDumperRawFile final : public AbstractAssetDumper { protected: - bool ShouldDump(RawFile* asset) override; - std::string GetFileNameForAsset(Zone* zone, RawFile* asset) override; - void DumpAsset(Zone* zone, RawFile* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; }; } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.cpp index 72097ce6..4e94ca4e 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.cpp @@ -4,25 +4,26 @@ using namespace IW4; -bool AssetDumperStringTable::ShouldDump(StringTable* asset) +bool AssetDumperStringTable::ShouldDump(XAssetInfo* asset) { return true; } -std::string AssetDumperStringTable::GetFileNameForAsset(Zone* zone, StringTable* asset) +std::string AssetDumperStringTable::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return std::string(asset->name); + return asset->m_name; } -void AssetDumperStringTable::DumpAsset(Zone* zone, StringTable* asset, FileAPI::File* out) +void AssetDumperStringTable::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { + const auto* stringTable = asset->Asset(); CsvWriter csv(out); - for (int row = 0; row < asset->rowCount; row++) + for (int row = 0; row < stringTable->rowCount; row++) { - for (int column = 0; column < asset->columnCount; column++) + for (int column = 0; column < stringTable->columnCount; column++) { - const auto* cell = &asset->values[column + row * asset->columnCount]; + const auto* cell = &stringTable->values[column + row * stringTable->columnCount]; csv.WriteColumn(cell->string); } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.h index 7c48f647..a69b79e6 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.h @@ -5,11 +5,11 @@ namespace IW4 { - class AssetDumperStringTable final : public AbstractAssetDumper + class AssetDumperStringTable final : public AbstractAssetDumper { protected: - bool ShouldDump(IW4::StringTable* asset) override; - std::string GetFileNameForAsset(Zone* zone, IW4::StringTable* asset) override; - void DumpAsset(Zone* zone, IW4::StringTable* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; }; } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp index 40e7667e..255ce8ea 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp @@ -255,18 +255,18 @@ public: } }; -bool AssetDumperFontIcon::ShouldDump(FontIcon* asset) +bool AssetDumperFontIcon::ShouldDump(XAssetInfo* asset) { return true; } -std::string AssetDumperFontIcon::GetFileNameForAsset(Zone* zone, FontIcon* asset) +std::string AssetDumperFontIcon::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return std::string(asset->name); + return asset->m_name; } -void AssetDumperFontIcon::DumpAsset(Zone* zone, FontIcon* asset, FileAPI::File* out) +void AssetDumperFontIcon::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { AssetDumperFontIconInternal dumper(out); - dumper.DumpFontIcon(asset); + dumper.DumpFontIcon(asset->Asset()); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.h index 2d52a42f..af6ebc2e 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.h @@ -5,11 +5,11 @@ namespace T6 { - class AssetDumperFontIcon final : public AbstractAssetDumper + class AssetDumperFontIcon final : public AbstractAssetDumper { protected: - bool ShouldDump(T6::FontIcon* asset) override; - std::string GetFileNameForAsset(Zone* zone, T6::FontIcon* asset) override; - void DumpAsset(Zone* zone, T6::FontIcon* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; }; } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.cpp index 2f3bfa14..3f3e813b 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.cpp @@ -31,17 +31,19 @@ AssetDumperGfxImage::~AssetDumperGfxImage() m_writer = nullptr; } -bool AssetDumperGfxImage::ShouldDump(GfxImage* asset) +bool AssetDumperGfxImage::ShouldDump(XAssetInfo* asset) { - return asset->loadedSize > 0; + const auto* image = asset->Asset(); + return image->loadedSize > 0; } -std::string AssetDumperGfxImage::GetFileNameForAsset(Zone* zone, GfxImage* asset) +std::string AssetDumperGfxImage::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return "images/" + std::string(asset->name) + m_writer->GetFileExtension(); + return "images/" + asset->m_name + m_writer->GetFileExtension(); } -void AssetDumperGfxImage::DumpAsset(Zone* zone, GfxImage* asset, FileAPI::File* out) +void AssetDumperGfxImage::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { - m_writer->DumpImage(out, asset->texture.texture); + const auto* image = asset->Asset(); + m_writer->DumpImage(out, image->texture.texture); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.h index c597051d..84109c77 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.h @@ -6,18 +6,18 @@ namespace T6 { - class AssetDumperGfxImage final : public AbstractAssetDumper + class AssetDumperGfxImage final : public AbstractAssetDumper { IImageWriter* m_writer; protected: - bool ShouldDump(T6::GfxImage* asset) override; - std::string GetFileNameForAsset(Zone* zone, T6::GfxImage* asset) override; - void DumpAsset(Zone* zone, T6::GfxImage* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; public: AssetDumperGfxImage(); - ~AssetDumperGfxImage(); + ~AssetDumperGfxImage() override; AssetDumperGfxImage(const AssetDumperGfxImage& other) = delete; AssetDumperGfxImage(AssetDumperGfxImage&& other) noexcept = delete; diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.h index ffb2d6e3..cb96902f 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.h @@ -5,9 +5,9 @@ namespace T6 { - class AssetDumperLocalizeEntry final : public IAssetDumper + class AssetDumperLocalizeEntry final : public IAssetDumper { public: - void DumpPool(Zone* zone, AssetPool* pool, const std::string& basePath) override; + void DumpPool(Zone* zone, AssetPool* pool, const std::string& basePath) override; }; } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.cpp index 9de4f841..f9e1311a 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.cpp @@ -2,17 +2,18 @@ using namespace T6; -bool AssetDumperQdb::ShouldDump(Qdb* asset) +bool AssetDumperQdb::ShouldDump(XAssetInfo* asset) { return true; } -std::string AssetDumperQdb::GetFileNameForAsset(Zone* zone, Qdb* asset) +std::string AssetDumperQdb::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return std::string(asset->name); + return asset->m_name; } -void AssetDumperQdb::DumpAsset(Zone* zone, Qdb* asset, FileAPI::File* out) +void AssetDumperQdb::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { - out->Write(asset->buffer, 1, asset->len); + const auto* qdb = asset->Asset(); + out->Write(qdb->buffer, 1, qdb->len); } \ No newline at end of file diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.h index e71e50d2..30bf1848 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.h @@ -5,11 +5,11 @@ namespace T6 { - class AssetDumperQdb final : public AbstractAssetDumper + class AssetDumperQdb final : public AbstractAssetDumper { protected: - bool ShouldDump(T6::Qdb* asset) override; - std::string GetFileNameForAsset(Zone* zone, T6::Qdb* asset) override; - void DumpAsset(Zone* zone, T6::Qdb* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; }; } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.cpp index f4790161..403cd0b2 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.cpp @@ -2,17 +2,18 @@ using namespace T6; -bool AssetDumperRawFile::ShouldDump(RawFile* asset) +bool AssetDumperRawFile::ShouldDump(XAssetInfo* asset) { return true; } -std::string AssetDumperRawFile::GetFileNameForAsset(Zone* zone, RawFile* asset) +std::string AssetDumperRawFile::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return std::string(asset->name); + return asset->m_name; } -void AssetDumperRawFile::DumpAsset(Zone* zone, RawFile* asset, FileAPI::File* out) +void AssetDumperRawFile::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { - out->Write(asset->buffer, 1, asset->len); + const auto* rawFile = asset->Asset(); + out->Write(rawFile->buffer, 1, rawFile->len); } \ No newline at end of file diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.h index 4529d026..9ae92f78 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.h @@ -5,11 +5,11 @@ namespace T6 { - class AssetDumperRawFile final : public AbstractAssetDumper + class AssetDumperRawFile final : public AbstractAssetDumper { protected: - bool ShouldDump(T6::RawFile* asset) override; - std::string GetFileNameForAsset(Zone* zone, T6::RawFile* asset) override; - void DumpAsset(Zone* zone, T6::RawFile* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; }; } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.cpp index 20f676e1..18bcdee2 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.cpp @@ -2,17 +2,18 @@ using namespace T6; -bool AssetDumperScriptParseTree::ShouldDump(ScriptParseTree* asset) +bool AssetDumperScriptParseTree::ShouldDump(XAssetInfo* asset) { return true; } -std::string AssetDumperScriptParseTree::GetFileNameForAsset(Zone* zone, ScriptParseTree* asset) +std::string AssetDumperScriptParseTree::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return std::string(asset->name); + return asset->m_name; } -void AssetDumperScriptParseTree::DumpAsset(Zone* zone, ScriptParseTree* asset, FileAPI::File* out) +void AssetDumperScriptParseTree::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { - out->Write(asset->buffer, 1, asset->len); + const auto* scriptParseTree = asset->Asset(); + out->Write(scriptParseTree->buffer, 1, scriptParseTree->len); } \ No newline at end of file diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.h index 874df319..d5bb2280 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.h @@ -5,11 +5,11 @@ namespace T6 { - class AssetDumperScriptParseTree final : public AbstractAssetDumper + class AssetDumperScriptParseTree final : public AbstractAssetDumper { protected: - bool ShouldDump(T6::ScriptParseTree* asset) override; - std::string GetFileNameForAsset(Zone* zone, T6::ScriptParseTree* asset) override; - void DumpAsset(Zone* zone, T6::ScriptParseTree* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; }; } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.cpp index f32b84e1..c0c19357 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.cpp @@ -2,17 +2,18 @@ using namespace T6; -bool AssetDumperSlug::ShouldDump(Slug* asset) +bool AssetDumperSlug::ShouldDump(XAssetInfo* asset) { return true; } -std::string AssetDumperSlug::GetFileNameForAsset(Zone* zone, Slug* asset) +std::string AssetDumperSlug::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return std::string(asset->name); + return asset->m_name; } -void AssetDumperSlug::DumpAsset(Zone* zone, Slug* asset, FileAPI::File* out) +void AssetDumperSlug::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { - out->Write(asset->buffer, 1, asset->len); + const auto* slug = asset->Asset(); + out->Write(slug->buffer, 1, slug->len); } \ No newline at end of file diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.h index f6a91bf6..098bbce2 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.h @@ -5,11 +5,11 @@ namespace T6 { - class AssetDumperSlug final : public AbstractAssetDumper + class AssetDumperSlug final : public AbstractAssetDumper { protected: - bool ShouldDump(T6::Slug* asset) override; - std::string GetFileNameForAsset(Zone* zone, T6::Slug* asset) override; - void DumpAsset(Zone* zone, T6::Slug* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; }; } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.cpp index 00f43358..4a6c1caa 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.cpp @@ -4,25 +4,26 @@ using namespace T6; -bool AssetDumperStringTable::ShouldDump(StringTable* asset) +bool AssetDumperStringTable::ShouldDump(XAssetInfo* asset) { return true; } -std::string AssetDumperStringTable::GetFileNameForAsset(Zone* zone, StringTable* asset) +std::string AssetDumperStringTable::GetFileNameForAsset(Zone* zone, XAssetInfo* asset) { - return std::string(asset->name); + return asset->m_name; } -void AssetDumperStringTable::DumpAsset(Zone* zone, StringTable* asset, FileAPI::File* out) +void AssetDumperStringTable::DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) { + const auto* stringTable = asset->Asset(); CsvWriter csv(out); - for(int row = 0; row < asset->rowCount; row++) + for(int row = 0; row < stringTable->rowCount; row++) { - for(int column = 0; column < asset->columnCount; column++) + for(int column = 0; column < stringTable->columnCount; column++) { - const auto cell = &asset->values[column + row * asset->columnCount]; + const auto* cell = &stringTable->values[column + row * stringTable->columnCount]; csv.WriteColumn(cell->string); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.h index 75040694..5272b62c 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.h @@ -5,11 +5,11 @@ namespace T6 { - class AssetDumperStringTable final : public AbstractAssetDumper + class AssetDumperStringTable final : public AbstractAssetDumper { protected: - bool ShouldDump(T6::StringTable* asset) override; - std::string GetFileNameForAsset(Zone* zone, T6::StringTable* asset) override; - void DumpAsset(Zone* zone, T6::StringTable* asset, FileAPI::File* out) override; + bool ShouldDump(XAssetInfo* asset) override; + std::string GetFileNameForAsset(Zone* zone, XAssetInfo* asset) override; + void DumpAsset(Zone* zone, XAssetInfo* asset, FileAPI::File* out) override; }; }