From 9184c0265eb5ce19f8393761bb87babaa0f976bb Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 24 Oct 2021 10:16:53 +0200 Subject: [PATCH] Add legacy menu dumping unlinker command line argument --- src/ObjWriting/ObjWriting.h | 1 + src/Unlinker/UnlinkerArgs.cpp | 17 ++++++++++++++--- src/Unlinker/UnlinkerArgs.h | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/ObjWriting/ObjWriting.h b/src/ObjWriting/ObjWriting.h index 7bf918f2..beacbf7a 100644 --- a/src/ObjWriting/ObjWriting.h +++ b/src/ObjWriting/ObjWriting.h @@ -28,6 +28,7 @@ public: ImageOutputFormat_e ImageOutputFormat = ImageOutputFormat_e::DDS; ModelOutputFormat_e ModelOutputFormat = ModelOutputFormat_e::XMODEL_EXPORT; + bool MenuLegacyMode = false; } Configuration; diff --git a/src/Unlinker/UnlinkerArgs.cpp b/src/Unlinker/UnlinkerArgs.cpp index 5cfacf96..38062b81 100644 --- a/src/Unlinker/UnlinkerArgs.cpp +++ b/src/Unlinker/UnlinkerArgs.cpp @@ -95,6 +95,12 @@ const CommandLineOption* const OPTION_INCLUDE_ASSETS = .Reusable() .Build(); +const CommandLineOption* const OPTION_LEGACY_MENUS = + CommandLineOption::Builder::Create() + .WithLongName("legacy-menus") + .WithDescription("Dumps menus with a compatibility mode to work with applications not compatible with the newer dumping mode.") + .Build(); + const CommandLineOption* const COMMAND_LINE_OPTIONS[] { OPTION_HELP, @@ -108,11 +114,12 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[] OPTION_MODEL_FORMAT, OPTION_GDT, OPTION_EXCLUDE_ASSETS, - OPTION_INCLUDE_ASSETS + OPTION_INCLUDE_ASSETS, + OPTION_LEGACY_MENUS }; UnlinkerArgs::UnlinkerArgs() - : m_argument_parser(COMMAND_LINE_OPTIONS, std::extent::value), + : m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v), m_zone_pattern(R"(\?zone\?)"), m_task(ProcessingTask::DUMP), m_minimal_zone_def(false), @@ -305,10 +312,14 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv) ParseCommaSeparatedAssetTypeString(include); } + // --legacy-menus + if (m_argument_parser.IsOptionSpecified(OPTION_LEGACY_MENUS)) + ObjWriting::Configuration.MenuLegacyMode = true; + return true; } -std::string UnlinkerArgs::GetOutputFolderPathForZone(Zone* zone) const +std::string UnlinkerArgs::GetOutputFolderPathForZone(const Zone* zone) const { return std::regex_replace(m_output_folder, m_zone_pattern, zone->m_name); } diff --git a/src/Unlinker/UnlinkerArgs.h b/src/Unlinker/UnlinkerArgs.h index 973fa8dd..f02166b4 100644 --- a/src/Unlinker/UnlinkerArgs.h +++ b/src/Unlinker/UnlinkerArgs.h @@ -63,5 +63,5 @@ public: * \param zone The zone to resolve the path input for. * \return An output path for the zone based on the user input. */ - std::string GetOutputFolderPathForZone(Zone* zone) const; + std::string GetOutputFolderPathForZone(const Zone* zone) const; };