diff --git a/src/ObjWriting/Game/IW3/Localize/AssetDumperLocalizeEntry.cpp b/src/ObjWriting/Game/IW3/Localize/AssetDumperLocalizeEntry.cpp deleted file mode 100644 index d95a03b7..00000000 --- a/src/ObjWriting/Game/IW3/Localize/AssetDumperLocalizeEntry.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "AssetDumperLocalizeEntry.h" - -#include "Dumping/Localize/StringFileDumper.h" -#include "Localize/LocalizeCommon.h" - -#include -#include - -using namespace IW3; - -void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool* pool) -{ - if (pool->m_asset_lookup.empty()) - return; - - const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language); - const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name)); - - if (assetFile) - { - StringFileDumper stringFileDumper(context.m_zone, *assetFile); - - 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:/trees/cod3/cod3/bin/StringEd.cfg)"); - - stringFileDumper.SetNotes(""); - - for (auto* localizeEntry : *pool) - { - stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value); - } - - stringFileDumper.Finalize(); - } - else - { - std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name); - } -} diff --git a/src/ObjWriting/Game/IW3/Localize/LocalizeDumperIW3.cpp b/src/ObjWriting/Game/IW3/Localize/LocalizeDumperIW3.cpp new file mode 100644 index 00000000..e01f32d7 --- /dev/null +++ b/src/ObjWriting/Game/IW3/Localize/LocalizeDumperIW3.cpp @@ -0,0 +1,44 @@ +#include "LocalizeDumperIW3.h" + +#include "Dumping/Localize/StringFileDumper.h" +#include "Localize/LocalizeCommon.h" + +#include +#include + +using namespace IW3; + +namespace IW3::localize +{ + void Dumper::DumpPool(AssetDumpingContext& context, AssetPool* pool) + { + if (pool->m_asset_lookup.empty()) + return; + + const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language); + const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name)); + + if (assetFile) + { + StringFileDumper stringFileDumper(context.m_zone, *assetFile); + + 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:/trees/cod3/cod3/bin/StringEd.cfg)"); + + stringFileDumper.SetNotes(""); + + for (auto* localizeEntry : *pool) + { + stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value); + } + + stringFileDumper.Finalize(); + } + else + { + std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name); + } + } +} // namespace IW3::localize diff --git a/src/ObjWriting/Game/IW3/Localize/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/IW3/Localize/LocalizeDumperIW3.h similarity index 64% rename from src/ObjWriting/Game/IW3/Localize/AssetDumperLocalizeEntry.h rename to src/ObjWriting/Game/IW3/Localize/LocalizeDumperIW3.h index 02d18955..aebdd9aa 100644 --- a/src/ObjWriting/Game/IW3/Localize/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/IW3/Localize/LocalizeDumperIW3.h @@ -3,11 +3,11 @@ #include "Dumping/AbstractAssetDumper.h" #include "Game/IW3/IW3.h" -namespace IW3 +namespace IW3::localize { - class AssetDumperLocalizeEntry final : public IAssetDumper + class Dumper final : public IAssetDumper { public: void DumpPool(AssetDumpingContext& context, AssetPool* pool) override; }; -} // namespace IW3 +} // namespace IW3::localize diff --git a/src/ObjWriting/Game/IW3/ObjWriterIW3.cpp b/src/ObjWriting/Game/IW3/ObjWriterIW3.cpp index cec9c088..4f9b11b7 100644 --- a/src/ObjWriting/Game/IW3/ObjWriterIW3.cpp +++ b/src/ObjWriting/Game/IW3/ObjWriterIW3.cpp @@ -3,7 +3,7 @@ #include "Game/IW3/GameAssetPoolIW3.h" #include "Game/IW3/XModel/XModelDumperIW3.h" #include "Image/ImageDumperIW3.h" -#include "Localize/AssetDumperLocalizeEntry.h" +#include "Localize/LocalizeDumperIW3.h" #include "Maps/AssetDumperMapEnts.h" #include "Material/DumperMaterialIW3.h" #include "ObjWriting.h" @@ -44,7 +44,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const // DUMP_ASSET_POOL(AssetDumperFont_s, m_font, ASSET_TYPE_FONT) // DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST) // DUMP_ASSET_POOL(AssetDumpermenuDef_t, m_menu_def, ASSET_TYPE_MENU) - DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize, ASSET_TYPE_LOCALIZE_ENTRY) + DUMP_ASSET_POOL(localize::Dumper, m_localize, ASSET_TYPE_LOCALIZE_ENTRY) // DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON) // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX) diff --git a/src/ObjWriting/Game/IW4/Localize/AssetDumperLocalizeEntry.cpp b/src/ObjWriting/Game/IW4/Localize/AssetDumperLocalizeEntry.cpp deleted file mode 100644 index ef1799ac..00000000 --- a/src/ObjWriting/Game/IW4/Localize/AssetDumperLocalizeEntry.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "AssetDumperLocalizeEntry.h" - -#include "Dumping/Localize/StringFileDumper.h" -#include "Localize/LocalizeCommon.h" - -#include -#include - -using namespace IW4; - -void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool* pool) -{ - if (pool->m_asset_lookup.empty()) - return; - - const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language); - const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name)); - - if (assetFile) - { - StringFileDumper stringFileDumper(context.m_zone, *assetFile); - - 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:/trees/cod3/cod3/bin/StringEd.cfg)"); - - stringFileDumper.SetNotes(""); - - for (auto* localizeEntry : *pool) - { - stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value); - } - - stringFileDumper.Finalize(); - } - else - { - std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name); - } -} diff --git a/src/ObjWriting/Game/IW4/Localize/LocalizeDumperIW4.cpp b/src/ObjWriting/Game/IW4/Localize/LocalizeDumperIW4.cpp new file mode 100644 index 00000000..3efb30ea --- /dev/null +++ b/src/ObjWriting/Game/IW4/Localize/LocalizeDumperIW4.cpp @@ -0,0 +1,44 @@ +#include "LocalizeDumperIW4.h" + +#include "Dumping/Localize/StringFileDumper.h" +#include "Localize/LocalizeCommon.h" + +#include +#include + +using namespace IW4; + +namespace IW4::localize +{ + void Dumper::DumpPool(AssetDumpingContext& context, AssetPool* pool) + { + if (pool->m_asset_lookup.empty()) + return; + + const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language); + const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name)); + + if (assetFile) + { + StringFileDumper stringFileDumper(context.m_zone, *assetFile); + + 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:/trees/cod3/cod3/bin/StringEd.cfg)"); + + stringFileDumper.SetNotes(""); + + for (auto* localizeEntry : *pool) + { + stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value); + } + + stringFileDumper.Finalize(); + } + else + { + std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name); + } + } +} // namespace IW4::localize diff --git a/src/ObjWriting/Game/IW4/Localize/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/IW4/Localize/LocalizeDumperIW4.h similarity index 64% rename from src/ObjWriting/Game/IW4/Localize/AssetDumperLocalizeEntry.h rename to src/ObjWriting/Game/IW4/Localize/LocalizeDumperIW4.h index cc1e07f2..f7435a5b 100644 --- a/src/ObjWriting/Game/IW4/Localize/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/IW4/Localize/LocalizeDumperIW4.h @@ -3,11 +3,11 @@ #include "Dumping/AbstractAssetDumper.h" #include "Game/IW4/IW4.h" -namespace IW4 +namespace IW4::localize { - class AssetDumperLocalizeEntry final : public IAssetDumper + class Dumper final : public IAssetDumper { public: void DumpPool(AssetDumpingContext& context, AssetPool* pool) override; }; -} // namespace IW4 +} // namespace IW4::localize diff --git a/src/ObjWriting/Game/IW4/ObjWriterIW4.cpp b/src/ObjWriting/Game/IW4/ObjWriterIW4.cpp index 4a32c507..13ae2541 100644 --- a/src/ObjWriting/Game/IW4/ObjWriterIW4.cpp +++ b/src/ObjWriting/Game/IW4/ObjWriterIW4.cpp @@ -5,7 +5,7 @@ #include "Image/ImageDumperIW4.h" #include "Leaderboard/LeaderboardJsonDumperIW4.h" #include "LightDef/LightDefDumperIW4.h" -#include "Localize/AssetDumperLocalizeEntry.h" +#include "Localize/LocalizeDumperIW4.h" #include "Maps/AssetDumperAddonMapEnts.h" #include "Material/DumperMaterialIW4.h" #include "Menu/AssetDumperMenuDef.h" @@ -61,7 +61,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const // DUMP_ASSET_POOL(AssetDumperFont_s, m_font, ASSET_TYPE_FONT) DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST) DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def, ASSET_TYPE_MENU) - DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize, ASSET_TYPE_LOCALIZE_ENTRY) + DUMP_ASSET_POOL(localize::Dumper, m_localize, ASSET_TYPE_LOCALIZE_ENTRY) DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON) // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX) diff --git a/src/ObjWriting/Game/IW5/Localize/AssetDumperLocalizeEntry.cpp b/src/ObjWriting/Game/IW5/Localize/AssetDumperLocalizeEntry.cpp deleted file mode 100644 index 600e41b8..00000000 --- a/src/ObjWriting/Game/IW5/Localize/AssetDumperLocalizeEntry.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "AssetDumperLocalizeEntry.h" - -#include "Dumping/Localize/StringFileDumper.h" -#include "Localize/LocalizeCommon.h" - -#include -#include - -using namespace IW5; - -void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool* pool) -{ - if (pool->m_asset_lookup.empty()) - return; - - const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language); - const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name)); - - if (assetFile) - { - StringFileDumper stringFileDumper(context.m_zone, *assetFile); - - 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:/trees/cod3/cod3/bin/StringEd.cfg)"); - - stringFileDumper.SetNotes(""); - - for (auto* localizeEntry : *pool) - { - stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value); - } - - stringFileDumper.Finalize(); - } - else - { - std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name); - } -} diff --git a/src/ObjWriting/Game/IW5/Localize/LocalizeDumperIW5.cpp b/src/ObjWriting/Game/IW5/Localize/LocalizeDumperIW5.cpp new file mode 100644 index 00000000..f29817a2 --- /dev/null +++ b/src/ObjWriting/Game/IW5/Localize/LocalizeDumperIW5.cpp @@ -0,0 +1,44 @@ +#include "LocalizeDumperIW5.h" + +#include "Dumping/Localize/StringFileDumper.h" +#include "Localize/LocalizeCommon.h" + +#include +#include + +using namespace IW5; + +namespace IW5::localize +{ + void Dumper::DumpPool(AssetDumpingContext& context, AssetPool* pool) + { + if (pool->m_asset_lookup.empty()) + return; + + const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language); + const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name)); + + if (assetFile) + { + StringFileDumper stringFileDumper(context.m_zone, *assetFile); + + 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:/trees/cod3/cod3/bin/StringEd.cfg)"); + + stringFileDumper.SetNotes(""); + + for (auto* localizeEntry : *pool) + { + stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value); + } + + stringFileDumper.Finalize(); + } + else + { + std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name); + } + } +} // namespace IW5::localize diff --git a/src/ObjWriting/Game/IW5/Localize/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/IW5/Localize/LocalizeDumperIW5.h similarity index 64% rename from src/ObjWriting/Game/IW5/Localize/AssetDumperLocalizeEntry.h rename to src/ObjWriting/Game/IW5/Localize/LocalizeDumperIW5.h index 151dcd73..91cfdee3 100644 --- a/src/ObjWriting/Game/IW5/Localize/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/IW5/Localize/LocalizeDumperIW5.h @@ -3,11 +3,11 @@ #include "Dumping/AbstractAssetDumper.h" #include "Game/IW5/IW5.h" -namespace IW5 +namespace IW5::localize { - class AssetDumperLocalizeEntry final : public IAssetDumper + class Dumper final : public IAssetDumper { public: void DumpPool(AssetDumpingContext& context, AssetPool* pool) override; }; -} // namespace IW5 +} // namespace IW5::localize diff --git a/src/ObjWriting/Game/IW5/ObjWriterIW5.cpp b/src/ObjWriting/Game/IW5/ObjWriterIW5.cpp index 7a10547f..ee374cc4 100644 --- a/src/ObjWriting/Game/IW5/ObjWriterIW5.cpp +++ b/src/ObjWriting/Game/IW5/ObjWriterIW5.cpp @@ -4,7 +4,7 @@ #include "Game/IW5/XModel/XModelDumperIW5.h" #include "Image/ImageDumperIW5.h" #include "Leaderboard/LeaderboardJsonDumperIW5.h" -#include "Localize/AssetDumperLocalizeEntry.h" +#include "Localize/LocalizeDumperIW5.h" #include "Maps/AssetDumperAddonMapEnts.h" #include "Material/DumperMaterialIW5.h" #include "Menu/AssetDumperMenuDef.h" @@ -55,7 +55,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const // DUMP_ASSET_POOL(AssetDumperFont_s, m_font, ASSET_TYPE_FONT) DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST) DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def, ASSET_TYPE_MENU) - DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize, ASSET_TYPE_LOCALIZE_ENTRY) + DUMP_ASSET_POOL(localize::Dumper, m_localize, ASSET_TYPE_LOCALIZE_ENTRY) DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment, ASSET_TYPE_ATTACHMENT) DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX) diff --git a/src/ObjWriting/Game/T5/Localize/AssetDumperLocalizeEntry.cpp b/src/ObjWriting/Game/T5/Localize/AssetDumperLocalizeEntry.cpp deleted file mode 100644 index 0377f5cf..00000000 --- a/src/ObjWriting/Game/T5/Localize/AssetDumperLocalizeEntry.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "AssetDumperLocalizeEntry.h" - -#include "Dumping/Localize/StringFileDumper.h" -#include "Localize/LocalizeCommon.h" - -#include -#include - -using namespace T5; - -void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool* pool) -{ - if (pool->m_asset_lookup.empty()) - return; - - const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language); - const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name)); - - if (assetFile) - { - StringFileDumper stringFileDumper(context.m_zone, *assetFile); - - 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/t5/bin/StringEd.cfg)"); - - stringFileDumper.SetNotes(""); - - for (auto* localizeEntry : *pool) - { - stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value); - } - - stringFileDumper.Finalize(); - } - else - { - std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name); - } -} diff --git a/src/ObjWriting/Game/T5/Localize/LocalizeDumperT5.cpp b/src/ObjWriting/Game/T5/Localize/LocalizeDumperT5.cpp new file mode 100644 index 00000000..5da3d791 --- /dev/null +++ b/src/ObjWriting/Game/T5/Localize/LocalizeDumperT5.cpp @@ -0,0 +1,44 @@ +#include "LocalizeDumperT5.h" + +#include "Dumping/Localize/StringFileDumper.h" +#include "Localize/LocalizeCommon.h" + +#include +#include + +using namespace T5; + +namespace T5::localize +{ + void Dumper::DumpPool(AssetDumpingContext& context, AssetPool* pool) + { + if (pool->m_asset_lookup.empty()) + return; + + const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language); + const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name)); + + if (assetFile) + { + StringFileDumper stringFileDumper(context.m_zone, *assetFile); + + 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/t5/bin/StringEd.cfg)"); + + stringFileDumper.SetNotes(""); + + for (auto* localizeEntry : *pool) + { + stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value); + } + + stringFileDumper.Finalize(); + } + else + { + std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name); + } + } +} // namespace T5::localize diff --git a/src/ObjWriting/Game/T5/Localize/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/T5/Localize/LocalizeDumperT5.h similarity index 64% rename from src/ObjWriting/Game/T5/Localize/AssetDumperLocalizeEntry.h rename to src/ObjWriting/Game/T5/Localize/LocalizeDumperT5.h index e4aec7e8..e317d37d 100644 --- a/src/ObjWriting/Game/T5/Localize/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/T5/Localize/LocalizeDumperT5.h @@ -3,11 +3,11 @@ #include "Dumping/AbstractAssetDumper.h" #include "Game/T5/T5.h" -namespace T5 +namespace T5::localize { - class AssetDumperLocalizeEntry final : public IAssetDumper + class Dumper final : public IAssetDumper { public: void DumpPool(AssetDumpingContext& context, AssetPool* pool) override; }; -} // namespace T5 +} // namespace T5::localize diff --git a/src/ObjWriting/Game/T5/ObjWriterT5.cpp b/src/ObjWriting/Game/T5/ObjWriterT5.cpp index 7dd14410..7528ea67 100644 --- a/src/ObjWriting/Game/T5/ObjWriterT5.cpp +++ b/src/ObjWriting/Game/T5/ObjWriterT5.cpp @@ -3,7 +3,7 @@ #include "Game/T5/GameAssetPoolT5.h" #include "Game/T5/XModel/XModelDumperT5.h" #include "Image/ImageDumperT5.h" -#include "Localize/AssetDumperLocalizeEntry.h" +#include "Localize/LocalizeDumperT5.h" #include "Material/DumperMaterialT5.h" #include "ObjWriting.h" #include "PhysConstraints/AssetDumperPhysConstraints.h" @@ -46,7 +46,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const // DUMP_ASSET_POOL(AssetDumperFont, m_font, ASSET_TYPE_FONT) // DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST) // DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def, ASSET_TYPE_MENU) - DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize, ASSET_TYPE_LOCALIZE_ENTRY) + DUMP_ASSET_POOL(localize::Dumper, m_localize, ASSET_TYPE_LOCALIZE_ENTRY) // DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON) // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX) diff --git a/src/ObjWriting/Game/T6/Localize/AssetDumperLocalizeEntry.cpp b/src/ObjWriting/Game/T6/Localize/AssetDumperLocalizeEntry.cpp deleted file mode 100644 index e9ebf735..00000000 --- a/src/ObjWriting/Game/T6/Localize/AssetDumperLocalizeEntry.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "AssetDumperLocalizeEntry.h" - -#include "Dumping/Localize/StringFileDumper.h" -#include "Localize/LocalizeCommon.h" - -#include -#include - -using namespace T6; - -void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool* pool) -{ - if (pool->m_asset_lookup.empty()) - return; - - const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language); - const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name)); - - if (assetFile) - { - StringFileDumper stringFileDumper(context.m_zone, *assetFile); - - 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_name, localizeEntry->Asset()->value); - } - - stringFileDumper.Finalize(); - } - else - { - std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name); - } -} diff --git a/src/ObjWriting/Game/T6/Localize/LocalizeDumperT6.cpp b/src/ObjWriting/Game/T6/Localize/LocalizeDumperT6.cpp new file mode 100644 index 00000000..b989f9e2 --- /dev/null +++ b/src/ObjWriting/Game/T6/Localize/LocalizeDumperT6.cpp @@ -0,0 +1,44 @@ +#include "LocalizeDumperT6.h" + +#include "Dumping/Localize/StringFileDumper.h" +#include "Localize/LocalizeCommon.h" + +#include +#include + +using namespace T6; + +namespace T6::localize +{ + void Dumper::DumpPool(AssetDumpingContext& context, AssetPool* pool) + { + if (pool->m_asset_lookup.empty()) + return; + + const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language); + const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name)); + + if (assetFile) + { + StringFileDumper stringFileDumper(context.m_zone, *assetFile); + + 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_name, localizeEntry->Asset()->value); + } + + stringFileDumper.Finalize(); + } + else + { + std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name); + } + } +} // namespace T6::localize diff --git a/src/ObjWriting/Game/T6/Localize/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/T6/Localize/LocalizeDumperT6.h similarity index 64% rename from src/ObjWriting/Game/T6/Localize/AssetDumperLocalizeEntry.h rename to src/ObjWriting/Game/T6/Localize/LocalizeDumperT6.h index d85de9ac..f0591f38 100644 --- a/src/ObjWriting/Game/T6/Localize/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/T6/Localize/LocalizeDumperT6.h @@ -3,11 +3,11 @@ #include "Dumping/AbstractAssetDumper.h" #include "Game/T6/T6.h" -namespace T6 +namespace T6::localize { - class AssetDumperLocalizeEntry final : public IAssetDumper + class Dumper final : public IAssetDumper { public: void DumpPool(AssetDumpingContext& context, AssetPool* pool) override; }; -} // namespace T6 +} // namespace T6::localize diff --git a/src/ObjWriting/Game/T6/ObjWriterT6.cpp b/src/ObjWriting/Game/T6/ObjWriterT6.cpp index 4a33c00d..97f4143d 100644 --- a/src/ObjWriting/Game/T6/ObjWriterT6.cpp +++ b/src/ObjWriting/Game/T6/ObjWriterT6.cpp @@ -5,7 +5,7 @@ #include "Game/T6/XModel/XModelDumperT6.h" #include "Image/ImageDumperT6.h" #include "Leaderboard/LeaderboardJsonDumperT6.h" -#include "Localize/AssetDumperLocalizeEntry.h" +#include "Localize/LocalizeDumperT6.h" #include "Maps/AssetDumperMapEnts.h" #include "Material/DumperMaterialT6.h" #include "ObjWriting.h" @@ -67,7 +67,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const DUMP_ASSET_POOL_WITH_FACTORY(font_icon::CreateDumper(), m_font_icon, ASSET_TYPE_FONTICON) // DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST) // DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def, ASSET_TYPE_MENU) - DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize, ASSET_TYPE_LOCALIZE_ENTRY) + DUMP_ASSET_POOL(localize::Dumper, m_localize, ASSET_TYPE_LOCALIZE_ENTRY) DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON) DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment, ASSET_TYPE_ATTACHMENT) DUMP_ASSET_POOL(AssetDumperWeaponAttachmentUnique, m_attachment_unique, ASSET_TYPE_ATTACHMENT_UNIQUE)