2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-29 07:47:48 +00:00

refactor: use template based asset structs for AssetLoaders

This commit is contained in:
Jan
2024-05-25 11:17:04 +02:00
parent ef69bbb239
commit a166878f7d
110 changed files with 195 additions and 199 deletions

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderAddonMapEnts final : public BasicAssetLoader<ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts>
class AssetLoaderAddonMapEnts final : public BasicAssetLoader<AssetAddonMapEnts>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderClipMap : public BasicAssetLoader<ASSET_TYPE_CLIPMAP, clipMap_t>
class AssetLoaderClipMap : public BasicAssetLoader<AssetClipMap>
{
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderComWorld final : public BasicAssetLoader<ASSET_TYPE_COMWORLD, ComWorld>
class AssetLoaderComWorld final : public BasicAssetLoader<AssetComWorld>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderFont final : public BasicAssetLoader<ASSET_TYPE_FONT, Font_s>
class AssetLoaderFont final : public BasicAssetLoader<AssetFont>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderFx final : public BasicAssetLoader<ASSET_TYPE_FX, FxEffectDef>
class AssetLoaderFx final : public BasicAssetLoader<AssetFx>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderFxImpactTable final : public BasicAssetLoader<ASSET_TYPE_IMPACT_FX, FxImpactTable>
class AssetLoaderFxImpactTable final : public BasicAssetLoader<AssetImpactFx>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderFxWorld final : public BasicAssetLoader<ASSET_TYPE_FXWORLD, FxWorld>
class AssetLoaderFxWorld final : public BasicAssetLoader<AssetFxWorld>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderGfxImage final : public BasicAssetLoader<ASSET_TYPE_IMAGE, GfxImage>
class AssetLoaderGfxImage final : public BasicAssetLoader<AssetImage>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderGfxLightDef final : public BasicAssetLoader<ASSET_TYPE_LIGHT_DEF, GfxLightDef>
class AssetLoaderGfxLightDef final : public BasicAssetLoader<AssetLightDef>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderGfxWorld final : public BasicAssetLoader<ASSET_TYPE_GFXWORLD, GfxWorld>
class AssetLoaderGfxWorld final : public BasicAssetLoader<AssetGfxWorld>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderGlassWorld final : public BasicAssetLoader<ASSET_TYPE_GLASSWORLD, GlassWorld>
class AssetLoaderGlassWorld final : public BasicAssetLoader<AssetGlassWorld>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderLeaderboard final : public BasicAssetLoader<ASSET_TYPE_LEADERBOARD, LeaderboardDef>
class AssetLoaderLeaderboard final : public BasicAssetLoader<AssetLeaderBoard>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderLoadedSound final : public BasicAssetLoader<ASSET_TYPE_LOADED_SOUND, LoadedSound>
class AssetLoaderLoadedSound final : public BasicAssetLoader<AssetLoadedSound>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -7,7 +7,7 @@
namespace IW5
{
class AssetLoaderLocalizeEntry final : public BasicAssetLoader<ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry>
class AssetLoaderLocalizeEntry final : public BasicAssetLoader<AssetLocalize>
{
public:
_NODISCARD XAssetInfoGeneric* LoadFromGlobalAssetPools(const std::string& assetName) const override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderMapEnts final : public BasicAssetLoader<ASSET_TYPE_MAP_ENTS, MapEnts>
class AssetLoaderMapEnts final : public BasicAssetLoader<AssetMapEnts>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderMaterial final : public BasicAssetLoader<ASSET_TYPE_MATERIAL, Material>
class AssetLoaderMaterial final : public BasicAssetLoader<AssetMaterial>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderMenuDef final : public BasicAssetLoader<ASSET_TYPE_MENU, menuDef_t>
class AssetLoaderMenuDef final : public BasicAssetLoader<AssetMenu>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -7,7 +7,7 @@
namespace IW5
{
class AssetLoaderMenuList final : public BasicAssetLoader<ASSET_TYPE_MENULIST, MenuList>
class AssetLoaderMenuList final : public BasicAssetLoader<AssetMenuList>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderPathData final : public BasicAssetLoader<ASSET_TYPE_PATHDATA, PathData>
class AssetLoaderPathData final : public BasicAssetLoader<AssetPathData>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderPhysCollmap final : public BasicAssetLoader<ASSET_TYPE_PHYSCOLLMAP, PhysCollmap>
class AssetLoaderPhysCollmap final : public BasicAssetLoader<AssetPhysCollMap>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderPhysPreset final : public BasicAssetLoader<ASSET_TYPE_PHYSPRESET, PhysPreset>
class AssetLoaderPhysPreset final : public BasicAssetLoader<AssetPhysPreset>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderPixelShader final : public BasicAssetLoader<ASSET_TYPE_PIXELSHADER, MaterialPixelShader>
class AssetLoaderPixelShader final : public BasicAssetLoader<AssetPixelShader>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderRawFile final : public BasicAssetLoader<ASSET_TYPE_RAWFILE, RawFile>
class AssetLoaderRawFile final : public BasicAssetLoader<AssetRawFile>
{
static constexpr size_t COMPRESSED_BUFFER_SIZE_PADDING = 64;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderScriptFile final : public BasicAssetLoader<ASSET_TYPE_SCRIPTFILE, ScriptFile>
class AssetLoaderScriptFile final : public BasicAssetLoader<AssetScript>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderSoundAliasList final : public BasicAssetLoader<ASSET_TYPE_SOUND, snd_alias_list_t>
class AssetLoaderSoundAliasList final : public BasicAssetLoader<AssetSound>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderSoundCurve final : public BasicAssetLoader<ASSET_TYPE_SOUND_CURVE, SndCurve>
class AssetLoaderSoundCurve final : public BasicAssetLoader<AssetSoundCurve>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderStringTable final : public BasicAssetLoader<ASSET_TYPE_STRINGTABLE, StringTable>
class AssetLoaderStringTable final : public BasicAssetLoader<AssetStringTable>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderStructuredDataDef final : public BasicAssetLoader<ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet>
class AssetLoaderStructuredDataDef final : public BasicAssetLoader<AssetStructuredDataDef>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderSurfaceFxTable final : public BasicAssetLoader<ASSET_TYPE_SURFACE_FX, SurfaceFxTable>
class AssetLoaderSurfaceFxTable final : public BasicAssetLoader<AssetSurfaceFx>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderTechniqueSet final : public BasicAssetLoader<ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet>
class AssetLoaderTechniqueSet final : public BasicAssetLoader<AssetTechniqueSet>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderTracerDef final : public BasicAssetLoader<ASSET_TYPE_TRACER, TracerDef>
class AssetLoaderTracerDef final : public BasicAssetLoader<AssetTracer>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderVehicleDef final : public BasicAssetLoader<ASSET_TYPE_VEHICLE, VehicleDef>
class AssetLoaderVehicleDef final : public BasicAssetLoader<AssetVehicle>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderVehicleTrack final : public BasicAssetLoader<ASSET_TYPE_VEHICLE_TRACK, VehicleTrack>
class AssetLoaderVehicleTrack final : public BasicAssetLoader<AssetVehicleTrack>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderVertexDecl final : public BasicAssetLoader<ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration>
class AssetLoaderVertexDecl final : public BasicAssetLoader<AssetVertexDecl>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderVertexShader final : public BasicAssetLoader<ASSET_TYPE_VERTEXSHADER, MaterialVertexShader>
class AssetLoaderVertexShader final : public BasicAssetLoader<AssetVertexShader>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderWeapon final : public BasicAssetLoader<ASSET_TYPE_WEAPON, WeaponCompleteDef>
class AssetLoaderWeapon final : public BasicAssetLoader<AssetWeapon>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderWeaponAttachment final : public BasicAssetLoader<ASSET_TYPE_ATTACHMENT, WeaponAttachment>
class AssetLoaderWeaponAttachment final : public BasicAssetLoader<AssetAttachment>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderXAnim final : public BasicAssetLoader<ASSET_TYPE_XANIMPARTS, XAnimParts>
class AssetLoaderXAnim final : public BasicAssetLoader<AssetXAnim>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderXModel final : public BasicAssetLoader<ASSET_TYPE_XMODEL, XModel>
class AssetLoaderXModel final : public BasicAssetLoader<AssetXModel>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -6,7 +6,7 @@
namespace IW5
{
class AssetLoaderXModelSurfs final : public BasicAssetLoader<ASSET_TYPE_XMODEL_SURFS, XModelSurfs>
class AssetLoaderXModelSurfs final : public BasicAssetLoader<AssetXModelSurfs>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;

View File

@@ -59,7 +59,6 @@ ObjLoader::ObjLoader()
auto l = std::make_unique<t>(); \
m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l); \
}
#define BASIC_LOADER(assetType, assetClass) BasicAssetLoader<assetType, assetClass>
REGISTER_ASSET_LOADER(AssetLoaderPhysPreset)
REGISTER_ASSET_LOADER(AssetLoaderPhysCollmap)
@@ -102,7 +101,6 @@ ObjLoader::ObjLoader()
REGISTER_ASSET_LOADER(AssetLoaderVehicleDef)
REGISTER_ASSET_LOADER(AssetLoaderAddonMapEnts)
#undef BASIC_LOADER
#undef REGISTER_ASSET_LOADER
}