Added MapEnts dumping for T6

This commit is contained in:
Simon Ickler 2025-04-07 12:05:03 +02:00
parent 0228e86980
commit f235798cf6
3 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,27 @@
#include "AssetDumperMapEnts.h"
#include <format>
#include <filesystem>
using namespace T6;
bool AssetDumperMapEnts::ShouldDump(XAssetInfo<MapEnts>* asset)
{
return true;
}
void AssetDumperMapEnts::DumpAsset(AssetDumpingContext& context, XAssetInfo<MapEnts>* asset)
{
const auto* mapEnts = asset->Asset();
std::filesystem::path mapEntsPath(mapEnts->name);
mapEntsPath.replace_extension("map");
const auto mapEntsFile = context.OpenAssetFile(std::format("maps/{}", mapEntsPath.filename().string()));
if (!mapEntsFile)
return;
auto& stream = *mapEntsFile;
stream.write(mapEnts->entityString, mapEnts->numEntityChars);
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
{
class AssetDumperMapEnts final : public AbstractAssetDumper<MapEnts>
{
protected:
bool ShouldDump(XAssetInfo<MapEnts>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<MapEnts>* asset) override;
};
} // namespace T6

View File

@ -12,6 +12,7 @@
#include "AssetDumpers/AssetDumperScriptParseTree.h" #include "AssetDumpers/AssetDumperScriptParseTree.h"
#include "AssetDumpers/AssetDumperSlug.h" #include "AssetDumpers/AssetDumperSlug.h"
#include "AssetDumpers/AssetDumperSndBank.h" #include "AssetDumpers/AssetDumperSndBank.h"
#include "AssetDumpers/AssetDumperMapEnts.h"
#include "AssetDumpers/AssetDumperSndDriverGlobals.h" #include "AssetDumpers/AssetDumperSndDriverGlobals.h"
#include "AssetDumpers/AssetDumperStringTable.h" #include "AssetDumpers/AssetDumperStringTable.h"
#include "AssetDumpers/AssetDumperTechniqueSet.h" #include "AssetDumpers/AssetDumperTechniqueSet.h"
@ -53,7 +54,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD) // DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP) // DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)
// DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp, ASSET_TYPE_GAMEWORLD_MP) // DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp, ASSET_TYPE_GAMEWORLD_MP)
// DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS) DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS)
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD) // DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF) // DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
// DUMP_ASSET_POOL(AssetDumperFont, m_font, ASSET_TYPE_FONT) // DUMP_ASSET_POOL(AssetDumperFont, m_font, ASSET_TYPE_FONT)