mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 23:38:09 -05:00
add structureddatadef loading code for iw4
This commit is contained in:
@ -135,7 +135,7 @@ GameAssetPoolIW4::GameAssetPoolIW4(const int priority)
|
||||
m_raw_file = nullptr;
|
||||
m_string_table = nullptr;
|
||||
m_leaderboard = nullptr;
|
||||
// m_structed_data_def_set = nullptr;
|
||||
m_structed_data_def_set = nullptr;
|
||||
m_tracer = nullptr;
|
||||
// m_vehicle = nullptr;
|
||||
// m_addon_map_ents = nullptr;
|
||||
@ -188,7 +188,7 @@ void GameAssetPoolIW4::InitPoolStatic(const asset_type_t type, const size_t capa
|
||||
CASE_INIT_POOL_STATIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile);
|
||||
CASE_INIT_POOL_STATIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable);
|
||||
CASE_INIT_POOL_STATIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef);
|
||||
// CASE_INIT_POOL_STATIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet);
|
||||
CASE_INIT_POOL_STATIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet);
|
||||
CASE_INIT_POOL_STATIC(ASSET_TYPE_TRACER, m_tracer, TracerDef);
|
||||
// CASE_INIT_POOL_STATIC(ASSET_TYPE_VEHICLE, m_vehicle, VehicleDef);
|
||||
// CASE_INIT_POOL_STATIC(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, AddonMapEnts);
|
||||
@ -248,7 +248,7 @@ void GameAssetPoolIW4::InitPoolDynamic(const asset_type_t type)
|
||||
CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile);
|
||||
CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable);
|
||||
CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef);
|
||||
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet);
|
||||
CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet);
|
||||
CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TRACER, m_tracer, TracerDef);
|
||||
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VEHICLE, m_vehicle, VehicleDef);
|
||||
// CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, AddonMapEnts);
|
||||
@ -317,7 +317,7 @@ XAssetInfoGeneric* GameAssetPoolIW4::AddAsset(asset_type_t type, std::string nam
|
||||
CASE_ADD_TO_POOL(ASSET_TYPE_RAWFILE, m_raw_file, rawfile);
|
||||
CASE_ADD_TO_POOL(ASSET_TYPE_STRINGTABLE, m_string_table, stringTable);
|
||||
CASE_ADD_TO_POOL(ASSET_TYPE_LEADERBOARD, m_leaderboard, leaderboardDef);
|
||||
// CASE_ADD_TO_POOL(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, structuredDataDefSet);
|
||||
CASE_ADD_TO_POOL(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, structuredDataDefSet);
|
||||
CASE_ADD_TO_POOL(ASSET_TYPE_TRACER, m_tracer, tracerDef);
|
||||
// CASE_ADD_TO_POOL(ASSET_TYPE_VEHICLE, m_vehicle, vehDef);
|
||||
// CASE_ADD_TO_POOL(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, addonMapEnts);
|
||||
@ -377,7 +377,7 @@ XAssetInfoGeneric* GameAssetPoolIW4::GetAsset(const asset_type_t type, std::stri
|
||||
CASE_GET_ASSET(ASSET_TYPE_RAWFILE, m_raw_file);
|
||||
CASE_GET_ASSET(ASSET_TYPE_STRINGTABLE, m_string_table);
|
||||
CASE_GET_ASSET(ASSET_TYPE_LEADERBOARD, m_leaderboard);
|
||||
// CASE_GET_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set);
|
||||
CASE_GET_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set);
|
||||
CASE_GET_ASSET(ASSET_TYPE_TRACER, m_tracer);
|
||||
// CASE_GET_ASSET(ASSET_TYPE_VEHICLE, m_vehicle);
|
||||
// CASE_GET_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents);
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
std::unique_ptr<AssetPool<IW4::RawFile>> m_raw_file;
|
||||
std::unique_ptr<AssetPool<IW4::StringTable>> m_string_table;
|
||||
std::unique_ptr<AssetPool<IW4::LeaderboardDef>> m_leaderboard;
|
||||
// std::unique_ptr<AssetPool<IW4::StructuredDataDefSet>> m_structed_data_def_set;
|
||||
std::unique_ptr<AssetPool<IW4::StructuredDataDefSet>> m_structed_data_def_set;
|
||||
std::unique_ptr<AssetPool<IW4::TracerDef>> m_tracer;
|
||||
// std::unique_ptr<AssetPool<IW4::VehicleDef>> m_vehicle;
|
||||
// std::unique_ptr<AssetPool<IW4::AddonMapEnts>> m_addon_map_ents;
|
||||
|
@ -106,7 +106,7 @@ namespace IW4
|
||||
struct RawFile;
|
||||
struct StringTable;
|
||||
struct LeaderboardDef;
|
||||
// struct StructuredDataDefSet;
|
||||
struct StructuredDataDefSet;
|
||||
struct TracerDef;
|
||||
// struct VehicleDef;
|
||||
// struct AddonMapEnts;
|
||||
@ -146,7 +146,7 @@ namespace IW4
|
||||
RawFile* rawfile;
|
||||
StringTable* stringTable;
|
||||
LeaderboardDef* leaderboardDef;
|
||||
// StructuredDataDefSet* structuredDataDefSet;
|
||||
StructuredDataDefSet* structuredDataDefSet;
|
||||
TracerDef* tracerDef;
|
||||
// VehicleDef* vehDef;
|
||||
// AddonMapEnts* addonMapEnts;
|
||||
@ -1693,6 +1693,101 @@ namespace IW4
|
||||
float colors[5][4];
|
||||
};
|
||||
|
||||
enum StructuredDataTypeCategory
|
||||
{
|
||||
DATA_INT = 0x0,
|
||||
DATA_BYTE = 0x1,
|
||||
DATA_BOOL = 0x2,
|
||||
DATA_STRING = 0x3,
|
||||
DATA_ENUM = 0x4,
|
||||
DATA_STRUCT = 0x5,
|
||||
DATA_INDEXED_ARRAY = 0x6,
|
||||
DATA_ENUM_ARRAY = 0x7,
|
||||
DATA_FLOAT = 0x8,
|
||||
DATA_SHORT = 0x9,
|
||||
DATA_COUNT = 0xA,
|
||||
};
|
||||
|
||||
struct __declspec(align(4)) StructuredDataEnumEntry
|
||||
{
|
||||
const char* string;
|
||||
unsigned __int16 index;
|
||||
};
|
||||
|
||||
struct StructuredDataEnum
|
||||
{
|
||||
int entryCount;
|
||||
int reservedEntryCount;
|
||||
StructuredDataEnumEntry* entries;
|
||||
};
|
||||
|
||||
union StructuredDataTypeUnion
|
||||
{
|
||||
unsigned int stringDataLength;
|
||||
int enumIndex;
|
||||
int structIndex;
|
||||
int indexedArrayIndex;
|
||||
int enumedArrayIndex;
|
||||
};
|
||||
|
||||
struct StructuredDataType
|
||||
{
|
||||
StructuredDataTypeCategory type;
|
||||
StructuredDataTypeUnion u;
|
||||
};
|
||||
|
||||
struct StructuredDataStructProperty
|
||||
{
|
||||
const char* name;
|
||||
StructuredDataType type;
|
||||
unsigned int offset;
|
||||
};
|
||||
|
||||
struct StructuredDataStruct
|
||||
{
|
||||
int propertyCount;
|
||||
StructuredDataStructProperty* properties;
|
||||
int size;
|
||||
unsigned int bitOffset;
|
||||
};
|
||||
|
||||
struct StructuredDataIndexedArray
|
||||
{
|
||||
int arraySize;
|
||||
StructuredDataType elementType;
|
||||
unsigned int elementSize;
|
||||
};
|
||||
|
||||
struct StructuredDataEnumedArray
|
||||
{
|
||||
int enumIndex;
|
||||
StructuredDataType elementType;
|
||||
unsigned int elementSize;
|
||||
};
|
||||
|
||||
struct StructuredDataDef
|
||||
{
|
||||
int version;
|
||||
unsigned int formatChecksum;
|
||||
int enumCount;
|
||||
StructuredDataEnum* enums;
|
||||
int structCount;
|
||||
StructuredDataStruct* structs;
|
||||
int indexedArrayCount;
|
||||
StructuredDataIndexedArray* indexedArrays;
|
||||
int enumedArrayCount;
|
||||
StructuredDataEnumedArray* enumedArrays;
|
||||
StructuredDataType rootType;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
struct StructuredDataDefSet
|
||||
{
|
||||
const char* name;
|
||||
unsigned int defCount;
|
||||
StructuredDataDef* defs;
|
||||
};
|
||||
|
||||
#ifndef __zonecodegenerator
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user