From 2857c12d268952287d35365298900ae2a6ef9fd6 Mon Sep 17 00:00:00 2001 From: FutureRave Date: Sun, 27 Oct 2024 16:51:37 +0000 Subject: [PATCH 1/2] fix: make .str parsing with ZB useful --- README.md | 1 + src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index da1cf519d..91a7194c8 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ To use the `iw4x.dll`, you must have a valid Modern Warfare 2 installation with | `-nosteam` | Disable friends feature and do not update Steam about the game's current status just like an invisible mode. | | `-unprotect-dvars` | Allow the server to modify saved/archive dvars. | | `-zonebuilder` | Start the interactive zonebuilder tool console instead of starting the game. | +| `-original-str-parsing` | (ZoneBuilder mode only) Parse .str files in the same manner as the CoD4 Mod Tools. | | `-disable-notifies` | Disable "Anti-CFG" checks | | `-disable-mongoose` | Disable Mongoose HTTP server | | `-disable-rate-limit-check` | Disable RCon rate limit checks | diff --git a/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp b/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp index 1bd2b6e67..3f4ad8740 100644 --- a/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp +++ b/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp @@ -62,7 +62,12 @@ namespace Assets Components::Localization::PrefixOverride = {}; }); - Components::Localization::PrefixOverride = Utils::String::ToUpper(name) + "_"; + + if (Components::Flags::HasFlag("-original-str-parsing")) + { + Components::Localization::PrefixOverride = Utils::String::ToUpper(name) + "_"; + } + Components::Localization::ParseOutput([&assets](Game::LocalizeEntry* asset) { assets.push_back(asset); From 976e6168b02fdf51499d13e5907155c9df2f9926 Mon Sep 17 00:00:00 2001 From: FutureRave Date: Wed, 6 Nov 2024 11:28:28 +0000 Subject: [PATCH 2/2] fix: remove GSL block --- .../Modules/AssetInterfaces/ILocalizeEntry.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp b/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp index 3f4ad8740..f4da0cd48 100644 --- a/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp +++ b/src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp @@ -56,12 +56,6 @@ namespace Assets void ILocalizeEntry::ParseLocalizedStringsFile(Components::ZoneBuilder::Zone* builder, const std::string& name, const std::string& filename) { std::vector assets; - const auto _0 = gsl::finally([] - { - Components::Localization::ParseOutput(nullptr); - Components::Localization::PrefixOverride = {}; - }); - if (Components::Flags::HasFlag("-original-str-parsing")) { @@ -85,6 +79,9 @@ namespace Assets { builder->addRawAsset(type, entry); } + + Components::Localization::ParseOutput(nullptr); + Components::Localization::PrefixOverride = {}; } void ILocalizeEntry::ParseLocalizedStringsJSON(Components::ZoneBuilder::Zone* builder, Components::FileSystem::File& file)