mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 23:08:05 -05:00
Make dumpers works as gdt dumpers and raw dumpers
This commit is contained in:
@ -86,6 +86,17 @@ std::string InfoString::ToString(const std::string& prefix) const
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void InfoString::ToGdtProperties(const std::string& prefix, GdtEntry& gdtEntry) const
|
||||
{
|
||||
for (const auto& key : m_keys_by_insertion)
|
||||
{
|
||||
const auto value = m_values.find(key);
|
||||
gdtEntry.m_properties[key] = value->second;
|
||||
}
|
||||
|
||||
gdtEntry.m_properties["configstringFileType"] = prefix;
|
||||
}
|
||||
|
||||
void InfoString::FromString()
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "Obj/GDT/GdtEntry.h"
|
||||
#include "Zone/ZoneTypes.h"
|
||||
|
||||
class InfoString
|
||||
@ -21,6 +23,7 @@ public:
|
||||
|
||||
std::string ToString() const;
|
||||
std::string ToString(const std::string& prefix) const;
|
||||
void ToGdtProperties(const std::string& prefix, GdtEntry& gdtEntry) const;
|
||||
|
||||
void FromString();
|
||||
void FromString(const std::string& prefix);
|
||||
|
91
src/ObjWriting/Dumping/AbstractAssetDumper.h
Normal file
91
src/ObjWriting/Dumping/AbstractAssetDumper.h
Normal file
@ -0,0 +1,91 @@
|
||||
#pragma once
|
||||
|
||||
#include "IAssetDumper.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
template<class T>
|
||||
class AbstractAssetDumper : public IAssetDumper<T>
|
||||
{
|
||||
protected:
|
||||
virtual bool ShouldDump(XAssetInfo<T>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool CanDumpAsRaw()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool CanDumpAsGdtEntry()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::string GetFileNameForAsset(Zone* zone, XAssetInfo<T>* asset)
|
||||
{
|
||||
return asset->m_name;
|
||||
}
|
||||
|
||||
virtual void DumpRaw(AssetDumpingContext& context, XAssetInfo<T>* asset, std::ostream& stream)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<T>* asset)
|
||||
{
|
||||
return GdtEntry();
|
||||
}
|
||||
|
||||
public:
|
||||
void DumpPool(AssetDumpingContext& context, AssetPool<T>* pool) override
|
||||
{
|
||||
if(context.m_gdt && CanDumpAsGdtEntry())
|
||||
{
|
||||
for (auto assetInfo : *pool)
|
||||
{
|
||||
if (assetInfo->m_name[0] == ','
|
||||
|| !ShouldDump(assetInfo))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
auto entry = DumpGdtEntry(context, assetInfo);
|
||||
context.m_gdt->WriteEntry(entry);
|
||||
}
|
||||
}
|
||||
else if(CanDumpAsRaw())
|
||||
{
|
||||
for (auto assetInfo : *pool)
|
||||
{
|
||||
if (assetInfo->m_name[0] == ','
|
||||
|| !ShouldDump(assetInfo))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::filesystem::path assetFilePath(context.m_base_path);
|
||||
assetFilePath.append(GetFileNameForAsset(context.m_zone, assetInfo));
|
||||
|
||||
auto assetFileFolder(assetFilePath);
|
||||
assetFileFolder.replace_filename("");
|
||||
create_directories(assetFileFolder);
|
||||
|
||||
std::ofstream file(assetFilePath, std::fstream::out | std::fstream::binary);
|
||||
if (file.is_open())
|
||||
{
|
||||
DumpRaw(context, assetInfo, file);
|
||||
|
||||
file.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Failed to open file '" << assetFilePath.string() << "' to dump asset '" << assetInfo->m_name.c_str() << "'\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -1,48 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "IAssetDumper.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
template<class T>
|
||||
class AbstractFileDumper : public IAssetDumper<T>
|
||||
{
|
||||
protected:
|
||||
virtual bool ShouldDump(XAssetInfo<T>* asset) = 0;
|
||||
virtual std::string GetFileNameForAsset(Zone* zone, XAssetInfo<T>* asset) = 0;
|
||||
virtual void DumpAsset(AssetDumpingContext& context, XAssetInfo<T>* asset, std::ostream& stream) = 0;
|
||||
|
||||
public:
|
||||
void DumpPool(AssetDumpingContext& context, AssetPool<T>* pool) override
|
||||
{
|
||||
for(auto assetInfo : *pool)
|
||||
{
|
||||
if(assetInfo->m_name[0] == ','
|
||||
|| !ShouldDump(assetInfo))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::filesystem::path assetFilePath(context.m_base_path);
|
||||
assetFilePath.append(GetFileNameForAsset(context.m_zone, assetInfo));
|
||||
|
||||
auto assetFileFolder(assetFilePath);
|
||||
assetFileFolder.replace_filename("");
|
||||
create_directories(assetFileFolder);
|
||||
|
||||
std::ofstream file(assetFilePath, std::fstream::out | std::fstream::binary);
|
||||
if(file.is_open())
|
||||
{
|
||||
DumpAsset(context, assetInfo, file);
|
||||
|
||||
file.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Failed to open file '" << assetFilePath.string() << "' to dump asset '" << assetInfo->m_name.c_str() << "'\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -10,12 +10,17 @@ bool AssetDumperAddonMapEnts::ShouldDump(XAssetInfo<AddonMapEnts>* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperAddonMapEnts::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperAddonMapEnts::GetFileNameForAsset(Zone* zone, XAssetInfo<AddonMapEnts>* asset)
|
||||
{
|
||||
return asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperAddonMapEnts::DumpAsset(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset, std::ostream& stream)
|
||||
void AssetDumperAddonMapEnts::DumpRaw(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* addonMapEnts = asset->Asset();
|
||||
stream.write(addonMapEnts->entityString, std::max(addonMapEnts->numEntityChars - 1, 0));
|
||||
|
@ -1,15 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetDumperAddonMapEnts final : public AbstractFileDumper<AddonMapEnts>
|
||||
class AssetDumperAddonMapEnts final : public AbstractAssetDumper<AddonMapEnts>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<AddonMapEnts>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<AddonMapEnts>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ AssetDumperGfxImage::AssetDumperGfxImage()
|
||||
switch (ObjWriting::Configuration.ImageOutputFormat)
|
||||
{
|
||||
case ObjWriting::Configuration_t::ImageOutputFormat_e::DDS:
|
||||
m_writer = new DdsWriter();
|
||||
m_writer = std::make_unique<DdsWriter>();
|
||||
break;
|
||||
case ObjWriting::Configuration_t::ImageOutputFormat_e::IWI:
|
||||
m_writer = new iwi8::IwiWriter();
|
||||
m_writer = std::make_unique<iwi8::IwiWriter>();
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
@ -25,24 +25,23 @@ AssetDumperGfxImage::AssetDumperGfxImage()
|
||||
}
|
||||
}
|
||||
|
||||
AssetDumperGfxImage::~AssetDumperGfxImage()
|
||||
{
|
||||
delete m_writer;
|
||||
m_writer = nullptr;
|
||||
}
|
||||
|
||||
bool AssetDumperGfxImage::ShouldDump(XAssetInfo<GfxImage>* asset)
|
||||
{
|
||||
const auto* image = asset->Asset();
|
||||
return image->cardMemory.platform[0] > 0;
|
||||
}
|
||||
|
||||
bool AssetDumperGfxImage::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperGfxImage::GetFileNameForAsset(Zone* zone, XAssetInfo<GfxImage>* asset)
|
||||
{
|
||||
return "images/" + asset->m_name + m_writer->GetFileExtension();
|
||||
}
|
||||
|
||||
void AssetDumperGfxImage::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream)
|
||||
void AssetDumperGfxImage::DumpRaw(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* image = asset->Asset();
|
||||
m_writer->DumpImage(stream, image->texture.texture);
|
||||
|
@ -1,27 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include <memory>
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Image/IImageWriter.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetDumperGfxImage final : public AbstractFileDumper<GfxImage>
|
||||
class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage>
|
||||
{
|
||||
IImageWriter* m_writer;
|
||||
std::unique_ptr<IImageWriter> m_writer;
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<GfxImage>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<GfxImage>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream) override;
|
||||
|
||||
public:
|
||||
AssetDumperGfxImage();
|
||||
~AssetDumperGfxImage() override;
|
||||
|
||||
AssetDumperGfxImage(const AssetDumperGfxImage& other) = delete;
|
||||
AssetDumperGfxImage(AssetDumperGfxImage&& other) noexcept = delete;
|
||||
AssetDumperGfxImage& operator=(const AssetDumperGfxImage& other) = delete;
|
||||
AssetDumperGfxImage& operator=(AssetDumperGfxImage&& other) noexcept = delete;
|
||||
};
|
||||
}
|
||||
|
@ -9,6 +9,11 @@ bool AssetDumperLoadedSound::ShouldDump(XAssetInfo<LoadedSound>* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperLoadedSound::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperLoadedSound::GetFileNameForAsset(Zone* zone, XAssetInfo<LoadedSound>* asset)
|
||||
{
|
||||
return "sound/" + asset->m_name;
|
||||
@ -55,7 +60,7 @@ void AssetDumperLoadedSound::DumpWavPcm(AssetDumpingContext& context, const Load
|
||||
stream.write(asset->sound.data, asset->sound.info.data_len);
|
||||
}
|
||||
|
||||
void AssetDumperLoadedSound::DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset, std::ostream& stream)
|
||||
void AssetDumperLoadedSound::DumpRaw(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* loadedSound = asset->Asset();
|
||||
switch (static_cast<WavFormat>(loadedSound->sound.info.format))
|
||||
|
@ -1,16 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetDumperLoadedSound final : public AbstractFileDumper<LoadedSound>
|
||||
class AssetDumperLoadedSound final : public AbstractAssetDumper<LoadedSound>
|
||||
{
|
||||
static void DumpWavPcm(AssetDumpingContext& context, const LoadedSound* asset, std::ostream& stream);
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<LoadedSound>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<LoadedSound>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
|
||||
namespace IW4
|
||||
|
@ -10,12 +10,17 @@ bool AssetDumperRawFile::ShouldDump(XAssetInfo<RawFile>* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperRawFile::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperRawFile::GetFileNameForAsset(Zone* zone, XAssetInfo<RawFile>* asset)
|
||||
{
|
||||
return asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream)
|
||||
void AssetDumperRawFile::DumpRaw(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* rawFile = asset->Asset();
|
||||
if (rawFile->compressedLen > 0)
|
||||
|
@ -1,15 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetDumperRawFile final : public AbstractFileDumper<RawFile>
|
||||
class AssetDumperRawFile final : public AbstractAssetDumper<RawFile>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<RawFile>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -9,12 +9,17 @@ bool AssetDumperStringTable::ShouldDump(XAssetInfo<StringTable>* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperStringTable::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperStringTable::GetFileNameForAsset(Zone* zone, XAssetInfo<StringTable>* asset)
|
||||
{
|
||||
return asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream)
|
||||
void AssetDumperStringTable::DumpRaw(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* stringTable = asset->Asset();
|
||||
CsvWriter csv(stream);
|
||||
|
@ -1,15 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetDumperStringTable final : public AbstractFileDumper<StringTable>
|
||||
class AssetDumperStringTable final : public AbstractAssetDumper<StringTable>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<StringTable>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<StringTable>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -231,17 +231,7 @@ namespace IW4
|
||||
};
|
||||
}
|
||||
|
||||
bool AssetDumperVehicle::ShouldDump(XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperVehicle::GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
return "vehicles/" + asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperVehicle::DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream)
|
||||
InfoString AssetDumperVehicle::CreateInfoString(XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, std::extent<decltype(vehicle_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
@ -252,7 +242,41 @@ void AssetDumperVehicle::DumpAsset(AssetDumpingContext& context, XAssetInfo<Vehi
|
||||
return asset->m_zone->m_script_strings[scrStr];
|
||||
});
|
||||
|
||||
const auto infoString = converter.Convert();
|
||||
const auto stringValue = infoString.ToString("VEHICLEFILE");
|
||||
return converter.Convert();
|
||||
}
|
||||
|
||||
bool AssetDumperVehicle::ShouldDump(XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperVehicle::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperVehicle::CanDumpAsGdtEntry()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperVehicle::GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
return "vehicles/" + asset->m_name;
|
||||
}
|
||||
|
||||
GdtEntry AssetDumperVehicle::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
|
||||
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
|
||||
|
||||
return gdtEntry;
|
||||
}
|
||||
|
||||
void AssetDumperVehicle::DumpRaw(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
}
|
@ -1,18 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Utils/InfoString.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetDumperVehicle final : public AbstractFileDumper<VehicleDef>
|
||||
class AssetDumperVehicle final : public AbstractAssetDumper<VehicleDef>
|
||||
{
|
||||
static constexpr const char* FILE_TYPE_STR = "VEHICLEFILE";
|
||||
static constexpr const char* GDF_NAME = "vehicle.gdf";
|
||||
static cspField_t vehicle_fields[];
|
||||
static cspField_t vehicle_fields2[];
|
||||
|
||||
static InfoString CreateInfoString(XAssetInfo<VehicleDef>* asset);
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<VehicleDef>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
bool CanDumpAsGdtEntry() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream) override;
|
||||
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -1162,34 +1162,56 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul
|
||||
}
|
||||
}
|
||||
|
||||
InfoString AssetDumperWeapon::CreateInfoString(XAssetInfo<WeaponCompleteDef>* asset)
|
||||
{
|
||||
const auto fullDef = std::make_unique<WeaponFullDef>();
|
||||
memset(fullDef.get(), 0, sizeof(WeaponFullDef));
|
||||
CopyToFullDef(asset->Asset(), fullDef.get());
|
||||
|
||||
InfoStringFromWeaponConverter converter(fullDef.get(), weapon_fields, std::extent<decltype(weapon_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
assert(scrStr < asset->m_zone->m_script_strings.size());
|
||||
if (scrStr >= asset->m_zone->m_script_strings.size())
|
||||
return "";
|
||||
|
||||
return asset->m_zone->m_script_strings[scrStr];
|
||||
});
|
||||
|
||||
return converter.Convert();
|
||||
}
|
||||
|
||||
bool AssetDumperWeapon::ShouldDump(XAssetInfo<WeaponCompleteDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperWeapon::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperWeapon::CanDumpAsGdtEntry()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperWeapon::GetFileNameForAsset(Zone* zone, XAssetInfo<WeaponCompleteDef>* asset)
|
||||
{
|
||||
return "weapons/" + asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperWeapon::DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset, std::ostream& stream)
|
||||
GdtEntry AssetDumperWeapon::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset)
|
||||
{
|
||||
auto* fullDef = new WeaponFullDef;
|
||||
memset(fullDef, 0, sizeof(WeaponFullDef));
|
||||
CopyToFullDef(asset->Asset(), fullDef);
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
|
||||
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
|
||||
|
||||
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, std::extent<decltype(weapon_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
assert(scrStr < asset->m_zone->m_script_strings.size());
|
||||
if (scrStr >= asset->m_zone->m_script_strings.size())
|
||||
return "";
|
||||
|
||||
return asset->m_zone->m_script_strings[scrStr];
|
||||
});
|
||||
|
||||
const auto infoString = converter.Convert();
|
||||
const auto stringValue = infoString.ToString("WEAPONFILE");
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
|
||||
delete fullDef;
|
||||
return gdtEntry;
|
||||
}
|
||||
|
||||
void AssetDumperWeapon::DumpRaw(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
}
|
||||
|
@ -1,19 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Utils/InfoString.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetDumperWeapon final : public AbstractFileDumper<WeaponCompleteDef>
|
||||
class AssetDumperWeapon final : public AbstractAssetDumper<WeaponCompleteDef>
|
||||
{
|
||||
static constexpr const char* FILE_TYPE_STR = "WEAPONFILE";
|
||||
static constexpr const char* GDF_NAME = "weapon.gdf";
|
||||
static cspField_t weapon_fields[];
|
||||
|
||||
static void CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFullDef* fullDef);
|
||||
static InfoString CreateInfoString(XAssetInfo<WeaponCompleteDef>* asset);
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<WeaponCompleteDef>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
bool CanDumpAsGdtEntry() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<WeaponCompleteDef>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset, std::ostream& stream) override;
|
||||
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -260,12 +260,17 @@ bool AssetDumperFontIcon::ShouldDump(XAssetInfo<FontIcon>* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperFontIcon::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperFontIcon::GetFileNameForAsset(Zone* zone, XAssetInfo<FontIcon>* asset)
|
||||
{
|
||||
return asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperFontIcon::DumpAsset(AssetDumpingContext& context, XAssetInfo<FontIcon>* asset, std::ostream& stream)
|
||||
void AssetDumperFontIcon::DumpRaw(AssetDumpingContext& context, XAssetInfo<FontIcon>* asset, std::ostream& stream)
|
||||
{
|
||||
AssetDumperFontIconInternal dumper(stream);
|
||||
dumper.DumpFontIcon(asset->Asset());
|
||||
|
@ -1,15 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperFontIcon final : public AbstractFileDumper<FontIcon>
|
||||
class AssetDumperFontIcon final : public AbstractAssetDumper<FontIcon>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<FontIcon>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<FontIcon>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<FontIcon>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<FontIcon>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ AssetDumperGfxImage::AssetDumperGfxImage()
|
||||
switch (ObjWriting::Configuration.ImageOutputFormat)
|
||||
{
|
||||
case ObjWriting::Configuration_t::ImageOutputFormat_e::DDS:
|
||||
m_writer = new DdsWriter();
|
||||
m_writer = std::make_unique<DdsWriter>();
|
||||
break;
|
||||
case ObjWriting::Configuration_t::ImageOutputFormat_e::IWI:
|
||||
m_writer = new iwi27::IwiWriter();
|
||||
m_writer = std::make_unique<iwi27::IwiWriter>();
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
@ -25,24 +25,23 @@ AssetDumperGfxImage::AssetDumperGfxImage()
|
||||
}
|
||||
}
|
||||
|
||||
AssetDumperGfxImage::~AssetDumperGfxImage()
|
||||
{
|
||||
delete m_writer;
|
||||
m_writer = nullptr;
|
||||
}
|
||||
|
||||
bool AssetDumperGfxImage::ShouldDump(XAssetInfo<GfxImage>* asset)
|
||||
{
|
||||
const auto* image = asset->Asset();
|
||||
return image->loadedSize > 0;
|
||||
}
|
||||
|
||||
bool AssetDumperGfxImage::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperGfxImage::GetFileNameForAsset(Zone* zone, XAssetInfo<GfxImage>* asset)
|
||||
{
|
||||
return "images/" + asset->m_name + m_writer->GetFileExtension();
|
||||
}
|
||||
|
||||
void AssetDumperGfxImage::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream)
|
||||
void AssetDumperGfxImage::DumpRaw(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* image = asset->Asset();
|
||||
m_writer->DumpImage(stream, image->texture.texture);
|
||||
|
@ -1,27 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include <memory>
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Image/IImageWriter.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperGfxImage final : public AbstractFileDumper<GfxImage>
|
||||
class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage>
|
||||
{
|
||||
IImageWriter* m_writer;
|
||||
std::unique_ptr<IImageWriter> m_writer;
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<GfxImage>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<GfxImage>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream) override;
|
||||
|
||||
public:
|
||||
AssetDumperGfxImage();
|
||||
~AssetDumperGfxImage() override;
|
||||
|
||||
AssetDumperGfxImage(const AssetDumperGfxImage& other) = delete;
|
||||
AssetDumperGfxImage(AssetDumperGfxImage&& other) noexcept = delete;
|
||||
AssetDumperGfxImage& operator=(const AssetDumperGfxImage& other) = delete;
|
||||
AssetDumperGfxImage& operator=(AssetDumperGfxImage&& other) noexcept = delete;
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
namespace T6
|
||||
|
@ -129,17 +129,7 @@ namespace T6
|
||||
};
|
||||
}
|
||||
|
||||
bool AssetDumperPhysConstraints::ShouldDump(XAssetInfo<PhysConstraints>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperPhysConstraints::GetFileNameForAsset(Zone* zone, XAssetInfo<PhysConstraints>* asset)
|
||||
{
|
||||
return "physconstraints/" + asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperPhysConstraints::DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset, std::ostream& stream)
|
||||
InfoString AssetDumperPhysConstraints::CreateInfoString(XAssetInfo<PhysConstraints>* asset)
|
||||
{
|
||||
assert(asset->Asset()->count <= 4);
|
||||
|
||||
@ -152,7 +142,41 @@ void AssetDumperPhysConstraints::DumpAsset(AssetDumpingContext& context, XAssetI
|
||||
return asset->m_zone->m_script_strings[scrStr];
|
||||
});
|
||||
|
||||
const auto infoString = converter.Convert();
|
||||
const auto stringValue = infoString.ToString("PHYSCONSTRAINTS");
|
||||
return converter.Convert();
|
||||
}
|
||||
|
||||
bool AssetDumperPhysConstraints::ShouldDump(XAssetInfo<PhysConstraints>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperPhysConstraints::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperPhysConstraints::CanDumpAsGdtEntry()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperPhysConstraints::GetFileNameForAsset(Zone* zone, XAssetInfo<PhysConstraints>* asset)
|
||||
{
|
||||
return "physconstraints/" + asset->m_name;
|
||||
}
|
||||
|
||||
GdtEntry AssetDumperPhysConstraints::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
|
||||
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
|
||||
|
||||
return gdtEntry;
|
||||
}
|
||||
|
||||
void AssetDumperPhysConstraints::DumpRaw(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
}
|
@ -1,17 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Utils/InfoString.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperPhysConstraints final : public AbstractFileDumper<PhysConstraints>
|
||||
class AssetDumperPhysConstraints final : public AbstractAssetDumper<PhysConstraints>
|
||||
{
|
||||
static constexpr const char* FILE_TYPE_STR = "PHYSCONSTRAINTS";
|
||||
static constexpr const char* GDF_NAME = "physconstraints.gdf";
|
||||
static cspField_t phys_constraints_fields[];
|
||||
|
||||
static InfoString CreateInfoString(XAssetInfo<PhysConstraints>* asset);
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<PhysConstraints>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
bool CanDumpAsGdtEntry() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<PhysConstraints>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset, std::ostream& stream) override;
|
||||
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -77,17 +77,7 @@ void AssetDumperPhysPreset::CopyToPhysPresetInfo(const PhysPreset* physPreset, P
|
||||
physPresetInfo->buoyancyBoxMax = physPreset->buoyancyBoxMax;
|
||||
}
|
||||
|
||||
bool AssetDumperPhysPreset::ShouldDump(XAssetInfo<PhysPreset>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperPhysPreset::GetFileNameForAsset(Zone* zone, XAssetInfo<PhysPreset>* asset)
|
||||
{
|
||||
return "physic/" + asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperPhysPreset::DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset, std::ostream& stream)
|
||||
InfoString AssetDumperPhysPreset::CreateInfoString(XAssetInfo<PhysPreset>* asset)
|
||||
{
|
||||
auto* physPresetInfo = new PhysPresetInfo;
|
||||
CopyToPhysPresetInfo(asset->Asset(), physPresetInfo);
|
||||
@ -101,27 +91,41 @@ void AssetDumperPhysPreset::DumpAsset(AssetDumpingContext& context, XAssetInfo<P
|
||||
return asset->m_zone->m_script_strings[scrStr];
|
||||
});
|
||||
|
||||
const auto infoString = converter.Convert();
|
||||
const auto stringValue = infoString.ToString("PHYSIC");
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
|
||||
delete physPresetInfo;
|
||||
return converter.Convert();
|
||||
}
|
||||
|
||||
//void AssetDumperPhysPreset::CheckFields()
|
||||
//{
|
||||
// assert(std::extent<decltype(physpreset_fields)>::value == std::extent<decltype(fields222)>::value);
|
||||
//
|
||||
// for(auto i = 0u; i < std::extent<decltype(physpreset_fields)>::value; i++)
|
||||
// {
|
||||
// if(physpreset_fields[i].iOffset != fields222[i].iOffset)
|
||||
// {
|
||||
// std::string error = "Error in field: " + std::string(physpreset_fields[i].szName);
|
||||
// MessageBoxA(NULL, error.c_str(), "", 0);
|
||||
// exit(0);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// MessageBoxA(NULL, "No error", "", 0);
|
||||
// exit(0);
|
||||
//}
|
||||
bool AssetDumperPhysPreset::ShouldDump(XAssetInfo<PhysPreset>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperPhysPreset::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperPhysPreset::CanDumpAsGdtEntry()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperPhysPreset::GetFileNameForAsset(Zone* zone, XAssetInfo<PhysPreset>* asset)
|
||||
{
|
||||
return "physic/" + asset->m_name;
|
||||
}
|
||||
|
||||
GdtEntry AssetDumperPhysPreset::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
|
||||
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
|
||||
|
||||
return gdtEntry;
|
||||
}
|
||||
|
||||
void AssetDumperPhysPreset::DumpRaw(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
}
|
@ -1,19 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Utils/InfoString.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperPhysPreset final : public AbstractFileDumper<PhysPreset>
|
||||
class AssetDumperPhysPreset final : public AbstractAssetDumper<PhysPreset>
|
||||
{
|
||||
static constexpr const char* FILE_TYPE_STR = "PHYSIC";
|
||||
static constexpr const char* GDF_NAME = "physpreset.gdf";
|
||||
static cspField_t physpreset_fields[];
|
||||
|
||||
static void CopyToPhysPresetInfo(const PhysPreset* physPreset, PhysPresetInfo* physPresetInfo);
|
||||
static InfoString CreateInfoString(XAssetInfo<PhysPreset>* asset);
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<PhysPreset>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
bool CanDumpAsGdtEntry() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<PhysPreset>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset, std::ostream& stream) override;
|
||||
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -7,12 +7,17 @@ bool AssetDumperQdb::ShouldDump(XAssetInfo<Qdb>* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperQdb::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperQdb::GetFileNameForAsset(Zone* zone, XAssetInfo<Qdb>* asset)
|
||||
{
|
||||
return asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperQdb::DumpAsset(AssetDumpingContext& context, XAssetInfo<Qdb>* asset, std::ostream& stream)
|
||||
void AssetDumperQdb::DumpRaw(AssetDumpingContext& context, XAssetInfo<Qdb>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* qdb = asset->Asset();
|
||||
stream.write(qdb->buffer, qdb->len);
|
||||
|
@ -1,15 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperQdb final : public AbstractFileDumper<Qdb>
|
||||
class AssetDumperQdb final : public AbstractAssetDumper<Qdb>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<Qdb>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<Qdb>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<Qdb>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<Qdb>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -7,12 +7,17 @@ bool AssetDumperRawFile::ShouldDump(XAssetInfo<RawFile>* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperRawFile::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperRawFile::GetFileNameForAsset(Zone* zone, XAssetInfo<RawFile>* asset)
|
||||
{
|
||||
return asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream)
|
||||
void AssetDumperRawFile::DumpRaw(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* rawFile = asset->Asset();
|
||||
stream.write(rawFile->buffer, rawFile->len);
|
||||
|
@ -1,15 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperRawFile final : public AbstractFileDumper<RawFile>
|
||||
class AssetDumperRawFile final : public AbstractAssetDumper<RawFile>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<RawFile>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<RawFile>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -7,12 +7,17 @@ bool AssetDumperScriptParseTree::ShouldDump(XAssetInfo<ScriptParseTree>* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperScriptParseTree::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperScriptParseTree::GetFileNameForAsset(Zone* zone, XAssetInfo<ScriptParseTree>* asset)
|
||||
{
|
||||
return asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperScriptParseTree::DumpAsset(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset, std::ostream& stream)
|
||||
void AssetDumperScriptParseTree::DumpRaw(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* scriptParseTree = asset->Asset();
|
||||
stream.write(scriptParseTree->buffer, scriptParseTree->len);
|
||||
|
@ -1,15 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperScriptParseTree final : public AbstractFileDumper<ScriptParseTree>
|
||||
class AssetDumperScriptParseTree final : public AbstractAssetDumper<ScriptParseTree>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<ScriptParseTree>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<ScriptParseTree>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -7,12 +7,17 @@ bool AssetDumperSlug::ShouldDump(XAssetInfo<Slug>* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperSlug::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperSlug::GetFileNameForAsset(Zone* zone, XAssetInfo<Slug>* asset)
|
||||
{
|
||||
return asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperSlug::DumpAsset(AssetDumpingContext& context, XAssetInfo<Slug>* asset, std::ostream& stream)
|
||||
void AssetDumperSlug::DumpRaw(AssetDumpingContext& context, XAssetInfo<Slug>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* slug = asset->Asset();
|
||||
stream.write(slug->buffer, slug->len);
|
||||
|
@ -1,15 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperSlug final : public AbstractFileDumper<Slug>
|
||||
class AssetDumperSlug final : public AbstractAssetDumper<Slug>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<Slug>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<Slug>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<Slug>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<Slug>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -9,12 +9,17 @@ bool AssetDumperStringTable::ShouldDump(XAssetInfo<StringTable>* asset)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperStringTable::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperStringTable::GetFileNameForAsset(Zone* zone, XAssetInfo<StringTable>* asset)
|
||||
{
|
||||
return asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream)
|
||||
void AssetDumperStringTable::DumpRaw(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* stringTable = asset->Asset();
|
||||
CsvWriter csv(stream);
|
||||
|
@ -1,15 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperStringTable final : public AbstractFileDumper<StringTable>
|
||||
class AssetDumperStringTable final : public AbstractAssetDumper<StringTable>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<StringTable>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<StringTable>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<StringTable>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -76,17 +76,7 @@ namespace T6
|
||||
};
|
||||
}
|
||||
|
||||
bool AssetDumperTracer::ShouldDump(XAssetInfo<TracerDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperTracer::GetFileNameForAsset(Zone* zone, XAssetInfo<TracerDef>* asset)
|
||||
{
|
||||
return "tracer/" + asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperTracer::DumpAsset(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset, std::ostream& stream)
|
||||
InfoString AssetDumperTracer::CreateInfoString(XAssetInfo<TracerDef>* asset)
|
||||
{
|
||||
InfoStringFromTracerConverter converter(asset->Asset(), tracer_fields, std::extent<decltype(tracer_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
@ -97,7 +87,41 @@ void AssetDumperTracer::DumpAsset(AssetDumpingContext& context, XAssetInfo<Trace
|
||||
return asset->m_zone->m_script_strings[scrStr];
|
||||
});
|
||||
|
||||
const auto infoString = converter.Convert();
|
||||
return converter.Convert();
|
||||
}
|
||||
|
||||
bool AssetDumperTracer::ShouldDump(XAssetInfo<TracerDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperTracer::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperTracer::CanDumpAsGdtEntry()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperTracer::GetFileNameForAsset(Zone* zone, XAssetInfo<TracerDef>* asset)
|
||||
{
|
||||
return "tracer/" + asset->m_name;
|
||||
}
|
||||
|
||||
GdtEntry AssetDumperTracer::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
|
||||
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
|
||||
|
||||
return gdtEntry;
|
||||
}
|
||||
|
||||
void AssetDumperTracer::DumpRaw(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
const auto stringValue = infoString.ToString("TRACER");
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
}
|
@ -1,17 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Utils/InfoString.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperTracer final : public AbstractFileDumper<TracerDef>
|
||||
class AssetDumperTracer final : public AbstractAssetDumper<TracerDef>
|
||||
{
|
||||
static constexpr const char* FILE_TYPE_STR = "TRACER";
|
||||
static constexpr const char* GDF_NAME = "tracer.gdf";
|
||||
static cspField_t tracer_fields[];
|
||||
|
||||
static InfoString CreateInfoString(XAssetInfo<TracerDef>* asset);
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<TracerDef>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
bool CanDumpAsGdtEntry() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<TracerDef>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset, std::ostream& stream) override;
|
||||
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -671,17 +671,7 @@ namespace T6
|
||||
};
|
||||
}
|
||||
|
||||
bool AssetDumperVehicle::ShouldDump(XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperVehicle::GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
return "vehicles/" + asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperVehicle::DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream)
|
||||
InfoString AssetDumperVehicle::CreateInfoString(XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, std::extent<decltype(vehicle_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
@ -692,7 +682,41 @@ void AssetDumperVehicle::DumpAsset(AssetDumpingContext& context, XAssetInfo<Vehi
|
||||
return asset->m_zone->m_script_strings[scrStr];
|
||||
});
|
||||
|
||||
const auto infoString = converter.Convert();
|
||||
const auto stringValue = infoString.ToString("VEHICLEFILE");
|
||||
return converter.Convert();
|
||||
}
|
||||
|
||||
bool AssetDumperVehicle::ShouldDump(XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperVehicle::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperVehicle::CanDumpAsGdtEntry()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperVehicle::GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
return "vehicles/" + asset->m_name;
|
||||
}
|
||||
|
||||
GdtEntry AssetDumperVehicle::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
|
||||
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
|
||||
|
||||
return gdtEntry;
|
||||
}
|
||||
|
||||
void AssetDumperVehicle::DumpRaw(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
}
|
||||
|
@ -1,17 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Utils/InfoString.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperVehicle final : public AbstractFileDumper<VehicleDef>
|
||||
class AssetDumperVehicle final : public AbstractAssetDumper<VehicleDef>
|
||||
{
|
||||
static constexpr const char* FILE_TYPE_STR = "VEHICLEFILE";
|
||||
static constexpr const char* GDF_NAME = "vehicle.gdf";
|
||||
static cspField_t vehicle_fields[];
|
||||
|
||||
static InfoString CreateInfoString(XAssetInfo<VehicleDef>* asset);
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<VehicleDef>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
bool CanDumpAsGdtEntry() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<VehicleDef>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream) override;
|
||||
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -1502,7 +1502,7 @@ namespace T6
|
||||
};
|
||||
}
|
||||
|
||||
void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFullDef* fullDef) const
|
||||
void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFullDef* fullDef)
|
||||
{
|
||||
fullDef->weapVariantDef = *weapon;
|
||||
|
||||
@ -1623,17 +1623,7 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull
|
||||
}
|
||||
}
|
||||
|
||||
bool AssetDumperWeapon::ShouldDump(XAssetInfo<WeaponVariantDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperWeapon::GetFileNameForAsset(Zone* zone, XAssetInfo<WeaponVariantDef>* asset)
|
||||
{
|
||||
return "weapons/" + asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperWeapon::DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset, std::ostream& stream)
|
||||
InfoString AssetDumperWeapon::CreateInfoString(XAssetInfo<WeaponVariantDef>* asset)
|
||||
{
|
||||
auto* fullDef = new WeaponFullDef;
|
||||
memset(fullDef, 0, sizeof(WeaponFullDef));
|
||||
@ -1648,9 +1638,41 @@ void AssetDumperWeapon::DumpAsset(AssetDumpingContext& context, XAssetInfo<Weapo
|
||||
return asset->m_zone->m_script_strings[scrStr];
|
||||
});
|
||||
|
||||
const auto infoString = converter.Convert();
|
||||
const auto stringValue = infoString.ToString("WEAPONFILE");
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
|
||||
delete fullDef;
|
||||
return converter.Convert();
|
||||
}
|
||||
|
||||
bool AssetDumperWeapon::ShouldDump(XAssetInfo<WeaponVariantDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperWeapon::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperWeapon::CanDumpAsGdtEntry()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperWeapon::GetFileNameForAsset(Zone* zone, XAssetInfo<WeaponVariantDef>* asset)
|
||||
{
|
||||
return "weapons/" + asset->m_name;
|
||||
}
|
||||
|
||||
GdtEntry AssetDumperWeapon::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
|
||||
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
|
||||
|
||||
return gdtEntry;
|
||||
}
|
||||
|
||||
void AssetDumperWeapon::DumpRaw(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
}
|
||||
|
@ -1,19 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Utils/InfoString.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperWeapon final : public AbstractFileDumper<WeaponVariantDef>
|
||||
class AssetDumperWeapon final : public AbstractAssetDumper<WeaponVariantDef>
|
||||
{
|
||||
static constexpr const char* FILE_TYPE_STR = "WEAPONFILE";
|
||||
static constexpr const char* GDF_NAME = "weapon.gdf";
|
||||
static cspField_t weapon_fields[];
|
||||
|
||||
void CopyToFullDef(const WeaponVariantDef* weapon, WeaponFullDef* fullDef) const;
|
||||
static void CopyToFullDef(const WeaponVariantDef* weapon, WeaponFullDef* fullDef);
|
||||
static InfoString CreateInfoString(XAssetInfo<WeaponVariantDef>* asset);
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<WeaponVariantDef>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
bool CanDumpAsGdtEntry() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<WeaponVariantDef>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset, std::ostream& stream) override;
|
||||
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
@ -174,17 +174,7 @@ namespace T6
|
||||
};
|
||||
}
|
||||
|
||||
bool AssetDumperZBarrier::ShouldDump(XAssetInfo<ZBarrierDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperZBarrier::GetFileNameForAsset(Zone* zone, XAssetInfo<ZBarrierDef>* asset)
|
||||
{
|
||||
return "zbarrier/" + asset->m_name;
|
||||
}
|
||||
|
||||
void AssetDumperZBarrier::DumpAsset(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset, std::ostream& stream)
|
||||
InfoString AssetDumperZBarrier::CreateInfoString(XAssetInfo<ZBarrierDef>* asset)
|
||||
{
|
||||
InfoStringFromZBarrierConverter converter(asset->Asset(), zbarrier_fields, std::extent<decltype(zbarrier_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
@ -195,25 +185,41 @@ void AssetDumperZBarrier::DumpAsset(AssetDumpingContext& context, XAssetInfo<ZBa
|
||||
return asset->m_zone->m_script_strings[scrStr];
|
||||
});
|
||||
|
||||
const auto infoString = converter.Convert();
|
||||
const auto stringValue = infoString.ToString("ZBARRIER");
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
return converter.Convert();
|
||||
}
|
||||
|
||||
//void AssetDumperZBarrier::CheckFields()
|
||||
//{
|
||||
// assert(std::extent<decltype(zbarrier_fields)>::value == std::extent<decltype(fields222)>::value);
|
||||
//
|
||||
// for(auto i = 0u; i < std::extent<decltype(zbarrier_fields)>::value; i++)
|
||||
// {
|
||||
// if(zbarrier_fields[i].iOffset != fields222[i].iOffset)
|
||||
// {
|
||||
// std::string error = "Error in field: " + std::string(zbarrier_fields[i].szName);
|
||||
// MessageBoxA(NULL, error.c_str(), "", 0);
|
||||
// exit(0);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// MessageBoxA(NULL, "No error", "", 0);
|
||||
// exit(0);
|
||||
//}
|
||||
bool AssetDumperZBarrier::ShouldDump(XAssetInfo<ZBarrierDef>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperZBarrier::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetDumperZBarrier::CanDumpAsGdtEntry()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperZBarrier::GetFileNameForAsset(Zone* zone, XAssetInfo<ZBarrierDef>* asset)
|
||||
{
|
||||
return "zbarrier/" + asset->m_name;
|
||||
}
|
||||
|
||||
GdtEntry AssetDumperZBarrier::DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
GdtEntry gdtEntry(asset->m_name, GDF_NAME);
|
||||
infoString.ToGdtProperties(FILE_TYPE_STR, gdtEntry);
|
||||
|
||||
return gdtEntry;
|
||||
}
|
||||
|
||||
void AssetDumperZBarrier::DumpRaw(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto infoString = CreateInfoString(asset);
|
||||
const auto stringValue = infoString.ToString(FILE_TYPE_STR);
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
}
|
||||
|
@ -1,17 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractFileDumper.h"
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Utils/InfoString.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetDumperZBarrier final : public AbstractFileDumper<ZBarrierDef>
|
||||
class AssetDumperZBarrier final : public AbstractAssetDumper<ZBarrierDef>
|
||||
{
|
||||
static constexpr const char* FILE_TYPE_STR = "ZBARRIER";
|
||||
static constexpr const char* GDF_NAME = "zbarrier.gdf";
|
||||
static cspField_t zbarrier_fields[];
|
||||
|
||||
static InfoString CreateInfoString(XAssetInfo<ZBarrierDef>* asset);
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<ZBarrierDef>* asset) override;
|
||||
bool CanDumpAsRaw() override;
|
||||
bool CanDumpAsGdtEntry() override;
|
||||
|
||||
std::string GetFileNameForAsset(Zone* zone, XAssetInfo<ZBarrierDef>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset, std::ostream& stream) override;
|
||||
GdtEntry DumpGdtEntry(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset) override;
|
||||
void DumpRaw(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset, std::ostream& stream) override;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user