Reformat code with clang format

This commit is contained in:
Clang Format
2023-11-19 15:28:38 +01:00
committed by Jan
parent 22e17272fd
commit 6b4f5d94a8
1099 changed files with 16763 additions and 18076 deletions

View File

@ -11,7 +11,7 @@ void ContentPrinter::PrintContent() const
printf("Zone '%s' (%s)\n", m_zone->m_name.c_str(), m_zone->m_game->GetShortName().c_str());
puts("Content:");
for(const auto& asset : *pools)
for (const auto& asset : *pools)
{
printf("%s, %s\n", pools->GetAssetTypeName(asset->m_type), asset->m_name.c_str());
}

View File

@ -10,4 +10,4 @@ public:
explicit ContentPrinter(Zone* zone);
void PrintContent() const;
};
};

View File

@ -8,7 +8,7 @@ void AbstractZoneDefWriter::WriteZoneDef(std::ostream& stream, const UnlinkerArg
out.WriteMetaData(META_DATA_KEY_GAME, zone->m_game->GetShortName());
out.EmptyLine();
if(args->m_use_gdt)
if (args->m_use_gdt)
{
out.WriteComment("Load asset gdt files");
out.WriteMetaData(META_DATA_KEY_GDT, zone->m_name);
@ -17,4 +17,4 @@ void AbstractZoneDefWriter::WriteZoneDef(std::ostream& stream, const UnlinkerArg
WriteMetaData(out, args, zone);
WriteContent(out, args, zone);
}
}

View File

@ -1,8 +1,8 @@
#pragma once
#include "UnlinkerArgs.h"
#include "Zone/Zone.h"
#include "Zone/Definition/ZoneDefinitionStream.h"
#include "Zone/Zone.h"
class IZoneDefWriter
{
@ -23,10 +23,10 @@ class AbstractZoneDefWriter : public IZoneDefWriter
protected:
static constexpr const char* META_DATA_KEY_GAME = "game";
static constexpr const char* META_DATA_KEY_GDT = "gdt";
virtual void WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const = 0;
virtual void WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const = 0;
public:
void WriteZoneDef(std::ostream& stream, const UnlinkerArgs* args, Zone* zone) const override;
};
};

View File

@ -1,9 +1,9 @@
#include "ZoneDefWriterIW3.h"
#include <cassert>
#include "Game/IW3/GameIW3.h"
#include "Game/IW3/GameAssetPoolIW3.h"
#include "Game/IW3/GameIW3.h"
#include <cassert>
using namespace IW3;
@ -12,9 +12,7 @@ bool ZoneDefWriter::CanHandleZone(Zone* zone) const
return zone->m_game == &g_GameIW3;
}
void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const
{
}
void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const {}
void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const
{

View File

@ -13,4 +13,4 @@ namespace IW3
public:
bool CanHandleZone(Zone* zone) const override;
};
}
} // namespace IW3

View File

@ -1,9 +1,9 @@
#include "ZoneDefWriterIW4.h"
#include <cassert>
#include "Game/IW4/GameIW4.h"
#include "Game/IW4/GameAssetPoolIW4.h"
#include "Game/IW4/GameIW4.h"
#include <cassert>
using namespace IW4;
@ -12,9 +12,7 @@ bool ZoneDefWriter::CanHandleZone(Zone* zone) const
return zone->m_game == &g_GameIW4;
}
void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const
{
}
void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const {}
void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const
{

View File

@ -13,4 +13,4 @@ namespace IW4
public:
bool CanHandleZone(Zone* zone) const override;
};
}
} // namespace IW4

View File

@ -1,9 +1,9 @@
#include "ZoneDefWriterIW5.h"
#include <cassert>
#include "Game/IW5/GameIW5.h"
#include "Game/IW5/GameAssetPoolIW5.h"
#include "Game/IW5/GameIW5.h"
#include <cassert>
using namespace IW5;
@ -12,9 +12,7 @@ bool ZoneDefWriter::CanHandleZone(Zone* zone) const
return zone->m_game == &g_GameIW5;
}
void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const
{
}
void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const {}
void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const
{

View File

@ -13,4 +13,4 @@ namespace IW5
public:
bool CanHandleZone(Zone* zone) const override;
};
}
} // namespace IW5

View File

@ -1,9 +1,9 @@
#include "ZoneDefWriterT5.h"
#include <cassert>
#include "Game/T5/GameT5.h"
#include "Game/T5/GameAssetPoolT5.h"
#include "Game/T5/GameT5.h"
#include <cassert>
using namespace T5;
@ -12,9 +12,7 @@ bool ZoneDefWriter::CanHandleZone(Zone* zone) const
return zone->m_game == &g_GameT5;
}
void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const
{
}
void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const {}
void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const
{

View File

@ -13,4 +13,4 @@ namespace T5
public:
bool CanHandleZone(Zone* zone) const override;
};
}
} // namespace T5

View File

@ -1,11 +1,12 @@
#include "ZoneDefWriterT6.h"
#include "Game/T6/GameT6.h"
#include "Game/T6/CommonT6.h"
#include "Game/T6/GameAssetPoolT6.h"
#include "Game/T6/GameT6.h"
#include <sstream>
#include <iomanip>
#include <cassert>
#include <iomanip>
#include <sstream>
using namespace T6;
@ -24,14 +25,13 @@ namespace T6
}
};
const KeyValuePairKnownKey KEY_VALUE_PAIR_KNOWN_KEYS[]
{
const KeyValuePairKnownKey KEY_VALUE_PAIR_KNOWN_KEYS[]{
KeyValuePairKnownKey("ipak_read"),
KeyValuePairKnownKey("ipak_write"),
KeyValuePairKnownKey("initial_xmodels"),
KeyValuePairKnownKey("initial_materials"),
};
}
} // namespace T6
bool ZoneDefWriter::CanHandleZone(Zone* zone) const
{
@ -99,4 +99,4 @@ void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const Unlin
break;
}
}
}
}

View File

@ -16,4 +16,4 @@ namespace T6
public:
bool CanHandleZone(Zone* zone) const override;
};
}
} // namespace T6

View File

@ -1,37 +1,36 @@
#include "Unlinker.h"
#include <set>
#include <regex>
#include <filesystem>
#include <fstream>
#include "Utils/ClassUtils.h"
#include "Utils/Arguments/ArgumentParser.h"
#include "ZoneLoading.h"
#include "ObjWriting.h"
#include "ContentLister/ContentPrinter.h"
#include "ObjLoading.h"
#include "SearchPath/SearchPaths.h"
#include "SearchPath/SearchPathFilesystem.h"
#include "ContentLister/ZoneDefWriter.h"
#include "ObjContainer/IWD/IWD.h"
#include "UnlinkerArgs.h"
#include "Game/IW3/ZoneDefWriterIW3.h"
#include "Game/IW4/ZoneDefWriterIW4.h"
#include "Game/IW5/ZoneDefWriterIW5.h"
#include "Game/T5/ZoneDefWriterT5.h"
#include "Game/T6/ZoneDefWriterT6.h"
#include "ObjContainer/IWD/IWD.h"
#include "ObjLoading.h"
#include "ObjWriting.h"
#include "SearchPath/SearchPathFilesystem.h"
#include "SearchPath/SearchPaths.h"
#include "UnlinkerArgs.h"
#include "Utils/Arguments/ArgumentParser.h"
#include "Utils/ClassUtils.h"
#include "Utils/ObjFileStream.h"
#include "ZoneLoading.h"
#include <filesystem>
#include <fstream>
#include <regex>
#include <set>
namespace fs = std::filesystem;
const IZoneDefWriter* const ZONE_DEF_WRITERS[]
{
const IZoneDefWriter* const ZONE_DEF_WRITERS[]{
new IW3::ZoneDefWriter(),
new IW4::ZoneDefWriter(),
new IW5::ZoneDefWriter(),
new T5::ZoneDefWriter(),
new T6::ZoneDefWriter()
new T6::ZoneDefWriter(),
};
class Unlinker::Impl
@ -346,7 +345,6 @@ class Unlinker::Impl
ObjLoading::LoadObjDataForZone(&searchPathsForZone, zone.get());
}
m_loaded_zones.emplace_back(std::move(zone));
}
@ -403,7 +401,7 @@ class Unlinker::Impl
if (ShouldLoadObj())
{
ObjLoading::LoadReferencedContainersForZone(&searchPathsForZone, zone.get());
ObjLoading::LoadObjDataForZone(&searchPathsForZone, zone.get());
ObjLoading::LoadObjDataForZone(&searchPathsForZone, zone.get());
}
if (!HandleZone(zone.get()))

View File

@ -21,4 +21,4 @@ public:
* \return \c true if the application was successful or \c false if an error occurred.
*/
bool Start(int argc, const char** argv) const;
};
};

View File

@ -1,129 +1,104 @@
#include "UnlinkerArgs.h"
#include "ObjLoading.h"
#include "ObjWriting.h"
#include "Utils/Arguments/UsageInformation.h"
#include "Utils/FileUtils.h"
#include <regex>
#include <type_traits>
#include "Utils/Arguments/UsageInformation.h"
#include "ObjLoading.h"
#include "ObjWriting.h"
#include "Utils/FileUtils.h"
const CommandLineOption* const OPTION_HELP =
CommandLineOption::Builder::Create()
.WithShortName("?")
.WithLongName("help")
.WithDescription("Displays usage information.")
.Build();
CommandLineOption::Builder::Create().WithShortName("?").WithLongName("help").WithDescription("Displays usage information.").Build();
const CommandLineOption* const OPTION_VERBOSE =
CommandLineOption::Builder::Create()
.WithShortName("v")
.WithLongName("verbose")
.WithDescription("Outputs a lot more and more detailed messages.")
.Build();
CommandLineOption::Builder::Create().WithShortName("v").WithLongName("verbose").WithDescription("Outputs a lot more and more detailed messages.").Build();
const CommandLineOption* const OPTION_MINIMAL_ZONE_FILE =
CommandLineOption::Builder::Create()
.WithShortName("min")
.WithLongName("minimal-zone")
.WithDescription("Minimizes the size of the zone file output by only including assets that are not a dependency of another asset.")
.Build();
.WithShortName("min")
.WithLongName("minimal-zone")
.WithDescription("Minimizes the size of the zone file output by only including assets that are not a dependency of another asset.")
.Build();
const CommandLineOption* const OPTION_LOAD =
CommandLineOption::Builder::Create()
.WithShortName("l")
.WithLongName("load")
.WithDescription("Loads an existing zone before trying to unlink any zone.")
.WithParameter("zonePath")
.Reusable()
.Build();
const CommandLineOption* const OPTION_LOAD = CommandLineOption::Builder::Create()
.WithShortName("l")
.WithLongName("load")
.WithDescription("Loads an existing zone before trying to unlink any zone.")
.WithParameter("zonePath")
.Reusable()
.Build();
const CommandLineOption* const OPTION_LIST =
CommandLineOption::Builder::Create()
.WithLongName("list")
.WithDescription("Lists the contents of a zone instead of writing them to the disk.")
.Build();
CommandLineOption::Builder::Create().WithLongName("list").WithDescription("Lists the contents of a zone instead of writing them to the disk.").Build();
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 \"" + std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"")
.WithParameter("outputFolderPath")
.Build();
.WithShortName("o")
.WithLongName("output-folder")
.WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to \""
+ std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"")
.WithParameter("outputFolderPath")
.Build();
const CommandLineOption* const OPTION_SEARCH_PATH =
CommandLineOption::Builder::Create()
.WithLongName("search-path")
.WithDescription("Specifies a semi-colon separated list of paths to search for additional game files.")
.WithParameter("searchPathString")
.Build();
const CommandLineOption* const OPTION_SEARCH_PATH = CommandLineOption::Builder::Create()
.WithLongName("search-path")
.WithDescription("Specifies a semi-colon separated list of paths to search for additional game files.")
.WithParameter("searchPathString")
.Build();
const CommandLineOption* const OPTION_IMAGE_FORMAT =
CommandLineOption::Builder::Create()
.WithLongName("image-format")
.WithDescription("Specifies the format of dumped image files. Valid values are: DDS, IWI")
.WithParameter("imageFormatValue")
.Build();
const CommandLineOption* const OPTION_IMAGE_FORMAT = CommandLineOption::Builder::Create()
.WithLongName("image-format")
.WithDescription("Specifies the format of dumped image files. Valid values are: DDS, IWI")
.WithParameter("imageFormatValue")
.Build();
const CommandLineOption* const OPTION_MODEL_FORMAT =
CommandLineOption::Builder::Create()
.WithLongName("model-format")
.WithDescription("Specifies the format of dumped model files. Valid values are: XMODEL_EXPORT, OBJ")
.WithParameter("modelFormatValue")
.Build();
const CommandLineOption* const OPTION_MODEL_FORMAT = CommandLineOption::Builder::Create()
.WithLongName("model-format")
.WithDescription("Specifies the format of dumped model files. Valid values are: XMODEL_EXPORT, OBJ")
.WithParameter("modelFormatValue")
.Build();
const CommandLineOption* const OPTION_SKIP_OBJ =
CommandLineOption::Builder::Create()
.WithLongName("skip-obj")
.WithDescription("Skips loading raw obj data.")
.Build();
CommandLineOption::Builder::Create().WithLongName("skip-obj").WithDescription("Skips loading raw obj data.").Build();
const CommandLineOption* const OPTION_GDT =
CommandLineOption::Builder::Create()
.WithLongName("gdt")
.WithDescription("Dumps assets in a GDT whenever possible.")
.Build();
CommandLineOption::Builder::Create().WithLongName("gdt").WithDescription("Dumps assets in a GDT whenever possible.").Build();
const CommandLineOption* const OPTION_EXCLUDE_ASSETS =
CommandLineOption::Builder::Create()
.WithLongName("exclude-assets")
.WithDescription("Specify all asset types that should be excluded.")
.WithParameter("assetTypeList")
.Reusable()
.Build();
const CommandLineOption* const OPTION_EXCLUDE_ASSETS = CommandLineOption::Builder::Create()
.WithLongName("exclude-assets")
.WithDescription("Specify all asset types that should be excluded.")
.WithParameter("assetTypeList")
.Reusable()
.Build();
const CommandLineOption* const OPTION_INCLUDE_ASSETS =
CommandLineOption::Builder::Create()
.WithLongName("include-assets")
.WithDescription("Specify all asset types that should be included.")
.WithParameter("assetTypeList")
.Reusable()
.Build();
const CommandLineOption* const OPTION_INCLUDE_ASSETS = CommandLineOption::Builder::Create()
.WithLongName("include-assets")
.WithDescription("Specify all asset types that should be included.")
.WithParameter("assetTypeList")
.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();
.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,
OPTION_VERBOSE,
OPTION_MINIMAL_ZONE_FILE,
OPTION_LOAD,
OPTION_LIST,
OPTION_OUTPUT_FOLDER,
OPTION_SEARCH_PATH,
OPTION_IMAGE_FORMAT,
OPTION_MODEL_FORMAT,
OPTION_SKIP_OBJ,
OPTION_GDT,
OPTION_EXCLUDE_ASSETS,
OPTION_INCLUDE_ASSETS,
OPTION_LEGACY_MENUS
};
const CommandLineOption* const COMMAND_LINE_OPTIONS[]{OPTION_HELP,
OPTION_VERBOSE,
OPTION_MINIMAL_ZONE_FILE,
OPTION_LOAD,
OPTION_LIST,
OPTION_OUTPUT_FOLDER,
OPTION_SEARCH_PATH,
OPTION_IMAGE_FORMAT,
OPTION_MODEL_FORMAT,
OPTION_SKIP_OBJ,
OPTION_GDT,
OPTION_EXCLUDE_ASSETS,
OPTION_INCLUDE_ASSETS,
OPTION_LEGACY_MENUS};
UnlinkerArgs::UnlinkerArgs()
: m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>),
@ -258,7 +233,6 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv)
return false;
}
// -v; --verbose
SetVerbose(m_argument_parser.IsOptionSpecified(OPTION_VERBOSE));

View File

@ -1,13 +1,13 @@
#pragma once
#include <regex>
#include <set>
#include <vector>
#include <string>
#include <unordered_map>
#include "Utils/Arguments/ArgumentParser.h"
#include "Zone/Zone.h"
#include <regex>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
class UnlinkerArgs
{
public: