mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 08:05:45 +00:00
Dump zones in zone_dump/zone_raw subfolder
This commit is contained in:
parent
6f6d25da4a
commit
a18f001130
@ -40,7 +40,7 @@ const CommandLineOption* const OPTION_OUTPUT_FOLDER =
|
||||
CommandLineOption::Builder::Create()
|
||||
.WithShortName("o")
|
||||
.WithLongName("output-folder")
|
||||
.WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to ./%zoneName%")
|
||||
.WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to \"" + std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"")
|
||||
.WithParameter("outputFolderPath")
|
||||
.Build();
|
||||
|
||||
@ -77,19 +77,20 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]
|
||||
};
|
||||
|
||||
UnlinkerArgs::UnlinkerArgs()
|
||||
: m_argument_parser(COMMAND_LINE_OPTIONS, std::extent<decltype(COMMAND_LINE_OPTIONS)>::value)
|
||||
: m_argument_parser(COMMAND_LINE_OPTIONS, std::extent<decltype(COMMAND_LINE_OPTIONS)>::value),
|
||||
m_zone_pattern(R"(\?zone\?)"),
|
||||
m_task(ProcessingTask::DUMP),
|
||||
m_minimal_zone_def(false),
|
||||
m_use_gdt(false),
|
||||
m_verbose(false)
|
||||
{
|
||||
m_task = ProcessingTask::DUMP;
|
||||
m_output_folder = "./%zoneName%";
|
||||
|
||||
m_verbose = false;
|
||||
}
|
||||
|
||||
void UnlinkerArgs::PrintUsage()
|
||||
{
|
||||
UsageInformation usage("unlinker.exe");
|
||||
UsageInformation usage("Unlinker.exe");
|
||||
|
||||
for (auto commandLineOption : COMMAND_LINE_OPTIONS)
|
||||
for (const auto* commandLineOption : COMMAND_LINE_OPTIONS)
|
||||
{
|
||||
usage.AddCommandLineOption(commandLineOption);
|
||||
}
|
||||
@ -109,9 +110,9 @@ void UnlinkerArgs::SetVerbose(const bool isVerbose)
|
||||
|
||||
bool UnlinkerArgs::SetImageDumpingMode()
|
||||
{
|
||||
std::string specifiedValue = m_argument_parser.GetValueForOption(OPTION_IMAGE_FORMAT);
|
||||
auto specifiedValue = m_argument_parser.GetValueForOption(OPTION_IMAGE_FORMAT);
|
||||
for (auto& c : specifiedValue)
|
||||
c = tolower(c);
|
||||
c = static_cast<char>(tolower(c));
|
||||
|
||||
if (specifiedValue == "dds")
|
||||
{
|
||||
@ -168,6 +169,8 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv)
|
||||
// -o; --output-folder
|
||||
if (m_argument_parser.IsOptionSpecified(OPTION_OUTPUT_FOLDER))
|
||||
m_output_folder = m_argument_parser.GetValueForOption(OPTION_OUTPUT_FOLDER);
|
||||
else
|
||||
m_output_folder = DEFAULT_OUTPUT_FOLDER;
|
||||
|
||||
// --search-path
|
||||
if (m_argument_parser.IsOptionSpecified(OPTION_SEARCH_PATH))
|
||||
@ -195,5 +198,5 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv)
|
||||
|
||||
std::string UnlinkerArgs::GetOutputFolderPathForZone(Zone* zone) const
|
||||
{
|
||||
return std::regex_replace(m_output_folder, std::regex("%zoneName%"), zone->m_name);
|
||||
return std::regex_replace(m_output_folder, m_zone_pattern, zone->m_name);
|
||||
}
|
||||
|
@ -1,13 +1,19 @@
|
||||
#pragma once
|
||||
#include <regex>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "Utils/Arguments/ArgumentParser.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
class UnlinkerArgs
|
||||
{
|
||||
public:
|
||||
static constexpr const char* DEFAULT_OUTPUT_FOLDER = "zone_dump/zone_raw/?zone?";
|
||||
|
||||
private:
|
||||
ArgumentParser m_argument_parser;
|
||||
std::regex m_zone_pattern;
|
||||
|
||||
/**
|
||||
* \brief Prints a command line usage help text for the Unlinker tool to stdout.
|
||||
|
Loading…
x
Reference in New Issue
Block a user