Correct structureddata structs ;)
This commit is contained in:
parent
0a54d940bb
commit
43e756f5c0
@ -5,7 +5,7 @@ namespace Components
|
||||
StructuredData* StructuredData::Singleton = nullptr;
|
||||
|
||||
int StructuredData::IndexCount[StructuredData::ENUM_MAX];
|
||||
Game::structuredDataEnumIndex_t* StructuredData::Indices[StructuredData::ENUM_MAX];
|
||||
Game::StructuredDataEnumEntry* StructuredData::Indices[StructuredData::ENUM_MAX];
|
||||
std::vector<StructuredData::EnumEntry> StructuredData::Entries[StructuredData::ENUM_MAX];
|
||||
|
||||
void StructuredData::AddPlayerDataEntry(StructuredData::PlayerDataType type, int index, std::string name)
|
||||
@ -24,11 +24,11 @@ namespace Components
|
||||
StructuredData::Entries[type].push_back({ name, index });
|
||||
}
|
||||
|
||||
void StructuredData::PatchPlayerDataEnum(Game::structuredDataDef_t* data, StructuredData::PlayerDataType type, std::vector<StructuredData::EnumEntry>& entries)
|
||||
void StructuredData::PatchPlayerDataEnum(Game::StructuredDataDefSet* data, StructuredData::PlayerDataType type, std::vector<StructuredData::EnumEntry>& entries)
|
||||
{
|
||||
if (!data || !data->data || type >= StructuredData::ENUM_MAX) return;
|
||||
|
||||
Game::structuredDataEnum_t* dataEnum = &data->data->enums[type];
|
||||
Game::StructuredDataEnum* dataEnum = &data->data->enums[type];
|
||||
|
||||
if (StructuredData::IndexCount[type])
|
||||
{
|
||||
@ -53,8 +53,8 @@ namespace Components
|
||||
StructuredData::IndexCount[type] = dataEnum->numIndices + entries.size();
|
||||
|
||||
// Allocate new entries
|
||||
StructuredData::Indices[type] = StructuredData::GetSingleton()->MemAllocator.AllocateArray<Game::structuredDataEnumIndex_t>(StructuredData::IndexCount[type]);
|
||||
memcpy(StructuredData::Indices[type], dataEnum->indices, sizeof(Game::structuredDataEnumIndex_t) * dataEnum->numIndices);
|
||||
StructuredData::Indices[type] = StructuredData::GetSingleton()->MemAllocator.AllocateArray<Game::StructuredDataEnumEntry>(StructuredData::IndexCount[type]);
|
||||
memcpy(StructuredData::Indices[type], dataEnum->indices, sizeof(Game::StructuredDataEnumEntry) * dataEnum->numIndices);
|
||||
|
||||
for (unsigned int i = 0; i < entries.size(); i++)
|
||||
{
|
||||
@ -76,7 +76,7 @@ namespace Components
|
||||
|
||||
for (unsigned int j = dataEnum->numIndices + i; j > pos && j < static_cast<unsigned int>(StructuredData::IndexCount[type]); j--)
|
||||
{
|
||||
memcpy(&StructuredData::Indices[type][j], &StructuredData::Indices[type][j - 1], sizeof(Game::structuredDataEnumIndex_t));
|
||||
memcpy(&StructuredData::Indices[type][j], &StructuredData::Indices[type][j - 1], sizeof(Game::StructuredDataEnumEntry));
|
||||
}
|
||||
|
||||
StructuredData::Indices[type][pos].index = entries[i].statOffset + lastIndex;
|
||||
@ -88,7 +88,7 @@ namespace Components
|
||||
dataEnum->indices = StructuredData::Indices[type];
|
||||
}
|
||||
|
||||
void StructuredData::DumpDataDef(Game::structuredDataDef_t* dataDef)
|
||||
void StructuredData::DumpDataDef(Game::StructuredDataDefSet* dataDef)
|
||||
{
|
||||
if (!dataDef || !dataDef->data) return;
|
||||
|
||||
@ -123,7 +123,7 @@ namespace Components
|
||||
|
||||
if (filename == "mp/playerdata.def")
|
||||
{
|
||||
Game::structuredDataDef_t* data = AssetHandler::FindOriginalAsset(Game::XAssetType::ASSET_TYPE_STRUCTUREDDATADEF, filename.data()).structuredData;
|
||||
Game::StructuredDataDefSet* data = AssetHandler::FindOriginalAsset(Game::XAssetType::ASSET_TYPE_STRUCTUREDDATADEF, filename.data()).structuredData;
|
||||
header.structuredData = data;
|
||||
|
||||
if (data)
|
||||
|
@ -34,14 +34,14 @@ namespace Components
|
||||
int statOffset;
|
||||
};
|
||||
|
||||
static void DumpDataDef(Game::structuredDataDef_t* dataDef);
|
||||
static void PatchPlayerDataEnum(Game::structuredDataDef_t* data, PlayerDataType type, std::vector<EnumEntry>& entries);
|
||||
static void DumpDataDef(Game::StructuredDataDefSet* dataDef);
|
||||
static void PatchPlayerDataEnum(Game::StructuredDataDefSet* data, PlayerDataType type, std::vector<EnumEntry>& entries);
|
||||
static StructuredData* GetSingleton();
|
||||
|
||||
Utils::Memory::Allocator MemAllocator;
|
||||
|
||||
static int IndexCount[ENUM_MAX];
|
||||
static Game::structuredDataEnumIndex_t* Indices[ENUM_MAX];
|
||||
static Game::StructuredDataEnumEntry* Indices[ENUM_MAX];
|
||||
static std::vector<EnumEntry> Entries[ENUM_MAX];
|
||||
|
||||
static StructuredData* Singleton;
|
||||
|
@ -1157,83 +1157,83 @@ namespace Game
|
||||
STRUCTURED_DATA_ENUMARR = 7,
|
||||
STRUCTURED_DATA_FLOAT = 8,
|
||||
STRUCTURED_DATA_SHORT = 9
|
||||
} structuredDataType_t;
|
||||
} StructuredDataType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
structuredDataType_t type;
|
||||
StructuredDataType type;
|
||||
union
|
||||
{
|
||||
int index;
|
||||
};
|
||||
int offset;
|
||||
} structuredDataItem_t;
|
||||
} StructuredDataItem;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
structuredDataItem_t item;
|
||||
} structuredDataChild_t;
|
||||
StructuredDataItem item;
|
||||
} StructuredDataStructProperty;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numChildren;
|
||||
structuredDataChild_t* children;
|
||||
int numProperties;
|
||||
StructuredDataStructProperty* property;
|
||||
int unknown1;
|
||||
int unknown2;
|
||||
} structuredDataStruct_t;
|
||||
} StructuredDataStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int enumIndex;
|
||||
structuredDataItem_t item;
|
||||
} structuredDataEnumArray_t;
|
||||
StructuredDataItem item;
|
||||
} StructuredDataEnumedArray;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* key;
|
||||
int index;
|
||||
} structuredDataEnumIndex_t;
|
||||
} StructuredDataEnumEntry;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numIndices;
|
||||
int unknown;
|
||||
structuredDataEnumIndex_t* indices;
|
||||
} structuredDataEnum_t;
|
||||
StructuredDataEnumEntry* indices;
|
||||
} StructuredDataEnum;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numItems;
|
||||
structuredDataItem_t item;
|
||||
} structuredDataIndexedArray_t;
|
||||
StructuredDataItem item;
|
||||
} StructuredDataIndexedArray;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version;
|
||||
unsigned int hash;
|
||||
int numEnums;
|
||||
structuredDataEnum_t* enums;
|
||||
StructuredDataEnum* enums;
|
||||
int numStructs;
|
||||
structuredDataStruct_t* structs;
|
||||
StructuredDataStruct* structs;
|
||||
int numIndexedArrays;
|
||||
structuredDataIndexedArray_t* indexedArrays;
|
||||
StructuredDataIndexedArray* indexedArrays;
|
||||
int numEnumArrays;
|
||||
structuredDataEnumArray_t* enumArrays;
|
||||
structuredDataItem_t rootItem;
|
||||
} structuredData_t;
|
||||
StructuredDataEnumedArray* enumArrays;
|
||||
StructuredDataItem rootItem;
|
||||
} StructuredDataDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
int unknown;
|
||||
structuredData_t* data;
|
||||
} structuredDataDef_t;
|
||||
int count;
|
||||
StructuredDataDef* data;
|
||||
} StructuredDataDefSet;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
structuredData_t* data;
|
||||
structuredDataItem_t* item;
|
||||
StructuredDataDef* data;
|
||||
StructuredDataItem* item;
|
||||
int offset;
|
||||
int error;
|
||||
} structuredDataFindState_t;
|
||||
@ -1602,7 +1602,7 @@ namespace Game
|
||||
MaterialVertexDeclaration *vertexDecl;
|
||||
MaterialVertexShader *vertexShader;
|
||||
MaterialPixelShader *pixelShader;
|
||||
structuredDataDef_t* structuredData;
|
||||
StructuredDataDefSet* structuredData;
|
||||
XModel* model;
|
||||
PhysPreset* physPreset;
|
||||
PhysCollmap* physCollmap;
|
||||
|
Loading…
Reference in New Issue
Block a user