mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-02-10 17:43:03 +00:00
refactor: retrieve asset names from IGame
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "GameLanguage.h"
|
#include "GameLanguage.h"
|
||||||
|
#include "Zone/ZoneTypes.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <optional>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -64,5 +66,8 @@ public:
|
|||||||
[[nodiscard]] virtual const std::string& GetShortName() const = 0;
|
[[nodiscard]] virtual const std::string& GetShortName() const = 0;
|
||||||
[[nodiscard]] virtual const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const = 0;
|
[[nodiscard]] virtual const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const = 0;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual asset_type_t GetAssetTypeCount() const = 0;
|
||||||
|
[[nodiscard]] virtual std::optional<const char*> GetAssetTypeName(asset_type_t assetType) const = 0;
|
||||||
|
|
||||||
static IGame* GetGameById(GameId gameId);
|
static IGame* GetGameById(GameId gameId);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,23 @@
|
|||||||
#include "GameIW3.h"
|
#include "GameIW3.h"
|
||||||
|
|
||||||
|
#include "IW3.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace IW3;
|
using namespace IW3;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{
|
||||||
|
"xmodelpieces", "physpreset", "xanim", "xmodel", "material", "techniqueset", "image", "sound", "soundcurve", "loadedsound",
|
||||||
|
"clipmap_unused", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", "gfxworld", "lightdef", "uimap", "font",
|
||||||
|
"menulist", "menu", "localize", "weapon", "snddriverglobals", "fx", "impactfx", "aitype", "mptype", "character",
|
||||||
|
"xmodelalias", "rawfile", "stringtable",
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace IW3
|
||||||
|
{
|
||||||
GameId Game::GetId() const
|
GameId Game::GetId() const
|
||||||
{
|
{
|
||||||
return GameId::IW3;
|
return GameId::IW3;
|
||||||
@@ -26,3 +40,17 @@ const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
|||||||
static std::vector<GameLanguagePrefix> prefixes;
|
static std::vector<GameLanguagePrefix> prefixes;
|
||||||
return prefixes;
|
return prefixes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asset_type_t Game::GetAssetTypeCount() const
|
||||||
|
{
|
||||||
|
return ASSET_TYPE_COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<const char*> Game::GetAssetTypeName(const asset_type_t assetType) const
|
||||||
|
{
|
||||||
|
if (assetType < std::extent_v<decltype(ASSET_TYPE_NAMES)>)
|
||||||
|
return ASSET_TYPE_NAMES[assetType];
|
||||||
|
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
} // namespace IW3
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Game/IGame.h"
|
#include "Game/IGame.h"
|
||||||
|
|
||||||
namespace IW3
|
namespace IW3
|
||||||
@@ -10,5 +11,8 @@ namespace IW3
|
|||||||
[[nodiscard]] const std::string& GetFullName() const override;
|
[[nodiscard]] const std::string& GetFullName() const override;
|
||||||
[[nodiscard]] const std::string& GetShortName() const override;
|
[[nodiscard]] const std::string& GetShortName() const override;
|
||||||
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||||
|
|
||||||
|
[[nodiscard]] asset_type_t GetAssetTypeCount() const override;
|
||||||
|
[[nodiscard]] std::optional<const char*> GetAssetTypeName(asset_type_t assetType) const override;
|
||||||
};
|
};
|
||||||
} // namespace IW3
|
} // namespace IW3
|
||||||
|
|||||||
@@ -1,9 +1,28 @@
|
|||||||
#include "GameIW4.h"
|
#include "GameIW4.h"
|
||||||
|
|
||||||
|
#include "IW4.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace IW4;
|
using namespace IW4;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{
|
||||||
|
"physpreset", "physcollmap", "xanim", "xmodelsurfs", "xmodel",
|
||||||
|
"material", "pixelshader", "vertexshader", "vertexdecl", "techniqueset",
|
||||||
|
"image", "sound", "soundcurve", "loadedsound", "clipmap_unused",
|
||||||
|
"clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents",
|
||||||
|
"fxworld", "gfxworld", "lightdef", "uimap", "font",
|
||||||
|
"menulist", "menu", "localize", "weapon", "snddriverglobals",
|
||||||
|
"fx", "impactfx", "aitype", "mptype", "character",
|
||||||
|
"xmodelalias", "rawfile", "stringtable", "leaderboard", "structureddatadef",
|
||||||
|
"tracer", "vehicle", "addonmapents",
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace IW4
|
||||||
|
{
|
||||||
GameId Game::GetId() const
|
GameId Game::GetId() const
|
||||||
{
|
{
|
||||||
return GameId::IW4;
|
return GameId::IW4;
|
||||||
@@ -26,3 +45,17 @@ const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
|||||||
static std::vector<GameLanguagePrefix> prefixes;
|
static std::vector<GameLanguagePrefix> prefixes;
|
||||||
return prefixes;
|
return prefixes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asset_type_t Game::GetAssetTypeCount() const
|
||||||
|
{
|
||||||
|
return ASSET_TYPE_COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<const char*> Game::GetAssetTypeName(const asset_type_t assetType) const
|
||||||
|
{
|
||||||
|
if (assetType < std::extent_v<decltype(ASSET_TYPE_NAMES)>)
|
||||||
|
return ASSET_TYPE_NAMES[assetType];
|
||||||
|
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
} // namespace IW4
|
||||||
|
|||||||
@@ -10,5 +10,8 @@ namespace IW4
|
|||||||
[[nodiscard]] const std::string& GetFullName() const override;
|
[[nodiscard]] const std::string& GetFullName() const override;
|
||||||
[[nodiscard]] const std::string& GetShortName() const override;
|
[[nodiscard]] const std::string& GetShortName() const override;
|
||||||
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||||
|
|
||||||
|
[[nodiscard]] asset_type_t GetAssetTypeCount() const override;
|
||||||
|
[[nodiscard]] std::optional<const char*> GetAssetTypeName(asset_type_t assetType) const override;
|
||||||
};
|
};
|
||||||
} // namespace IW4
|
} // namespace IW4
|
||||||
|
|||||||
@@ -1,9 +1,65 @@
|
|||||||
#include "GameIW5.h"
|
#include "GameIW5.h"
|
||||||
|
|
||||||
|
#include "IW5.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace IW5;
|
using namespace IW5;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{
|
||||||
|
"physpreset",
|
||||||
|
"physcollmap",
|
||||||
|
"xanim",
|
||||||
|
"xmodelsurfs",
|
||||||
|
"xmodel",
|
||||||
|
"material",
|
||||||
|
"pixelshader",
|
||||||
|
"vertexshader",
|
||||||
|
"vertexdecl",
|
||||||
|
"techniqueset",
|
||||||
|
"image",
|
||||||
|
"sound",
|
||||||
|
"soundcurve",
|
||||||
|
"loadedsound",
|
||||||
|
"clipmap",
|
||||||
|
"comworld",
|
||||||
|
"glassworld",
|
||||||
|
"pathdata",
|
||||||
|
"vehicletrack",
|
||||||
|
"mapents",
|
||||||
|
"fxworld",
|
||||||
|
"gfxworld",
|
||||||
|
"lightdef",
|
||||||
|
"uimap",
|
||||||
|
"font",
|
||||||
|
"menulist",
|
||||||
|
"menu",
|
||||||
|
"localize",
|
||||||
|
"attachment",
|
||||||
|
"weapon",
|
||||||
|
"snddriverglobals",
|
||||||
|
"fx",
|
||||||
|
"impactfx",
|
||||||
|
"surfacefx",
|
||||||
|
"aitype",
|
||||||
|
"mptype",
|
||||||
|
"character",
|
||||||
|
"xmodelalias",
|
||||||
|
"rawfile",
|
||||||
|
"scriptfile",
|
||||||
|
"stringtable",
|
||||||
|
"leaderboard",
|
||||||
|
"structureddatadef",
|
||||||
|
"tracer",
|
||||||
|
"vehicle",
|
||||||
|
"addonmapents",
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace IW5
|
||||||
|
{
|
||||||
GameId Game::GetId() const
|
GameId Game::GetId() const
|
||||||
{
|
{
|
||||||
return GameId::IW5;
|
return GameId::IW5;
|
||||||
@@ -26,3 +82,17 @@ const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
|||||||
static std::vector<GameLanguagePrefix> prefixes;
|
static std::vector<GameLanguagePrefix> prefixes;
|
||||||
return prefixes;
|
return prefixes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asset_type_t Game::GetAssetTypeCount() const
|
||||||
|
{
|
||||||
|
return ASSET_TYPE_COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<const char*> Game::GetAssetTypeName(const asset_type_t assetType) const
|
||||||
|
{
|
||||||
|
if (assetType < std::extent_v<decltype(ASSET_TYPE_NAMES)>)
|
||||||
|
return ASSET_TYPE_NAMES[assetType];
|
||||||
|
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
} // namespace IW5
|
||||||
|
|||||||
@@ -10,5 +10,8 @@ namespace IW5
|
|||||||
[[nodiscard]] const std::string& GetFullName() const override;
|
[[nodiscard]] const std::string& GetFullName() const override;
|
||||||
[[nodiscard]] const std::string& GetShortName() const override;
|
[[nodiscard]] const std::string& GetShortName() const override;
|
||||||
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||||
|
|
||||||
|
[[nodiscard]] asset_type_t GetAssetTypeCount() const override;
|
||||||
|
[[nodiscard]] std::optional<const char*> GetAssetTypeName(asset_type_t assetType) const override;
|
||||||
};
|
};
|
||||||
} // namespace IW5
|
} // namespace IW5
|
||||||
|
|||||||
@@ -1,9 +1,26 @@
|
|||||||
#include "GameT5.h"
|
#include "GameT5.h"
|
||||||
|
|
||||||
|
#include "T5.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace T5;
|
using namespace T5;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{
|
||||||
|
"xmodelpieces", "physpreset", "physconstraints", "destructibledef", "xanim", "xmodel", "material",
|
||||||
|
"techniqueset", "image", "soundbank", "soundpatch", "clipmap_unused", "clipmap", "comworld",
|
||||||
|
"gameworldsp", "gameworldmp", "mapents", "gfxworld", "gfxlightdef", "uimap", "font",
|
||||||
|
"menulist", "menu", "localize", "weapon", "weapondef", "weaponvariant", "snddriverglobals",
|
||||||
|
"fx", "fximpacttable", "aitype", "mptype", "mpbody", "mphead", "character",
|
||||||
|
"xmodelalias", "rawfile", "stringtable", "packindex", "xglobals", "ddl", "glasses",
|
||||||
|
"emblemset",
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace T5
|
||||||
|
{
|
||||||
GameId Game::GetId() const
|
GameId Game::GetId() const
|
||||||
{
|
{
|
||||||
return GameId::T5;
|
return GameId::T5;
|
||||||
@@ -41,3 +58,17 @@ const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
|||||||
|
|
||||||
return prefixes;
|
return prefixes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asset_type_t Game::GetAssetTypeCount() const
|
||||||
|
{
|
||||||
|
return ASSET_TYPE_COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<const char*> Game::GetAssetTypeName(const asset_type_t assetType) const
|
||||||
|
{
|
||||||
|
if (assetType < std::extent_v<decltype(ASSET_TYPE_NAMES)>)
|
||||||
|
return ASSET_TYPE_NAMES[assetType];
|
||||||
|
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
} // namespace T5
|
||||||
|
|||||||
@@ -10,5 +10,8 @@ namespace T5
|
|||||||
[[nodiscard]] const std::string& GetFullName() const override;
|
[[nodiscard]] const std::string& GetFullName() const override;
|
||||||
[[nodiscard]] const std::string& GetShortName() const override;
|
[[nodiscard]] const std::string& GetShortName() const override;
|
||||||
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||||
|
|
||||||
|
[[nodiscard]] asset_type_t GetAssetTypeCount() const override;
|
||||||
|
[[nodiscard]] std::optional<const char*> GetAssetTypeName(asset_type_t assetType) const override;
|
||||||
};
|
};
|
||||||
} // namespace T5
|
} // namespace T5
|
||||||
|
|||||||
@@ -1,9 +1,79 @@
|
|||||||
#include "GameT6.h"
|
#include "GameT6.h"
|
||||||
|
|
||||||
|
#include "T6.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace T6;
|
using namespace T6;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{
|
||||||
|
"xmodelpieces",
|
||||||
|
"physpreset",
|
||||||
|
"physconstraints",
|
||||||
|
"destructibledef",
|
||||||
|
"xanim",
|
||||||
|
"xmodel",
|
||||||
|
"material",
|
||||||
|
"techniqueset",
|
||||||
|
"image",
|
||||||
|
"soundbank",
|
||||||
|
"soundpatch",
|
||||||
|
"clipmap_unused",
|
||||||
|
"clipmap",
|
||||||
|
"comworld",
|
||||||
|
"gameworldsp",
|
||||||
|
"gameworldmp",
|
||||||
|
"mapents",
|
||||||
|
"gfxworld",
|
||||||
|
"gfxlightdef",
|
||||||
|
"uimap",
|
||||||
|
"font",
|
||||||
|
"fonticon",
|
||||||
|
"menulist",
|
||||||
|
"menu",
|
||||||
|
"localize",
|
||||||
|
"weapon",
|
||||||
|
"weapondef",
|
||||||
|
"weaponvariant",
|
||||||
|
"weaponfull",
|
||||||
|
"attachment",
|
||||||
|
"attachmentunique",
|
||||||
|
"camo",
|
||||||
|
"snddriverglobals",
|
||||||
|
"fx",
|
||||||
|
"fximpacttable",
|
||||||
|
"aitype",
|
||||||
|
"mptype",
|
||||||
|
"mpbody",
|
||||||
|
"mphead",
|
||||||
|
"character",
|
||||||
|
"xmodelalias",
|
||||||
|
"rawfile",
|
||||||
|
"stringtable",
|
||||||
|
"leaderboard",
|
||||||
|
"xglobals",
|
||||||
|
"ddl",
|
||||||
|
"glasses",
|
||||||
|
"emblemset",
|
||||||
|
"script",
|
||||||
|
"keyvaluepairs",
|
||||||
|
"vehicle",
|
||||||
|
"memoryblock",
|
||||||
|
"addonmapents",
|
||||||
|
"tracer",
|
||||||
|
"skinnedverts",
|
||||||
|
"qdb",
|
||||||
|
"slug",
|
||||||
|
"footsteptable",
|
||||||
|
"footstepfxtable",
|
||||||
|
"zbarrier",
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace T6
|
||||||
|
{
|
||||||
GameId Game::GetId() const
|
GameId Game::GetId() const
|
||||||
{
|
{
|
||||||
return GameId::T6;
|
return GameId::T6;
|
||||||
@@ -44,3 +114,17 @@ const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
|||||||
|
|
||||||
return prefixes;
|
return prefixes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asset_type_t Game::GetAssetTypeCount() const
|
||||||
|
{
|
||||||
|
return ASSET_TYPE_COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<const char*> Game::GetAssetTypeName(const asset_type_t assetType) const
|
||||||
|
{
|
||||||
|
if (assetType < std::extent_v<decltype(ASSET_TYPE_NAMES)>)
|
||||||
|
return ASSET_TYPE_NAMES[assetType];
|
||||||
|
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
} // namespace T6
|
||||||
|
|||||||
@@ -10,5 +10,8 @@ namespace T6
|
|||||||
[[nodiscard]] const std::string& GetFullName() const override;
|
[[nodiscard]] const std::string& GetFullName() const override;
|
||||||
[[nodiscard]] const std::string& GetShortName() const override;
|
[[nodiscard]] const std::string& GetShortName() const override;
|
||||||
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||||
|
|
||||||
|
[[nodiscard]] asset_type_t GetAssetTypeCount() const override;
|
||||||
|
[[nodiscard]] std::optional<const char*> GetAssetTypeName(asset_type_t assetType) const override;
|
||||||
};
|
};
|
||||||
} // namespace T6
|
} // namespace T6
|
||||||
|
|||||||
Reference in New Issue
Block a user