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
|
||||
|
||||
#include "GameLanguage.h"
|
||||
#include "Zone/ZoneTypes.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
@@ -64,5 +66,8 @@ public:
|
||||
[[nodiscard]] virtual const std::string& GetShortName() 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);
|
||||
};
|
||||
|
||||
@@ -1,28 +1,56 @@
|
||||
#include "GameIW3.h"
|
||||
|
||||
#include "IW3.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
GameId Game::GetId() const
|
||||
namespace
|
||||
{
|
||||
return GameId::IW3;
|
||||
}
|
||||
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
|
||||
|
||||
const std::string& Game::GetFullName() const
|
||||
namespace IW3
|
||||
{
|
||||
GameId Game::GetId() const
|
||||
{
|
||||
return GameId::IW3;
|
||||
}
|
||||
|
||||
const std::string& Game::GetFullName() const
|
||||
{
|
||||
static std::string fullName = "Call Of Duty 4: Modern Warfare";
|
||||
return fullName;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& Game::GetShortName() const
|
||||
{
|
||||
const std::string& Game::GetShortName() const
|
||||
{
|
||||
static std::string shortName = "IW3";
|
||||
return shortName;
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
static std::vector<GameLanguagePrefix> 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
|
||||
|
||||
#include "Game/IGame.h"
|
||||
|
||||
namespace IW3
|
||||
@@ -10,5 +11,8 @@ namespace IW3
|
||||
[[nodiscard]] const std::string& GetFullName() const override;
|
||||
[[nodiscard]] const std::string& GetShortName() 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
|
||||
|
||||
@@ -1,28 +1,61 @@
|
||||
#include "GameIW4.h"
|
||||
|
||||
#include "IW4.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
GameId Game::GetId() const
|
||||
namespace
|
||||
{
|
||||
return GameId::IW4;
|
||||
}
|
||||
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
|
||||
|
||||
const std::string& Game::GetFullName() const
|
||||
namespace IW4
|
||||
{
|
||||
GameId Game::GetId() const
|
||||
{
|
||||
return GameId::IW4;
|
||||
}
|
||||
|
||||
const std::string& Game::GetFullName() const
|
||||
{
|
||||
static std::string fullName = "Call Of Duty: Modern Warfare 2";
|
||||
return fullName;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& Game::GetShortName() const
|
||||
{
|
||||
const std::string& Game::GetShortName() const
|
||||
{
|
||||
static std::string shortName = "IW4";
|
||||
return shortName;
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
static std::vector<GameLanguagePrefix> 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& GetShortName() 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
|
||||
|
||||
@@ -1,28 +1,98 @@
|
||||
#include "GameIW5.h"
|
||||
|
||||
#include "IW5.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
GameId Game::GetId() const
|
||||
namespace
|
||||
{
|
||||
return GameId::IW5;
|
||||
}
|
||||
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
|
||||
|
||||
const std::string& Game::GetFullName() const
|
||||
namespace IW5
|
||||
{
|
||||
GameId Game::GetId() const
|
||||
{
|
||||
return GameId::IW5;
|
||||
}
|
||||
|
||||
const std::string& Game::GetFullName() const
|
||||
{
|
||||
static std::string fullName = "Call Of Duty: Modern Warfare 3";
|
||||
return fullName;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& Game::GetShortName() const
|
||||
{
|
||||
const std::string& Game::GetShortName() const
|
||||
{
|
||||
static std::string shortName = "IW5";
|
||||
return shortName;
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
static std::vector<GameLanguagePrefix> 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& GetShortName() 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
|
||||
|
||||
@@ -1,28 +1,45 @@
|
||||
#include "GameT5.h"
|
||||
|
||||
#include "T5.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace T5;
|
||||
|
||||
GameId Game::GetId() const
|
||||
namespace
|
||||
{
|
||||
return GameId::T5;
|
||||
}
|
||||
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
|
||||
|
||||
const std::string& Game::GetFullName() const
|
||||
namespace T5
|
||||
{
|
||||
GameId Game::GetId() const
|
||||
{
|
||||
return GameId::T5;
|
||||
}
|
||||
|
||||
const std::string& Game::GetFullName() const
|
||||
{
|
||||
static std::string fullName = "Call Of Duty: Black Ops";
|
||||
return fullName;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& Game::GetShortName() const
|
||||
{
|
||||
const std::string& Game::GetShortName() const
|
||||
{
|
||||
static std::string shortName = "T5";
|
||||
return shortName;
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
static std::vector<GameLanguagePrefix> prefixes{
|
||||
{GameLanguage::LANGUAGE_ENGLISH, "en_"},
|
||||
{GameLanguage::LANGUAGE_FRENCH, "fr_"},
|
||||
@@ -40,4 +57,18 @@ const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
};
|
||||
|
||||
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& GetShortName() 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
|
||||
|
||||
@@ -1,28 +1,98 @@
|
||||
#include "GameT6.h"
|
||||
|
||||
#include "T6.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace T6;
|
||||
|
||||
GameId Game::GetId() const
|
||||
namespace
|
||||
{
|
||||
return GameId::T6;
|
||||
}
|
||||
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
|
||||
|
||||
const std::string& Game::GetFullName() const
|
||||
namespace T6
|
||||
{
|
||||
GameId Game::GetId() const
|
||||
{
|
||||
return GameId::T6;
|
||||
}
|
||||
|
||||
const std::string& Game::GetFullName() const
|
||||
{
|
||||
static std::string fullName = "Call Of Duty: Black Ops II";
|
||||
return fullName;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& Game::GetShortName() const
|
||||
{
|
||||
const std::string& Game::GetShortName() const
|
||||
{
|
||||
static std::string shortName = "T6";
|
||||
return shortName;
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
static std::vector<GameLanguagePrefix> prefixes{
|
||||
{GameLanguage::LANGUAGE_ENGLISH, "en_"},
|
||||
{GameLanguage::LANGUAGE_FRENCH, "fr_"},
|
||||
@@ -43,4 +113,18 @@ const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
};
|
||||
|
||||
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& GetShortName() 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
|
||||
|
||||
Reference in New Issue
Block a user