mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 23:08:05 -05:00
ZoneLoading: Extract all obj dumping relevant parts to ObjWriting component
This commit is contained in:
39
src/ObjWriting/Dumping/AbstractAssetDumper.h
Normal file
39
src/ObjWriting/Dumping/AbstractAssetDumper.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "IAssetDumper.h"
|
||||
#include "Utils/FileAPI.h"
|
||||
#include "Utils/PathUtils.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
template<class T>
|
||||
class AbstractAssetDumper : public IAssetDumper<T>
|
||||
{
|
||||
protected:
|
||||
virtual std::string GetFileNameForAsset(Zone* zone, T* asset) = 0;
|
||||
virtual void DumpAsset(Zone* zone, T* asset, FileAPI::File* out) = 0;
|
||||
|
||||
public:
|
||||
void DumpPool(Zone* zone, AssetPool<T>* pool, const std::string& basePath) override
|
||||
{
|
||||
for(auto assetInfo : *pool)
|
||||
{
|
||||
std::string assetFilePath = utils::Path::Combine(basePath, GetFileNameForAsset(zone, assetInfo->m_asset));
|
||||
|
||||
FileAPI::DirectoryCreate(utils::Path::GetDirectory(assetFilePath));
|
||||
|
||||
auto file = FileAPI::Open(assetFilePath, FileAPI::Mode::MODE_WRITE);
|
||||
|
||||
if(file.IsOpen())
|
||||
{
|
||||
DumpAsset(zone, assetInfo->m_asset, &file);
|
||||
|
||||
file.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Failed to open file '%s' to dump asset '%s'\n", assetFilePath.c_str(), assetInfo->m_name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
13
src/ObjWriting/Dumping/IAssetDumper.h
Normal file
13
src/ObjWriting/Dumping/IAssetDumper.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
#include "Pool/AssetPool.h"
|
||||
|
||||
template<class T>
|
||||
class IAssetDumper
|
||||
{
|
||||
public:
|
||||
virtual ~IAssetDumper() = default;
|
||||
|
||||
virtual void DumpPool(Zone* zone, AssetPool<T>* pool, const std::string& basePath) = 0;
|
||||
};
|
14
src/ObjWriting/Dumping/IZoneDumper.h
Normal file
14
src/ObjWriting/Dumping/IZoneDumper.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
#include "Utils/FileAPI.h"
|
||||
|
||||
class IZoneDumper
|
||||
{
|
||||
public:
|
||||
virtual ~IZoneDumper() = default;
|
||||
|
||||
virtual bool CanHandleZone(Zone* zone) = 0;
|
||||
virtual bool DumpZone(Zone* zone, const std::string& basePath) = 0;
|
||||
virtual bool WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic) = 0;
|
||||
};
|
63
src/ObjWriting/Dumping/Localize/StringFileDumper.cpp
Normal file
63
src/ObjWriting/Dumping/Localize/StringFileDumper.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
#include "StringFileDumper.h"
|
||||
#include <regex>
|
||||
|
||||
StringFileDumper::StringFileDumper(Zone* zone, FileAPI::File* file)
|
||||
{
|
||||
m_zone = zone;
|
||||
m_file = file;
|
||||
|
||||
m_config_file = "";
|
||||
m_notes = "";
|
||||
m_language_caps = "ENGLISH";
|
||||
|
||||
m_wrote_header = false;
|
||||
}
|
||||
|
||||
void StringFileDumper::SetLanguageName(std::string language)
|
||||
{
|
||||
m_language_caps = std::move(language);
|
||||
for (auto& c : m_language_caps) c = toupper(c);
|
||||
}
|
||||
|
||||
void StringFileDumper::SetConfigFile(std::string configFile)
|
||||
{
|
||||
m_config_file = std::move(configFile);
|
||||
}
|
||||
|
||||
void StringFileDumper::SetNotes(std::string notes)
|
||||
{
|
||||
m_notes = std::move(notes);
|
||||
}
|
||||
|
||||
void StringFileDumper::WriteHeader()
|
||||
{
|
||||
m_file->Printf("// Dumped from fastfile \"%s\".\n", m_zone->m_name.c_str());
|
||||
m_file->Printf("// In their original format the strings might have been separated in multiple files.\n");
|
||||
m_file->Printf("VERSION \"1\"\n");
|
||||
m_file->Printf("CONFIG \"%s\"\n", m_config_file.c_str());
|
||||
m_file->Printf("FILENOTES \"%s\"\n", m_notes.c_str());
|
||||
|
||||
m_wrote_header = true;
|
||||
}
|
||||
|
||||
void StringFileDumper::WriteLocalizeEntry(const std::string& reference, const std::string& value)
|
||||
{
|
||||
if (!m_wrote_header)
|
||||
WriteHeader();
|
||||
|
||||
m_file->Printf("\n");
|
||||
m_file->Printf("REFERENCE %s\n", reference.c_str());
|
||||
|
||||
const std::string escapedValue = std::regex_replace(value, std::regex("\n"), "\\n");
|
||||
|
||||
const std::string valueSpacing = std::string(15 - m_language_caps.length(), ' ');
|
||||
m_file->Printf("LANG_%s%s\"%s\"\n", m_language_caps.c_str(), valueSpacing.c_str(), escapedValue.c_str());
|
||||
}
|
||||
|
||||
void StringFileDumper::Finalize()
|
||||
{
|
||||
if (!m_wrote_header)
|
||||
WriteHeader();
|
||||
|
||||
m_file->Printf("\nENDMARKER");
|
||||
}
|
29
src/ObjWriting/Dumping/Localize/StringFileDumper.h
Normal file
29
src/ObjWriting/Dumping/Localize/StringFileDumper.h
Normal file
@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
#include "Utils/FileAPI.h"
|
||||
|
||||
class StringFileDumper
|
||||
{
|
||||
Zone* m_zone;
|
||||
FileAPI::File* m_file;
|
||||
|
||||
std::string m_config_file;
|
||||
std::string m_notes;
|
||||
std::string m_language_caps;
|
||||
|
||||
bool m_wrote_header;
|
||||
|
||||
void WriteHeader();
|
||||
|
||||
public:
|
||||
StringFileDumper(Zone* zone, FileAPI::File* file);
|
||||
|
||||
void SetConfigFile(std::string configFile);
|
||||
void SetNotes(std::string notes);
|
||||
void SetLanguageName(std::string language);
|
||||
|
||||
void WriteLocalizeEntry(const std::string& reference, const std::string& value);
|
||||
|
||||
void Finalize();
|
||||
};
|
@ -0,0 +1,98 @@
|
||||
#include "AssetDumperLocalizeEntry.h"
|
||||
#include "Dumping/Localize/StringFileDumper.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
std::string AssetDumperLocalizeEntry::GetNameOfLanguage(ZoneLanguage language)
|
||||
{
|
||||
switch(language)
|
||||
{
|
||||
case ZoneLanguage::LANGUAGE_NONE:
|
||||
case ZoneLanguage::LANGUAGE_ENGLISH:
|
||||
default:
|
||||
return "english";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_FRENCH:
|
||||
return "french";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_GERMAN:
|
||||
return "german";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_ITALIAN:
|
||||
return "italian";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_SPANISH:
|
||||
return "spanish";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_BRITISH:
|
||||
return "british";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_RUSSIAN:
|
||||
return "russian";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_POLISH:
|
||||
return "polish";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_KOREAN:
|
||||
return "korean";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_JAPANESE:
|
||||
return "japanese";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_CZECH:
|
||||
return "czech";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_FRENCH_CAN:
|
||||
return "frenchcan";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_AUSTRIAN:
|
||||
return "austrian";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_PORTUGUESE:
|
||||
return "portuguese";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_MEXICAN_SPANISH:
|
||||
return "mexicanspanish";
|
||||
|
||||
case ZoneLanguage::LANGUAGE_FULL_JAPANESE:
|
||||
return "fulljapanese";
|
||||
}
|
||||
}
|
||||
|
||||
void AssetDumperLocalizeEntry::DumpPool(Zone* zone, AssetPool<LocalizeEntry>* pool, const std::string& basePath)
|
||||
{
|
||||
if (pool->m_asset_lookup.size() == 0)
|
||||
return;
|
||||
|
||||
const std::string language = GetNameOfLanguage(zone->m_language);
|
||||
const std::string stringsPath = utils::Path::Combine(basePath, language + "/localizedstrings");
|
||||
|
||||
FileAPI::DirectoryCreate(stringsPath);
|
||||
|
||||
FileAPI::File stringFile = FileAPI::Open(utils::Path::Combine(stringsPath, zone->m_name + ".str"), FileAPI::Mode::MODE_WRITE);
|
||||
|
||||
if(stringFile.IsOpen())
|
||||
{
|
||||
StringFileDumper stringFileDumper(zone, &stringFile);
|
||||
|
||||
stringFileDumper.SetLanguageName(language);
|
||||
|
||||
// Magic string. Original string files do have this config file. The purpose of the config file is unknown though.
|
||||
stringFileDumper.SetConfigFile(R"(C:\projects\cod\t6\bin\StringEd.cfg)");
|
||||
|
||||
stringFileDumper.SetNotes("");
|
||||
|
||||
for(auto localizeEntry : *pool)
|
||||
{
|
||||
stringFileDumper.WriteLocalizeEntry(localizeEntry->m_asset->name, localizeEntry->m_asset->value);
|
||||
}
|
||||
|
||||
stringFileDumper.Finalize();
|
||||
|
||||
stringFile.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Could not create string file for dumping localized strings of zone '%s'\n", zone->m_name.c_str());
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
class AssetDumperLocalizeEntry final : public IAssetDumper<T6::LocalizeEntry>
|
||||
{
|
||||
static std::string GetNameOfLanguage(ZoneLanguage language);
|
||||
|
||||
public:
|
||||
void DumpPool(Zone* zone, AssetPool<T6::LocalizeEntry>* pool, const std::string& basePath) override;
|
||||
};
|
13
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.cpp
Normal file
13
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "AssetDumperQdb.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
std::string AssetDumperQdb::GetFileNameForAsset(Zone* zone, Qdb* asset)
|
||||
{
|
||||
return std::string(asset->name);
|
||||
}
|
||||
|
||||
void AssetDumperQdb::DumpAsset(Zone* zone, Qdb* asset, FileAPI::File* out)
|
||||
{
|
||||
out->Write(asset->buffer, 1, asset->len);
|
||||
}
|
11
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.h
Normal file
11
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
class AssetDumperQdb final : public AbstractAssetDumper<T6::Qdb>
|
||||
{
|
||||
protected:
|
||||
std::string GetFileNameForAsset(Zone* zone, T6::Qdb* asset) override;
|
||||
void DumpAsset(Zone* zone, T6::Qdb* asset, FileAPI::File* out) override;
|
||||
};
|
13
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.cpp
Normal file
13
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "AssetDumperRawFile.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
std::string AssetDumperRawFile::GetFileNameForAsset(Zone* zone, RawFile* asset)
|
||||
{
|
||||
return std::string(asset->name);
|
||||
}
|
||||
|
||||
void AssetDumperRawFile::DumpAsset(Zone* zone, RawFile* asset, FileAPI::File* out)
|
||||
{
|
||||
out->Write(asset->buffer, 1, asset->len);
|
||||
}
|
11
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.h
Normal file
11
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
class AssetDumperRawFile final : public AbstractAssetDumper<T6::RawFile>
|
||||
{
|
||||
protected:
|
||||
std::string GetFileNameForAsset(Zone* zone, T6::RawFile* asset) override;
|
||||
void DumpAsset(Zone* zone, T6::RawFile* asset, FileAPI::File* out) override;
|
||||
};
|
@ -0,0 +1,13 @@
|
||||
#include "AssetDumperScriptParseTree.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
std::string AssetDumperScriptParseTree::GetFileNameForAsset(Zone* zone, ScriptParseTree* asset)
|
||||
{
|
||||
return std::string(asset->name);
|
||||
}
|
||||
|
||||
void AssetDumperScriptParseTree::DumpAsset(Zone* zone, ScriptParseTree* asset, FileAPI::File* out)
|
||||
{
|
||||
out->Write(asset->buffer, 1, asset->len);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
class AssetDumperScriptParseTree final : public AbstractAssetDumper<T6::ScriptParseTree>
|
||||
{
|
||||
protected:
|
||||
std::string GetFileNameForAsset(Zone* zone, T6::ScriptParseTree* asset) override;
|
||||
void DumpAsset(Zone* zone, T6::ScriptParseTree* asset, FileAPI::File* out) override;
|
||||
};
|
13
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.cpp
Normal file
13
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "AssetDumperSlug.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
std::string AssetDumperSlug::GetFileNameForAsset(Zone* zone, Slug* asset)
|
||||
{
|
||||
return std::string(asset->name);
|
||||
}
|
||||
|
||||
void AssetDumperSlug::DumpAsset(Zone* zone, Slug* asset, FileAPI::File* out)
|
||||
{
|
||||
out->Write(asset->buffer, 1, asset->len);
|
||||
}
|
11
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.h
Normal file
11
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
class AssetDumperSlug final : public AbstractAssetDumper<T6::Slug>
|
||||
{
|
||||
protected:
|
||||
std::string GetFileNameForAsset(Zone* zone, T6::Slug* asset) override;
|
||||
void DumpAsset(Zone* zone, T6::Slug* asset, FileAPI::File* out) override;
|
||||
};
|
@ -0,0 +1,37 @@
|
||||
#include "AssetDumperStringTable.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
std::string AssetDumperStringTable::GetFileNameForAsset(Zone* zone, StringTable* asset)
|
||||
{
|
||||
return std::string(asset->name);
|
||||
}
|
||||
|
||||
void AssetDumperStringTable::DumpAsset(Zone* zone, StringTable* asset, FileAPI::File* out)
|
||||
{
|
||||
char separator[]{ ',' };
|
||||
char newLine[]{ '\n' };
|
||||
|
||||
for(int row = 0; row < asset->rowCount; row++)
|
||||
{
|
||||
for(int column = 0; column < asset->columnCount; column++)
|
||||
{
|
||||
const auto cell = &asset->values[column + row * asset->columnCount];
|
||||
|
||||
if (column != 0)
|
||||
{
|
||||
out->Write(separator, 1, sizeof separator);
|
||||
}
|
||||
|
||||
if(cell->string && *cell->string)
|
||||
{
|
||||
out->Write(cell->string, 1, strlen(cell->string));
|
||||
}
|
||||
}
|
||||
|
||||
if (row != asset->rowCount - 1)
|
||||
{
|
||||
out->Write(newLine, 1, sizeof newLine);
|
||||
}
|
||||
}
|
||||
}
|
11
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.h
Normal file
11
src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
class AssetDumperStringTable final : public AbstractAssetDumper<T6::StringTable>
|
||||
{
|
||||
protected:
|
||||
std::string GetFileNameForAsset(Zone* zone, T6::StringTable* asset) override;
|
||||
void DumpAsset(Zone* zone, T6::StringTable* asset, FileAPI::File* out) override;
|
||||
};
|
85
src/ObjWriting/Game/T6/ZoneDumperT6.cpp
Normal file
85
src/ObjWriting/Game/T6/ZoneDumperT6.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
#include "ZoneDumperT6.h"
|
||||
#include "Game/T6/GameT6.h"
|
||||
#include "Game/T6/GameAssetPoolT6.h"
|
||||
|
||||
#include "AssetDumpers/AssetDumperRawFile.h"
|
||||
#include "AssetDumpers/AssetDumperSlug.h"
|
||||
#include "AssetDumpers/AssetDumperQdb.h"
|
||||
#include "AssetDumpers/AssetDumperScriptParseTree.h"
|
||||
#include "AssetDumpers/AssetDumperStringTable.h"
|
||||
#include "AssetDumpers/AssetDumperLocalizeEntry.h"
|
||||
|
||||
bool ZoneDumperT6::CanHandleZone(Zone* zone)
|
||||
{
|
||||
return zone->m_game == &game_t6;
|
||||
}
|
||||
|
||||
bool ZoneDumperT6::DumpZone(Zone* zone, const std::string& basePath)
|
||||
{
|
||||
#define DUMP_ASSET_POOL(dumperType, poolName) \
|
||||
if(assetPools->poolName) \
|
||||
{ \
|
||||
dumperType dumper; \
|
||||
dumper.DumpPool(zone, assetPools->poolName, basePath); \
|
||||
}
|
||||
|
||||
const auto assetPools = dynamic_cast<GameAssetPoolT6*>(zone->GetPools());
|
||||
|
||||
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset);
|
||||
// DUMP_ASSET_POOL(AssetDumperPhysConstraints, m_phys_constraints);
|
||||
// DUMP_ASSET_POOL(AssetDumperDestructibleDef, m_destructible_def);
|
||||
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts);
|
||||
// DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel);
|
||||
// DUMP_ASSET_POOL(AssetDumperMaterial, m_material);
|
||||
// DUMP_ASSET_POOL(AssetDumperTechniqueSet, m_technique_set);
|
||||
// DUMP_ASSET_POOL(AssetDumperGfxImage, m_image);
|
||||
// DUMP_ASSET_POOL(AssetDumperSndBank, m_sound_bank);
|
||||
// DUMP_ASSET_POOL(AssetDumperSndPatch, m_sound_patch);
|
||||
// DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map);
|
||||
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world);
|
||||
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp);
|
||||
// DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp);
|
||||
// DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents);
|
||||
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world);
|
||||
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def);
|
||||
// DUMP_ASSET_POOL(AssetDumperFont, m_font);
|
||||
// DUMP_ASSET_POOL(AssetDumperFontIcon, m_font_icon);
|
||||
// DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list);
|
||||
// DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def);
|
||||
DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize);
|
||||
// DUMP_ASSET_POOL(AssetDumperWeaponVariantDef, m_weapon);
|
||||
// DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment);
|
||||
// DUMP_ASSET_POOL(AssetDumperWeaponAttachmentUnique, m_attachment_unique);
|
||||
// DUMP_ASSET_POOL(AssetDumperWeaponCamo, m_camo);
|
||||
// DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals);
|
||||
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx);
|
||||
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table);
|
||||
DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file);
|
||||
DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table);
|
||||
// DUMP_ASSET_POOL(AssetDumperLeaderboardDef, m_leaderboard);
|
||||
// DUMP_ASSET_POOL(AssetDumperXGlobals, m_xglobals);
|
||||
// DUMP_ASSET_POOL(AssetDumperDDLRoot, m_ddl);
|
||||
// DUMP_ASSET_POOL(AssetDumperGlasses, m_glasses);
|
||||
// DUMP_ASSET_POOL(AssetDumperEmblemSet, m_emblem_set);
|
||||
DUMP_ASSET_POOL(AssetDumperScriptParseTree, m_script);
|
||||
// DUMP_ASSET_POOL(AssetDumperKeyValuePairs, m_key_value_pairs);
|
||||
// DUMP_ASSET_POOL(AssetDumperVehicleDef, m_vehicle);
|
||||
// DUMP_ASSET_POOL(AssetDumperMemoryBlock, m_memory_block);
|
||||
// DUMP_ASSET_POOL(AssetDumperAddonMapEnts, m_addon_map_ents);
|
||||
// DUMP_ASSET_POOL(AssetDumperTracerDef, m_tracer);
|
||||
// DUMP_ASSET_POOL(AssetDumperSkinnedVertsDef, m_skinned_verts);
|
||||
DUMP_ASSET_POOL(AssetDumperQdb, m_qdb);
|
||||
DUMP_ASSET_POOL(AssetDumperSlug, m_slug);
|
||||
// DUMP_ASSET_POOL(AssetDumperFootstepTableDef, m_footstep_table);
|
||||
// DUMP_ASSET_POOL(AssetDumperFootstepFXTableDef, m_footstep_fx_table);
|
||||
// DUMP_ASSET_POOL(AssetDumperZBarrierDef, m_zbarrier);
|
||||
|
||||
return true;
|
||||
|
||||
#undef DUMP_ASSET_POOL
|
||||
}
|
||||
|
||||
bool ZoneDumperT6::WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic)
|
||||
{
|
||||
return true;
|
||||
}
|
10
src/ObjWriting/Game/T6/ZoneDumperT6.h
Normal file
10
src/ObjWriting/Game/T6/ZoneDumperT6.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "Dumping/IZoneDumper.h"
|
||||
|
||||
class ZoneDumperT6 final : public IZoneDumper
|
||||
{
|
||||
public:
|
||||
bool CanHandleZone(Zone* zone) override;
|
||||
bool DumpZone(Zone* zone, const std::string& basePath) override;
|
||||
bool WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic) override;
|
||||
};
|
32
src/ObjWriting/ObjWriting.cpp
Normal file
32
src/ObjWriting/ObjWriting.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "ObjWriting.h"
|
||||
#include "Dumping/IZoneDumper.h"
|
||||
#include "Game/T6/ZoneDumperT6.h"
|
||||
|
||||
IZoneDumper* zoneDumper[]
|
||||
{
|
||||
new ZoneDumperT6()
|
||||
};
|
||||
|
||||
bool ObjWriting::DumpZone(Zone* zone, const std::string& basePath)
|
||||
{
|
||||
for (auto dumper : zoneDumper)
|
||||
{
|
||||
if (dumper->CanHandleZone(zone))
|
||||
{
|
||||
if (dumper->DumpZone(zone, basePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
printf("Dumper for zone '%s' failed!\n", zone->m_name.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ObjWriting::WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic)
|
||||
{
|
||||
return file->Printf("// %s", "Insert zone definition here") > 0;
|
||||
}
|
12
src/ObjWriting/ObjWriting.h
Normal file
12
src/ObjWriting/ObjWriting.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
#include "Utils/FileAPI.h"
|
||||
#include <string>
|
||||
|
||||
class ObjWriting
|
||||
{
|
||||
public:
|
||||
static bool DumpZone(Zone* zone, const std::string& basePath);
|
||||
static bool WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic);
|
||||
};
|
Reference in New Issue
Block a user