Unlinker: Make parsing specified command line arguments its own class

This commit is contained in:
Jan
2020-02-14 23:40:47 +01:00
parent f3779bac03
commit 23f77bb335
14 changed files with 373 additions and 262 deletions

View File

@ -8,7 +8,7 @@ class IZoneDumper
public:
virtual ~IZoneDumper() = default;
virtual bool CanHandleZone(Zone* zone) = 0;
virtual bool DumpZone(Zone* zone, const std::string& basePath) = 0;
virtual bool WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic) = 0;
virtual bool CanHandleZone(Zone* zone) const = 0;
virtual bool DumpZone(Zone* zone, const std::string& basePath) const = 0;
virtual bool WriteZoneDefinition(Zone* zone, FileAPI::File* file) const = 0;
};

View File

@ -10,12 +10,12 @@
#include "AssetDumpers/AssetDumperLocalizeEntry.h"
#include "AssetDumpers/AssetDumperGfxImage.h"
bool ZoneDumperT6::CanHandleZone(Zone* zone)
bool ZoneDumperT6::CanHandleZone(Zone* zone) const
{
return zone->m_game == &g_GameT6;
}
bool ZoneDumperT6::DumpZone(Zone* zone, const std::string& basePath)
bool ZoneDumperT6::DumpZone(Zone* zone, const std::string& basePath) const
{
#define DUMP_ASSET_POOL(dumperType, poolName) \
if(assetPools->poolName) \
@ -80,7 +80,7 @@ bool ZoneDumperT6::DumpZone(Zone* zone, const std::string& basePath)
#undef DUMP_ASSET_POOL
}
bool ZoneDumperT6::WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic)
bool ZoneDumperT6::WriteZoneDefinition(Zone* zone, FileAPI::File* file) const
{
return true;
}

View File

@ -4,7 +4,7 @@
class ZoneDumperT6 final : public IZoneDumper
{
public:
bool CanHandleZone(Zone* zone) override;
bool DumpZone(Zone* zone, const std::string& basePath) override;
bool WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic) override;
bool CanHandleZone(Zone* zone) const override;
bool DumpZone(Zone* zone, const std::string& basePath) const override;
bool WriteZoneDefinition(Zone* zone, FileAPI::File* file) const override;
};

View File

@ -2,14 +2,16 @@
#include "Dumping/IZoneDumper.h"
#include "Game/T6/ZoneDumperT6.h"
IZoneDumper* zoneDumper[]
ObjWriting::Configuration_t ObjWriting::Configuration;
const IZoneDumper* const ZONE_DUMPER[]
{
new ZoneDumperT6()
};
bool ObjWriting::DumpZone(Zone* zone, const std::string& basePath)
{
for (auto dumper : zoneDumper)
for (auto dumper : ZONE_DUMPER)
{
if (dumper->CanHandleZone(zone))
{
@ -26,7 +28,7 @@ bool ObjWriting::DumpZone(Zone* zone, const std::string& basePath)
return false;
}
bool ObjWriting::WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic)
bool ObjWriting::WriteZoneDefinition(Zone* zone, FileAPI::File* file)
{
return file->Printf("// %s", "Insert zone definition here") > 0;
}

View File

@ -7,6 +7,21 @@
class ObjWriting
{
public:
static class Configuration_t
{
public:
enum class ImageOutputFormat_e
{
DDS,
IWI
};
bool Verbose = false;
ImageOutputFormat_e ImageOutputFormat = ImageOutputFormat_e::DDS;
bool MinimalZoneFileOutput = false;
} Configuration;
static bool DumpZone(Zone* zone, const std::string& basePath);
static bool WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic);
static bool WriteZoneDefinition(Zone* zone, FileAPI::File* file);
};