Add legacy menu dumping unlinker command line argument

This commit is contained in:
Jan 2021-10-24 10:16:53 +02:00
parent 68c29cc22f
commit 9184c0265e
3 changed files with 16 additions and 4 deletions

View File

@ -28,6 +28,7 @@ public:
ImageOutputFormat_e ImageOutputFormat = ImageOutputFormat_e::DDS; ImageOutputFormat_e ImageOutputFormat = ImageOutputFormat_e::DDS;
ModelOutputFormat_e ModelOutputFormat = ModelOutputFormat_e::XMODEL_EXPORT; ModelOutputFormat_e ModelOutputFormat = ModelOutputFormat_e::XMODEL_EXPORT;
bool MenuLegacyMode = false;
} Configuration; } Configuration;

View File

@ -95,6 +95,12 @@ const CommandLineOption* const OPTION_INCLUDE_ASSETS =
.Reusable() .Reusable()
.Build(); .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[] const CommandLineOption* const COMMAND_LINE_OPTIONS[]
{ {
OPTION_HELP, OPTION_HELP,
@ -108,11 +114,12 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]
OPTION_MODEL_FORMAT, OPTION_MODEL_FORMAT,
OPTION_GDT, OPTION_GDT,
OPTION_EXCLUDE_ASSETS, OPTION_EXCLUDE_ASSETS,
OPTION_INCLUDE_ASSETS OPTION_INCLUDE_ASSETS,
OPTION_LEGACY_MENUS
}; };
UnlinkerArgs::UnlinkerArgs() UnlinkerArgs::UnlinkerArgs()
: m_argument_parser(COMMAND_LINE_OPTIONS, std::extent<decltype(COMMAND_LINE_OPTIONS)>::value), : m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>),
m_zone_pattern(R"(\?zone\?)"), m_zone_pattern(R"(\?zone\?)"),
m_task(ProcessingTask::DUMP), m_task(ProcessingTask::DUMP),
m_minimal_zone_def(false), m_minimal_zone_def(false),
@ -305,10 +312,14 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv)
ParseCommaSeparatedAssetTypeString(include); ParseCommaSeparatedAssetTypeString(include);
} }
// --legacy-menus
if (m_argument_parser.IsOptionSpecified(OPTION_LEGACY_MENUS))
ObjWriting::Configuration.MenuLegacyMode = true;
return 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); return std::regex_replace(m_output_folder, m_zone_pattern, zone->m_name);
} }

View File

@ -63,5 +63,5 @@ public:
* \param zone The zone to resolve the path input for. * \param zone The zone to resolve the path input for.
* \return An output path for the zone based on the user input. * \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;
}; };