From f235798cf6ca22747cfba22ed5485cc43911fe87 Mon Sep 17 00:00:00 2001 From: Simon Ickler Date: Mon, 7 Apr 2025 12:05:03 +0200 Subject: [PATCH 1/5] Added MapEnts dumping for T6 --- .../T6/AssetDumpers/AssetDumperMapEnts.cpp | 27 +++++++++++++++++++ .../Game/T6/AssetDumpers/AssetDumperMapEnts.h | 14 ++++++++++ src/ObjWriting/Game/T6/ObjWriterT6.cpp | 3 ++- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp create mode 100644 src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.h diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp new file mode 100644 index 00000000..7c35ede4 --- /dev/null +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp @@ -0,0 +1,27 @@ +#include "AssetDumperMapEnts.h" + +#include +#include + +using namespace T6; + +bool AssetDumperMapEnts::ShouldDump(XAssetInfo* asset) +{ + return true; +} + +void AssetDumperMapEnts::DumpAsset(AssetDumpingContext& context, XAssetInfo* 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); +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.h new file mode 100644 index 00000000..98b0301a --- /dev/null +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.h @@ -0,0 +1,14 @@ +#pragma once + +#include "Dumping/AbstractAssetDumper.h" +#include "Game/T6/T6.h" + +namespace T6 +{ + class AssetDumperMapEnts final : public AbstractAssetDumper + { + protected: + bool ShouldDump(XAssetInfo* asset) override; + void DumpAsset(AssetDumpingContext& context, XAssetInfo* asset) override; + }; +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/ObjWriterT6.cpp b/src/ObjWriting/Game/T6/ObjWriterT6.cpp index 815ee519..a5c2b0f4 100644 --- a/src/ObjWriting/Game/T6/ObjWriterT6.cpp +++ b/src/ObjWriting/Game/T6/ObjWriterT6.cpp @@ -12,6 +12,7 @@ #include "AssetDumpers/AssetDumperScriptParseTree.h" #include "AssetDumpers/AssetDumperSlug.h" #include "AssetDumpers/AssetDumperSndBank.h" +#include "AssetDumpers/AssetDumperMapEnts.h" #include "AssetDumpers/AssetDumperSndDriverGlobals.h" #include "AssetDumpers/AssetDumperStringTable.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(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP) // 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(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF) // DUMP_ASSET_POOL(AssetDumperFont, m_font, ASSET_TYPE_FONT) From 985996975b31cdf5a7eb085b47045776c3f60629 Mon Sep 17 00:00:00 2001 From: GoastcraftHD Date: Mon, 7 Apr 2025 12:05:56 +0200 Subject: [PATCH 2/5] Update SupportedAssetTypes.md --- docs/SupportedAssetTypes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/SupportedAssetTypes.md b/docs/SupportedAssetTypes.md index 25d4120f..a9c9e375 100644 --- a/docs/SupportedAssetTypes.md +++ b/docs/SupportedAssetTypes.md @@ -177,7 +177,7 @@ The following section specify which assets are supported to be dumped to disk (u | ComWorld | ❌ | ❌ | | | GameWorldSp | ❌ | ❌ | | | GameWorldMp | ❌ | ❌ | | -| MapEnts | ❌ | ❌ | | +| MapEnts | ✅ | ❌ | | | GfxWorld | ❌ | ❌ | | | GfxLightDef | ❌ | ❌ | | | Font_s | ❌ | ❌ | | From a447dd29fa4338e2cb793835d02df771b97bf57d Mon Sep 17 00:00:00 2001 From: GoastcraftHD Date: Mon, 7 Apr 2025 20:05:01 +0200 Subject: [PATCH 3/5] Fixed include order --- src/ObjWriting/Game/T6/ObjWriterT6.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ObjWriting/Game/T6/ObjWriterT6.cpp b/src/ObjWriting/Game/T6/ObjWriterT6.cpp index a5c2b0f4..88df25d8 100644 --- a/src/ObjWriting/Game/T6/ObjWriterT6.cpp +++ b/src/ObjWriting/Game/T6/ObjWriterT6.cpp @@ -4,6 +4,7 @@ #include "AssetDumpers/AssetDumperGfxImage.h" #include "AssetDumpers/AssetDumperLeaderboardDef.h" #include "AssetDumpers/AssetDumperLocalizeEntry.h" +#include "AssetDumpers/AssetDumperMapEnts.h" #include "AssetDumpers/AssetDumperMaterial.h" #include "AssetDumpers/AssetDumperPhysConstraints.h" #include "AssetDumpers/AssetDumperPhysPreset.h" @@ -12,7 +13,6 @@ #include "AssetDumpers/AssetDumperScriptParseTree.h" #include "AssetDumpers/AssetDumperSlug.h" #include "AssetDumpers/AssetDumperSndBank.h" -#include "AssetDumpers/AssetDumperMapEnts.h" #include "AssetDumpers/AssetDumperSndDriverGlobals.h" #include "AssetDumpers/AssetDumperStringTable.h" #include "AssetDumpers/AssetDumperTechniqueSet.h" From b215b220188b3ddbe95fb3359b0ee78a32993103 Mon Sep 17 00:00:00 2001 From: GoastcraftHD Date: Mon, 7 Apr 2025 22:34:21 +0200 Subject: [PATCH 4/5] Fixed MapEnts dumping in wrong folder --- src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp index 7c35ede4..8610af7b 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp @@ -1,6 +1,5 @@ #include "AssetDumperMapEnts.h" -#include #include using namespace T6; @@ -15,13 +14,13 @@ void AssetDumperMapEnts::DumpAsset(AssetDumpingContext& context, XAssetInfoAsset(); std::filesystem::path mapEntsPath(mapEnts->name); - mapEntsPath.replace_extension("map"); + mapEntsPath.replace_extension("ents"); - const auto mapEntsFile = context.OpenAssetFile(std::format("maps/{}", mapEntsPath.filename().string())); + const auto mapEntsFile = context.OpenAssetFile(mapEntsPath.string()); if (!mapEntsFile) return; auto& stream = *mapEntsFile; - stream.write(mapEnts->entityString, mapEnts->numEntityChars); + stream.write(mapEnts->entityString, mapEnts->numEntityChars - 1); } From 0d356969401b772ee1b250915f79959abda1721b Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 7 Apr 2025 22:16:08 +0100 Subject: [PATCH 5/5] chore: make map ents dumping add ents extension instead of replacing --- src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp index 8610af7b..cd4a8165 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperMapEnts.cpp @@ -1,6 +1,6 @@ #include "AssetDumperMapEnts.h" -#include +#include using namespace T6; @@ -13,10 +13,7 @@ void AssetDumperMapEnts::DumpAsset(AssetDumpingContext& context, XAssetInfoAsset(); - std::filesystem::path mapEntsPath(mapEnts->name); - mapEntsPath.replace_extension("ents"); - - const auto mapEntsFile = context.OpenAssetFile(mapEntsPath.string()); + const auto mapEntsFile = context.OpenAssetFile(std::format("{}.ents", mapEnts->name)); if (!mapEntsFile) return;