Optimize pointer clearing for zonebuilding
This commit is contained in:
parent
a0e52dc550
commit
80267f8874
@ -100,7 +100,7 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PushBlock(Game::XFILE_BLOCK_TEMP);
|
buffer->PushBlock(Game::XFILE_BLOCK_TEMP);
|
||||||
@ -115,7 +115,7 @@ namespace Assets
|
|||||||
// Zero the size!
|
// Zero the size!
|
||||||
destTexture->dataSize = 0;
|
destTexture->dataSize = 0;
|
||||||
|
|
||||||
dest->texture = reinterpret_cast<Game::GfxImageLoadDef*>(-1);
|
Utils::Stream::ClearPointer(&dest->texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -16,13 +16,13 @@ namespace Assets
|
|||||||
if (asset->value)
|
if (asset->value)
|
||||||
{
|
{
|
||||||
buffer->SaveString(asset->value);
|
buffer->SaveString(asset->value);
|
||||||
dest->value = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -40,37 +40,43 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->entityString)
|
if (asset->entityString)
|
||||||
{
|
{
|
||||||
buffer->Save(asset->entityString, asset->numEntityChars);
|
buffer->Save(asset->entityString, asset->numEntityChars);
|
||||||
dest->entityString = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->entityString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->trigger.models)
|
if (asset->trigger.models)
|
||||||
{
|
{
|
||||||
Assert_Size(Game::TriggerModel, 8);
|
Assert_Size(Game::TriggerModel, 8);
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
buffer->SaveArray(asset->trigger.models, asset->trigger.modelCount);
|
buffer->SaveArray(asset->trigger.models, asset->trigger.modelCount);
|
||||||
dest->trigger.models = reinterpret_cast<Game::TriggerModel*>(-1);
|
|
||||||
|
Utils::Stream::ClearPointer(&dest->trigger.models);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->trigger.hulls)
|
if (asset->trigger.hulls)
|
||||||
{
|
{
|
||||||
Assert_Size(Game::TriggerHull, 32);
|
Assert_Size(Game::TriggerHull, 32);
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
buffer->SaveArray(asset->trigger.hulls, asset->trigger.hullCount);
|
buffer->SaveArray(asset->trigger.hulls, asset->trigger.hullCount);
|
||||||
dest->trigger.hulls = reinterpret_cast<Game::TriggerHull*>(-1);
|
|
||||||
|
Utils::Stream::ClearPointer(&dest->trigger.hulls);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->trigger.slabs)
|
if (asset->trigger.slabs)
|
||||||
{
|
{
|
||||||
Assert_Size(Game::TriggerSlab, 20);
|
Assert_Size(Game::TriggerSlab, 20);
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
buffer->SaveArray(asset->trigger.slabs, asset->trigger.slabCount);
|
buffer->SaveArray(asset->trigger.slabs, asset->trigger.slabCount);
|
||||||
dest->trigger.slabs = reinterpret_cast<Game::TriggerSlab*>(-1);
|
|
||||||
|
Utils::Stream::ClearPointer(&dest->trigger.slabs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->stages)
|
if (asset->stages)
|
||||||
@ -88,10 +94,11 @@ namespace Assets
|
|||||||
Game::Stage* stage = &asset->stages[i];
|
Game::Stage* stage = &asset->stages[i];
|
||||||
|
|
||||||
buffer->SaveString(stage->stageName);
|
buffer->SaveString(stage->stageName);
|
||||||
destStage->stageName = reinterpret_cast<char*>(-1);
|
|
||||||
|
Utils::Stream::ClearPointer(&destStage->stageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->stages = reinterpret_cast<Game::Stage*>(-1);
|
Utils::Stream::ClearPointer(&dest->stages);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -207,7 +207,7 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->techniqueSet)
|
if (asset->techniqueSet)
|
||||||
@ -247,22 +247,22 @@ namespace Assets
|
|||||||
if (water)
|
if (water)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
buffer->Save(water, sizeof(Game::water_t));
|
buffer->Save(water);
|
||||||
destTextureDef->info.water = reinterpret_cast<Game::water_t*>(-1);
|
Utils::Stream::ClearPointer(&destTextureDef->info.water);
|
||||||
|
|
||||||
// Save_water_t
|
// Save_water_t
|
||||||
if (water->H0X)
|
if (water->H0X)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
buffer->Save(water->H0X, 8, water->M * water->N);
|
buffer->Save(water->H0X, 8, water->M * water->N);
|
||||||
destWater->H0X = reinterpret_cast<float*>(-1);
|
Utils::Stream::ClearPointer(&destWater->H0X);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (water->H0Y)
|
if (water->H0Y)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
buffer->Save(water->H0Y, 4, water->M * water->N);
|
buffer->Save(water->H0Y, 4, water->M * water->N);
|
||||||
destWater->H0Y = reinterpret_cast<float*>(-1);
|
Utils::Stream::ClearPointer(&destWater->H0Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (water->image)
|
if (water->image)
|
||||||
@ -277,7 +277,7 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->textureTable = reinterpret_cast<Game::MaterialTextureDef*>(-1);
|
Utils::Stream::ClearPointer(&dest->textureTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ namespace Assets
|
|||||||
builder->StorePointer(asset->constantTable);
|
builder->StorePointer(asset->constantTable);
|
||||||
|
|
||||||
buffer->SaveArray(asset->constantTable, asset->constantCount);
|
buffer->SaveArray(asset->constantTable, asset->constantCount);
|
||||||
dest->constantTable = reinterpret_cast<Game::MaterialConstantDef*>(-1);
|
Utils::Stream::ClearPointer(&dest->constantTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ namespace Assets
|
|||||||
builder->StorePointer(asset->stateBitTable);
|
builder->StorePointer(asset->stateBitTable);
|
||||||
|
|
||||||
buffer->Save(asset->stateBitTable, 8, asset->stateBitsCount);
|
buffer->Save(asset->stateBitTable, 8, asset->stateBitsCount);
|
||||||
dest->stateBitTable = reinterpret_cast<void*>(-1);
|
Utils::Stream::ClearPointer(&dest->stateBitTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,14 +16,14 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->loadDef.physicalPart)
|
if (asset->loadDef.physicalPart)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
buffer->Save(asset->loadDef.physicalPart, 4, asset->loadDef.cachedPartSize & 0xFFFF);
|
buffer->Save(asset->loadDef.physicalPart, 4, asset->loadDef.cachedPartSize & 0xFFFF);
|
||||||
dest->loadDef.physicalPart = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->loadDef.physicalPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -48,7 +48,7 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save_MaterialTechniquePtrArray
|
// Save_MaterialTechniquePtrArray
|
||||||
@ -80,7 +80,7 @@ namespace Assets
|
|||||||
|
|
||||||
Game::MaterialPass* destPass = buffer->Dest<Game::MaterialPass>();
|
Game::MaterialPass* destPass = buffer->Dest<Game::MaterialPass>();
|
||||||
Game::MaterialPass* pass = &technique->passes[j];
|
Game::MaterialPass* pass = &technique->passes[j];
|
||||||
buffer->Save(pass, sizeof(Game::MaterialPass));
|
buffer->Save(pass);
|
||||||
|
|
||||||
if (pass->vertexDecl)
|
if (pass->vertexDecl)
|
||||||
{
|
{
|
||||||
@ -101,17 +101,17 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
buffer->SaveArray(pass->argumentDef, pass->argCount1 + pass->argCount2 + pass->argCount3);
|
buffer->SaveArray(pass->argumentDef, pass->argCount1 + pass->argCount2 + pass->argCount3);
|
||||||
destPass->argumentDef = reinterpret_cast<Game::ShaderArgumentDef*>(-1);
|
Utils::Stream::ClearPointer(&destPass->argumentDef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (technique->name)
|
if (technique->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(technique->name);
|
buffer->SaveString(technique->name);
|
||||||
destTechnique->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&destTechnique->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->techniques[i] = reinterpret_cast<Game::MaterialTechnique*>(-1);
|
Utils::Stream::ClearPointer(&dest->techniques[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -16,14 +16,14 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->loadDef.physicalPart)
|
if (asset->loadDef.physicalPart)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
buffer->Save(asset->loadDef.physicalPart, 4, asset->loadDef.cachedPartSize & 0xFFFF);
|
buffer->Save(asset->loadDef.physicalPart, 4, asset->loadDef.cachedPartSize & 0xFFFF);
|
||||||
dest->loadDef.physicalPart = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->loadDef.physicalPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -42,18 +42,18 @@ namespace Assets
|
|||||||
builder->StorePointer(side->side);
|
builder->StorePointer(side->side);
|
||||||
|
|
||||||
buffer->Save(side->side, sizeof(Game::cplane_t));
|
buffer->Save(side->side, sizeof(Game::cplane_t));
|
||||||
destSide->side = reinterpret_cast<Game::cplane_t*>(-1);
|
Utils::Stream::ClearPointer(&destSide->side);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
destBrush->brush.brushSide = reinterpret_cast<Game::cbrushside_t*>(-1);
|
Utils::Stream::ClearPointer(&destBrush->brush.brushSide);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (brush->brush.brushEdge)
|
if (brush->brush.brushEdge)
|
||||||
{
|
{
|
||||||
buffer->Save(brush->brush.brushEdge, brush->totalEdgeCount);
|
buffer->Save(brush->brush.brushEdge, brush->totalEdgeCount);
|
||||||
destBrush->brush.brushEdge = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&destBrush->brush.brushEdge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ namespace Assets
|
|||||||
builder->StorePointer(brush->planes);
|
builder->StorePointer(brush->planes);
|
||||||
|
|
||||||
buffer->Save(brush->planes, sizeof(Game::cplane_t));
|
buffer->Save(brush->planes, sizeof(Game::cplane_t));
|
||||||
destBrush->planes = reinterpret_cast<Game::cplane_t*>(-1);
|
Utils::Stream::ClearPointer(&destBrush->planes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ namespace Assets
|
|||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
IPhysCollmap::Save_BrushWrapper(builder, geom->brush);
|
IPhysCollmap::Save_BrushWrapper(builder, geom->brush);
|
||||||
destGeom->brush = reinterpret_cast<Game::BrushWrapper*>(-1);
|
Utils::Stream::ClearPointer(&destGeom->brush);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->geoms)
|
if (asset->geoms)
|
||||||
@ -122,7 +122,7 @@ namespace Assets
|
|||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
IPhysCollmap::Save_PhysGeomInfoArray(builder, asset->geoms, asset->count);
|
IPhysCollmap::Save_PhysGeomInfoArray(builder, asset->geoms, asset->count);
|
||||||
dest->geoms = reinterpret_cast<Game::PhysGeomInfo*>(-1);
|
Utils::Stream::ClearPointer(&dest->geoms);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -18,13 +18,13 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->sndAliasPrefix)
|
if (asset->sndAliasPrefix)
|
||||||
{
|
{
|
||||||
buffer->SaveString(asset->sndAliasPrefix);
|
buffer->SaveString(asset->sndAliasPrefix);
|
||||||
dest->sndAliasPrefix = reinterpret_cast<const char*>(-1);
|
Utils::Stream::ClearPointer(&dest->sndAliasPrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -38,7 +38,7 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->compressedData)
|
if (asset->compressedData)
|
||||||
@ -52,7 +52,7 @@ namespace Assets
|
|||||||
buffer->Save(asset->compressedData, asset->sizeUnCompressed + 1);
|
buffer->Save(asset->compressedData, asset->sizeUnCompressed + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->compressedData = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->compressedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -30,11 +30,11 @@ namespace Assets
|
|||||||
if (index->key)
|
if (index->key)
|
||||||
{
|
{
|
||||||
buffer->SaveString(index->key);
|
buffer->SaveString(index->key);
|
||||||
destIndex->key = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&destIndex->key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
destEnum->indices = reinterpret_cast<Game::StructuredDataEnumEntry*>(-1);
|
Utils::Stream::ClearPointer(&destEnum->indices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,11 +67,11 @@ namespace Assets
|
|||||||
if (property->name)
|
if (property->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(property->name);
|
buffer->SaveString(property->name);
|
||||||
destProperty->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&destProperty->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
destStruct->property = reinterpret_cast<Game::StructuredDataStructProperty*>(-1);
|
Utils::Stream::ClearPointer(&destStruct->property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->data)
|
if (asset->data)
|
||||||
@ -112,7 +112,7 @@ namespace Assets
|
|||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
IStructuredDataDefSet::Save_StructuredDataEnumArray(data->enums, data->numEnums, builder);
|
IStructuredDataDefSet::Save_StructuredDataEnumArray(data->enums, data->numEnums, builder);
|
||||||
destData->enums = reinterpret_cast<Game::StructuredDataEnum*>(-1);
|
Utils::Stream::ClearPointer(&destData->enums);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->structs)
|
if (data->structs)
|
||||||
@ -121,7 +121,7 @@ namespace Assets
|
|||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
IStructuredDataDefSet::Save_StructuredDataStructArray(data->structs, data->numStructs, builder);
|
IStructuredDataDefSet::Save_StructuredDataStructArray(data->structs, data->numStructs, builder);
|
||||||
destData->structs = reinterpret_cast<Game::StructuredDataStruct*>(-1);
|
Utils::Stream::ClearPointer(&destData->structs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->indexedArrays)
|
if (data->indexedArrays)
|
||||||
@ -130,7 +130,7 @@ namespace Assets
|
|||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
buffer->SaveArray(data->indexedArrays, data->numIndexedArrays);
|
buffer->SaveArray(data->indexedArrays, data->numIndexedArrays);
|
||||||
destData->indexedArrays = reinterpret_cast<Game::StructuredDataIndexedArray*>(-1);
|
Utils::Stream::ClearPointer(&destData->indexedArrays);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->enumArrays)
|
if (data->enumArrays)
|
||||||
@ -139,11 +139,11 @@ namespace Assets
|
|||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
buffer->SaveArray(data->enumArrays, data->numEnumArrays);
|
buffer->SaveArray(data->enumArrays, data->numEnumArrays);
|
||||||
destData->enumArrays = reinterpret_cast<Game::StructuredDataEnumedArray*>(-1);
|
Utils::Stream::ClearPointer(&destData->enumArrays);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->data = reinterpret_cast<Game::StructuredDataDef*>(-1);
|
Utils::Stream::ClearPointer(&dest->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -155,7 +155,7 @@ namespace Assets
|
|||||||
buffer->Save(delta->trans->u.frame0, 12);
|
buffer->Save(delta->trans->u.frame0, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
destDelta->trans = reinterpret_cast<Game::XAnimPartTrans*>(-1);
|
Utils::Stream::ClearPointer(&destDelta->trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delta->quat2)
|
if (delta->quat2)
|
||||||
@ -187,7 +187,7 @@ namespace Assets
|
|||||||
buffer->Save(delta->quat2->u.frame0, 4);
|
buffer->Save(delta->quat2->u.frame0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
destDelta->quat2 = reinterpret_cast<Game::XAnimDeltaPartQuat2*>(-1);
|
Utils::Stream::ClearPointer(&destDelta->quat2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delta->quat)
|
if (delta->quat)
|
||||||
@ -219,7 +219,7 @@ namespace Assets
|
|||||||
buffer->Save(delta->quat->u.frame0, 4);
|
buffer->Save(delta->quat->u.frame0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
destDelta->quat = reinterpret_cast<Game::XAnimDeltaPartQuat*>(-1);
|
Utils::Stream::ClearPointer(&destDelta->quat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->tagnames)
|
if (asset->tagnames)
|
||||||
@ -252,7 +252,7 @@ namespace Assets
|
|||||||
builder->MapScriptString(&destTagnames[i]);
|
builder->MapScriptString(&destTagnames[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->tagnames = reinterpret_cast<short*>(-1);
|
Utils::Stream::ClearPointer(&dest->tagnames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->notetracks)
|
if (asset->notetracks)
|
||||||
@ -268,7 +268,7 @@ namespace Assets
|
|||||||
builder->MapScriptString(&destNotetracks[i].name);
|
builder->MapScriptString(&destNotetracks[i].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->notetracks = reinterpret_cast<Game::XAnimNotifyInfo*>(-1);
|
Utils::Stream::ClearPointer(&dest->notetracks);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->delta)
|
if (asset->delta)
|
||||||
@ -278,47 +278,47 @@ namespace Assets
|
|||||||
|
|
||||||
IXAnimParts::Save_XAnimDeltaPart(asset->delta, asset->framecount, builder);
|
IXAnimParts::Save_XAnimDeltaPart(asset->delta, asset->framecount, builder);
|
||||||
|
|
||||||
dest->delta = reinterpret_cast<Game::XAnimDeltaPart*>(-1);
|
Utils::Stream::ClearPointer(&dest->delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->dataByte)
|
if (asset->dataByte)
|
||||||
{
|
{
|
||||||
buffer->SaveArray(asset->dataByte, asset->dataByteCount);
|
buffer->SaveArray(asset->dataByte, asset->dataByteCount);
|
||||||
dest->dataByte = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->dataShort)
|
if (asset->dataShort)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_2);
|
buffer->Align(Utils::Stream::ALIGN_2);
|
||||||
buffer->SaveArray(asset->dataShort, asset->dataShortCount);
|
buffer->SaveArray(asset->dataShort, asset->dataShortCount);
|
||||||
dest->dataShort = reinterpret_cast<short*>(-1);
|
Utils::Stream::ClearPointer(&dest->dataShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->dataInt)
|
if (asset->dataInt)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
buffer->SaveArray(asset->dataInt, asset->dataIntCount);
|
buffer->SaveArray(asset->dataInt, asset->dataIntCount);
|
||||||
dest->dataInt = reinterpret_cast<int*>(-1);
|
Utils::Stream::ClearPointer(&dest->dataInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->randomDataShort)
|
if (asset->randomDataShort)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_2);
|
buffer->Align(Utils::Stream::ALIGN_2);
|
||||||
buffer->SaveArray(asset->randomDataShort, asset->randomDataShortCount);
|
buffer->SaveArray(asset->randomDataShort, asset->randomDataShortCount);
|
||||||
dest->randomDataShort = reinterpret_cast<short*>(-1);
|
Utils::Stream::ClearPointer(&dest->randomDataShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->randomDataByte)
|
if (asset->randomDataByte)
|
||||||
{
|
{
|
||||||
buffer->SaveArray(asset->randomDataByte, asset->randomDataByteCount);
|
buffer->SaveArray(asset->randomDataByte, asset->randomDataByteCount);
|
||||||
dest->randomDataByte = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->randomDataByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->randomDataInt)
|
if (asset->randomDataInt)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
buffer->SaveArray(asset->randomDataInt, asset->randomDataIntCount);
|
buffer->SaveArray(asset->randomDataInt, asset->randomDataIntCount);
|
||||||
dest->randomDataInt = reinterpret_cast<int*>(-1);
|
Utils::Stream::ClearPointer(&dest->randomDataInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->indices.data)
|
if (asset->indices.data)
|
||||||
@ -333,7 +333,7 @@ namespace Assets
|
|||||||
buffer->SaveArray(asset->indices._1, asset->indexcount);
|
buffer->SaveArray(asset->indices._1, asset->indexcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->indices.data = reinterpret_cast<void*>(-1);
|
Utils::Stream::ClearPointer(&dest->indices.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -205,7 +205,7 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->boneNames)
|
if (asset->boneNames)
|
||||||
@ -220,13 +220,13 @@ namespace Assets
|
|||||||
builder->MapScriptString(&destBoneNames[i]);
|
builder->MapScriptString(&destBoneNames[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->boneNames = reinterpret_cast<short*>(-1);
|
Utils::Stream::ClearPointer(&dest->boneNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->parentList)
|
if (asset->parentList)
|
||||||
{
|
{
|
||||||
buffer->Save(asset->parentList, asset->numBones - asset->numRootBones);
|
buffer->Save(asset->parentList, asset->numBones - asset->numRootBones);
|
||||||
dest->parentList = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->parentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->tagAngles)
|
if (asset->tagAngles)
|
||||||
@ -235,7 +235,7 @@ namespace Assets
|
|||||||
|
|
||||||
buffer->Align(Utils::Stream::ALIGN_2);
|
buffer->Align(Utils::Stream::ALIGN_2);
|
||||||
buffer->SaveArray(asset->tagAngles, asset->numBones - asset->numRootBones);
|
buffer->SaveArray(asset->tagAngles, asset->numBones - asset->numRootBones);
|
||||||
dest->tagAngles = reinterpret_cast<Game::XModelAngle*>(-1);
|
Utils::Stream::ClearPointer(&dest->tagAngles);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->tagPositions)
|
if (asset->tagPositions)
|
||||||
@ -244,13 +244,13 @@ namespace Assets
|
|||||||
|
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
buffer->SaveArray(asset->tagPositions, asset->numBones - asset->numRootBones);
|
buffer->SaveArray(asset->tagPositions, asset->numBones - asset->numRootBones);
|
||||||
dest->tagPositions = reinterpret_cast<Game::XModelTagPos*>(-1);
|
Utils::Stream::ClearPointer(&dest->tagPositions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->partClassification)
|
if (asset->partClassification)
|
||||||
{
|
{
|
||||||
buffer->Save(asset->partClassification, asset->numBones);
|
buffer->Save(asset->partClassification, asset->numBones);
|
||||||
dest->partClassification = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->partClassification);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->animMatrix)
|
if (asset->animMatrix)
|
||||||
@ -259,7 +259,7 @@ namespace Assets
|
|||||||
|
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
buffer->SaveArray(asset->animMatrix, asset->numBones);
|
buffer->SaveArray(asset->animMatrix, asset->numBones);
|
||||||
dest->animMatrix = reinterpret_cast<Game::DObjAnimMat*>(-1);
|
Utils::Stream::ClearPointer(&dest->animMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->materials)
|
if (asset->materials)
|
||||||
@ -277,7 +277,7 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->materials = reinterpret_cast<Game::Material**>(-1);
|
Utils::Stream::ClearPointer(&dest->materials);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save_XModelLodInfoArray
|
// Save_XModelLodInfoArray
|
||||||
@ -295,7 +295,7 @@ namespace Assets
|
|||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
IXModelSurfs().Save({ asset->lods[i].surfaces }, builder);
|
IXModelSurfs().Save({ asset->lods[i].surfaces }, builder);
|
||||||
dest->lods[i].surfaces = reinterpret_cast<Game::XModelSurfs*>(-1);
|
Utils::Stream::ClearPointer(&dest->lods[i].surfaces);
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
}
|
}
|
||||||
@ -320,12 +320,13 @@ namespace Assets
|
|||||||
if (colSurf->tris)
|
if (colSurf->tris)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
buffer->Save(colSurf->tris, 48, colSurf->count);
|
buffer->Save(colSurf->tris, 48, colSurf->count);
|
||||||
destColSurf->tris = reinterpret_cast<void*>(-1);
|
Utils::Stream::ClearPointer(&destColSurf->tris);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->colSurf = reinterpret_cast<Game::XModelCollSurf*>(-1);
|
Utils::Stream::ClearPointer(&dest->colSurf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->boneInfo)
|
if (asset->boneInfo)
|
||||||
@ -335,7 +336,7 @@ namespace Assets
|
|||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
buffer->SaveArray(asset->boneInfo, asset->numBones);
|
buffer->SaveArray(asset->boneInfo, asset->numBones);
|
||||||
dest->boneInfo = reinterpret_cast<Game::XBoneInfo*>(-1);
|
Utils::Stream::ClearPointer(&dest->boneInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->physPreset)
|
if (asset->physPreset)
|
||||||
|
@ -15,14 +15,14 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_16);
|
buffer->Align(Utils::Stream::ALIGN_16);
|
||||||
buffer->Save(entry->node, 16, entry->numNode);
|
buffer->Save(entry->node, 16, entry->numNode);
|
||||||
destEntry->node = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&destEntry->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->leaf)
|
if (entry->leaf)
|
||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_2);
|
buffer->Align(Utils::Stream::ALIGN_2);
|
||||||
buffer->SaveArray(entry->leaf, entry->numLeaf);
|
buffer->SaveArray(entry->leaf, entry->numLeaf);
|
||||||
destEntry->leaf = reinterpret_cast<short*>(-1);
|
Utils::Stream::ClearPointer(&destEntry->leaf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_2);
|
buffer->Align(Utils::Stream::ALIGN_2);
|
||||||
buffer->Save(surf->blendInfo, sizeof(short), surf->blendNum1 + (surf->blendNum2 * 3) + (surf->blendNum3 * 5) + (surf->blendNum4 * 7));
|
buffer->Save(surf->blendInfo, sizeof(short), surf->blendNum1 + (surf->blendNum2 * 3) + (surf->blendNum3 * 5) + (surf->blendNum4 * 7));
|
||||||
destSurf->blendInfo = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&destSurf->blendInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Access vertex block
|
// Access vertex block
|
||||||
@ -45,7 +45,7 @@ namespace Assets
|
|||||||
|
|
||||||
buffer->Align(Utils::Stream::ALIGN_16);
|
buffer->Align(Utils::Stream::ALIGN_16);
|
||||||
buffer->SaveArray(surf->vertexBuffer, surf->numVertices);
|
buffer->SaveArray(surf->vertexBuffer, surf->numVertices);
|
||||||
destSurf->vertexBuffer = reinterpret_cast<Game::GfxPackedVertex*>(-1);
|
Utils::Stream::ClearPointer(&destSurf->vertexBuffer);
|
||||||
}
|
}
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
|
||||||
@ -68,11 +68,11 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
buffer->Align(Utils::Stream::ALIGN_4);
|
buffer->Align(Utils::Stream::ALIGN_4);
|
||||||
IXModelSurfs::Save_XSurfaceCollisionTree(rigidVertList->entry, builder);
|
IXModelSurfs::Save_XSurfaceCollisionTree(rigidVertList->entry, builder);
|
||||||
destRigidVertList->entry = reinterpret_cast<Game::XSurfaceCollisionTree*>(-1);
|
Utils::Stream::ClearPointer(&destRigidVertList->entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
destSurf->ct = reinterpret_cast<Game::XRigidVertList*>(-1);
|
Utils::Stream::ClearPointer(&destSurf->ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Access index block
|
// Access index block
|
||||||
@ -83,7 +83,7 @@ namespace Assets
|
|||||||
|
|
||||||
buffer->Align(Utils::Stream::ALIGN_16);
|
buffer->Align(Utils::Stream::ALIGN_16);
|
||||||
buffer->SaveArray(surf->indexBuffer, surf->numPrimitives);
|
buffer->SaveArray(surf->indexBuffer, surf->numPrimitives);
|
||||||
destSurf->indexBuffer = reinterpret_cast<Game::Face*>(-1);
|
Utils::Stream::ClearPointer(&destSurf->indexBuffer);
|
||||||
}
|
}
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ namespace Assets
|
|||||||
if (asset->name)
|
if (asset->name)
|
||||||
{
|
{
|
||||||
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));
|
||||||
dest->name = reinterpret_cast<char*>(-1);
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->surfaces)
|
if (asset->surfaces)
|
||||||
@ -119,7 +119,7 @@ namespace Assets
|
|||||||
IXModelSurfs::Save_XSurface(&asset->surfaces[i], &destSurfaces[i], builder);
|
IXModelSurfs::Save_XSurface(&asset->surfaces[i], &destSurfaces[i], builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->surfaces = reinterpret_cast<Game::XSurface*>(-1);
|
Utils::Stream::ClearPointer(&dest->surfaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->PopBlock();
|
buffer->PopBlock();
|
||||||
|
@ -132,7 +132,7 @@ namespace Components
|
|||||||
memset(this->PipeName, 0, sizeof(this->PipeName));
|
memset(this->PipeName, 0, sizeof(this->PipeName));
|
||||||
memset(this->PipeFile, 0, sizeof(this->PipeFile));
|
memset(this->PipeFile, 0, sizeof(this->PipeFile));
|
||||||
|
|
||||||
strncpy_s(this->PipeName, name.c_str(), sizeof(this->PipeName));
|
strncpy_s(this->PipeName, name.data(), sizeof(this->PipeName));
|
||||||
sprintf_s(this->PipeFile, sizeof(this->PipeFile), "\\\\.\\Pipe\\%s", this->PipeName);
|
sprintf_s(this->PipeFile, sizeof(this->PipeFile), "\\\\.\\Pipe\\%s", this->PipeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,6 +324,9 @@ namespace Components
|
|||||||
// developer_Script 1
|
// developer_Script 1
|
||||||
Utils::Hook::Set<bool>(0x60AE2B, true);
|
Utils::Hook::Set<bool>(0x60AE2B, true);
|
||||||
|
|
||||||
|
// Disable cheat protection for dvars
|
||||||
|
Utils::Hook::Set<BYTE>(0x647682, 0xEB);
|
||||||
|
|
||||||
// Constantly draw the mini console
|
// Constantly draw the mini console
|
||||||
Utils::Hook::Set<BYTE>(0x412A45, 0xEB);
|
Utils::Hook::Set<BYTE>(0x412A45, 0xEB);
|
||||||
Renderer::OnFrame([] ()
|
Renderer::OnFrame([] ()
|
||||||
|
@ -69,7 +69,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
std::string fastfile = DataMap.GetElementAt(i, 1);
|
std::string fastfile = DataMap.GetElementAt(i, 1);
|
||||||
|
|
||||||
if (!Game::DB_IsZoneLoaded(fastfile.c_str()))
|
if (!Game::DB_IsZoneLoaded(fastfile.data()))
|
||||||
{
|
{
|
||||||
Game::XZoneInfo info;
|
Game::XZoneInfo info;
|
||||||
info.name = fastfile.data();
|
info.name = fastfile.data();
|
||||||
@ -80,7 +80,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::Print("Zone '%s' already loaded\n", fastfile.c_str());
|
Logger::Print("Zone '%s' already loaded\n", fastfile.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ namespace Components
|
|||||||
Game::XAssetHeader ZoneBuilder::Zone::RequireAsset(Game::XAssetType type, const char* name)
|
Game::XAssetHeader ZoneBuilder::Zone::RequireAsset(Game::XAssetType type, const char* name)
|
||||||
{
|
{
|
||||||
Game::XAssetHeader header;
|
Game::XAssetHeader header;
|
||||||
header.data = reinterpret_cast<void*>(-1);
|
Utils::Stream::ClearPointer(&header.data);
|
||||||
|
|
||||||
int assetIndex = ZoneBuilder::Zone::FindAsset(type, name);
|
int assetIndex = ZoneBuilder::Zone::FindAsset(type, name);
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ namespace Components
|
|||||||
Utils::WriteFile(outFile, outBuffer);
|
Utils::WriteFile(outFile, outBuffer);
|
||||||
|
|
||||||
Logger::Print("done.\n");
|
Logger::Print("done.\n");
|
||||||
Logger::Print("Zone '%s' written with %d assets\n", outFile.c_str(), ZoneBuilder::Zone::LoadedAssets.size());
|
Logger::Print("Zone '%s' written with %d assets\n", outFile.data(), ZoneBuilder::Zone::LoadedAssets.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneBuilder::Zone::SaveData()
|
void ZoneBuilder::Zone::SaveData()
|
||||||
@ -235,13 +235,13 @@ namespace Components
|
|||||||
// Add header
|
// Add header
|
||||||
Game::ZoneHeader zoneHeader = { 0 };
|
Game::ZoneHeader zoneHeader = { 0 };
|
||||||
zoneHeader.assetList.assetCount = ZoneBuilder::Zone::LoadedAssets.size();
|
zoneHeader.assetList.assetCount = ZoneBuilder::Zone::LoadedAssets.size();
|
||||||
zoneHeader.assetList.assets = reinterpret_cast<Game::XAsset*>(-1);
|
Utils::Stream::ClearPointer(&zoneHeader.assetList.assets);
|
||||||
|
|
||||||
// Increment ScriptStrings count (for empty script string) if available
|
// Increment ScriptStrings count (for empty script string) if available
|
||||||
if (!ZoneBuilder::Zone::ScriptStrings.empty())
|
if (!ZoneBuilder::Zone::ScriptStrings.empty())
|
||||||
{
|
{
|
||||||
zoneHeader.assetList.stringList.count = ZoneBuilder::Zone::ScriptStrings.size() + 1;
|
zoneHeader.assetList.stringList.count = ZoneBuilder::Zone::ScriptStrings.size() + 1;
|
||||||
zoneHeader.assetList.stringList.strings = reinterpret_cast<const char**>(-1);
|
Utils::Stream::ClearPointer(&zoneHeader.assetList.stringList.strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write header
|
// Write header
|
||||||
@ -267,7 +267,7 @@ namespace Components
|
|||||||
// Write ScriptStrings
|
// Write ScriptStrings
|
||||||
for (auto ScriptString : ZoneBuilder::Zone::ScriptStrings)
|
for (auto ScriptString : ZoneBuilder::Zone::ScriptStrings)
|
||||||
{
|
{
|
||||||
ZoneBuilder::Zone::Buffer.SaveString(ScriptString.c_str());
|
ZoneBuilder::Zone::Buffer.SaveString(ScriptString.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,11 +278,10 @@ namespace Components
|
|||||||
// AssetTable
|
// AssetTable
|
||||||
for (auto asset : ZoneBuilder::Zone::LoadedAssets)
|
for (auto asset : ZoneBuilder::Zone::LoadedAssets)
|
||||||
{
|
{
|
||||||
Game::XAsset entry;
|
Game::XAsset entry = { entry.type, 0 };
|
||||||
entry.type = asset.type;
|
Utils::Stream::ClearPointer(&entry.header.data);
|
||||||
entry.header.data = reinterpret_cast<void*>(-1);
|
|
||||||
|
|
||||||
ZoneBuilder::Zone::Buffer.Save(&entry, sizeof(Game::XAsset));
|
ZoneBuilder::Zone::Buffer.Save(&entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assets
|
// Assets
|
||||||
|
@ -70,6 +70,10 @@ namespace Utils
|
|||||||
char* Save(const void * _str, size_t size, size_t count = 1);
|
char* Save(const void * _str, size_t size, size_t count = 1);
|
||||||
char* Save(Game::XFILE_BLOCK_TYPES stream, const void * _str, size_t size, size_t count);
|
char* Save(Game::XFILE_BLOCK_TYPES stream, const void * _str, size_t size, size_t count);
|
||||||
char* Save(Game::XFILE_BLOCK_TYPES stream, int value, size_t count);
|
char* Save(Game::XFILE_BLOCK_TYPES stream, int value, size_t count);
|
||||||
|
template <typename T> char* Save(T* object)
|
||||||
|
{
|
||||||
|
return SaveArray<T>(object, 1);
|
||||||
|
}
|
||||||
template <typename T> char* SaveArray(T* array, size_t count)
|
template <typename T> char* SaveArray(T* array, size_t count)
|
||||||
{
|
{
|
||||||
return Save(array, sizeof(T), count);
|
return Save(array, sizeof(T), count);
|
||||||
@ -101,6 +105,10 @@ namespace Utils
|
|||||||
{
|
{
|
||||||
return reinterpret_cast<T*>(this->At());
|
return reinterpret_cast<T*>(this->At());
|
||||||
}
|
}
|
||||||
|
template <typename T> static inline void ClearPointer(T** object)
|
||||||
|
{
|
||||||
|
*object = reinterpret_cast<T*>(-1);
|
||||||
|
}
|
||||||
|
|
||||||
void ToBuffer(std::string& outBuffer);
|
void ToBuffer(std::string& outBuffer);
|
||||||
std::string ToBuffer();
|
std::string ToBuffer();
|
||||||
|
Loading…
Reference in New Issue
Block a user