Merge branch 'nested_assets' into develop
This commit is contained in:
commit
9945d15b90
@ -49,7 +49,7 @@ namespace Assets
|
||||
{
|
||||
if (visuals->xmodel)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, visuals->xmodel->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_XMODEL, visuals->xmodel);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -61,7 +61,7 @@ namespace Assets
|
||||
|
||||
case 0xA:
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_SOUND, visuals->soundName);
|
||||
//builder->markAsset(Game::XAssetType::ASSET_TYPE_SOUND, visuals->soundName);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ namespace Assets
|
||||
{
|
||||
if (visuals->effectDef)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, visuals->effectDef->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_FX, visuals->effectDef);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -79,7 +79,7 @@ namespace Assets
|
||||
{
|
||||
if (visuals->material)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, visuals->material->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, visuals->material);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -104,12 +104,12 @@ namespace Assets
|
||||
{
|
||||
if (elemDef->visuals.markArray[j].data[0])
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[0]->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[0]);
|
||||
}
|
||||
|
||||
if (elemDef->visuals.markArray[j].data[1])
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[1]->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,17 +132,17 @@ namespace Assets
|
||||
|
||||
if (elemDef->effectOnImpact)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, elemDef->effectOnImpact->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_FX, elemDef->effectOnImpact);
|
||||
}
|
||||
|
||||
if (elemDef->effectOnDeath)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, elemDef->effectOnDeath->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_FX, elemDef->effectOnDeath);
|
||||
}
|
||||
|
||||
if (elemDef->effectEmitted)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, elemDef->effectEmitted->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_FX, elemDef->effectEmitted);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -157,7 +157,7 @@ namespace Assets
|
||||
{
|
||||
if (visuals->xmodel)
|
||||
{
|
||||
destVisuals->xmodel = builder->requireAsset(Game::XAssetType::ASSET_TYPE_XMODEL, visuals->xmodel->name).model;
|
||||
destVisuals->xmodel = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODEL, visuals->xmodel).model;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -193,7 +193,7 @@ namespace Assets
|
||||
{
|
||||
if (visuals->material)
|
||||
{
|
||||
destVisuals->material = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, visuals->material->name).material;
|
||||
destVisuals->material = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, visuals->material).material;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -267,12 +267,12 @@ namespace Assets
|
||||
{
|
||||
if (elemDef->visuals.markArray[j].data[0])
|
||||
{
|
||||
destMarkArray[j].data[0] = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[0]->name).material;
|
||||
destMarkArray[j].data[0] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[0]).material;
|
||||
}
|
||||
|
||||
if (elemDef->visuals.markArray[j].data[1])
|
||||
{
|
||||
destMarkArray[j].data[1] = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[1]->name).material;
|
||||
destMarkArray[j].data[1] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, elemDef->visuals.markArray[j].data[1]).material;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,17 +39,17 @@ namespace Assets
|
||||
|
||||
if (glassDef->physPreset)
|
||||
{
|
||||
destGlassDef->physPreset = builder->requireAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, glassDef->physPreset->name).physPreset;
|
||||
destGlassDef->physPreset = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, glassDef->physPreset).physPreset;
|
||||
}
|
||||
|
||||
if (glassDef->material)
|
||||
{
|
||||
destGlassDef->material = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, glassDef->material->name).material;
|
||||
destGlassDef->material = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, glassDef->material).material;
|
||||
}
|
||||
|
||||
if (glassDef->materialShattered)
|
||||
{
|
||||
destGlassDef->materialShattered = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, glassDef->materialShattered->name).material;
|
||||
destGlassDef->materialShattered = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, glassDef->materialShattered).material;
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,9 +164,9 @@ namespace Assets
|
||||
{
|
||||
for (unsigned int i = 0; i < asset->glassSys.defCount; ++i)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, asset->glassSys.defs[i].physPreset->name);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->glassSys.defs[i].material->name);
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->glassSys.defs[i].materialShattered->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, asset->glassSys.defs[i].physPreset);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->glassSys.defs[i].material);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->glassSys.defs[i].materialShattered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace Assets
|
||||
{
|
||||
for (unsigned int i = 0; i < asset->worldDraw.reflectionProbeCount; ++i)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->worldDraw.reflectionImages[i]->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->worldDraw.reflectionImages[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,34 +28,34 @@ namespace Assets
|
||||
{
|
||||
if (asset->worldDraw.lightmaps[i].primary)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->worldDraw.lightmaps[i].primary->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->worldDraw.lightmaps[i].primary);
|
||||
}
|
||||
|
||||
if (asset->worldDraw.lightmaps[i].secondary)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->worldDraw.lightmaps[i].secondary->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->worldDraw.lightmaps[i].secondary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (asset->worldDraw.skyImage)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->worldDraw.skyImage->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->worldDraw.skyImage);
|
||||
}
|
||||
|
||||
if (asset->worldDraw.outdoorImage)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->worldDraw.outdoorImage->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->worldDraw.outdoorImage);
|
||||
}
|
||||
|
||||
if (asset->sun.spriteMaterial)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->sun.spriteMaterial->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->sun.spriteMaterial);
|
||||
}
|
||||
|
||||
if (asset->sun.flareMaterial)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->sun.flareMaterial->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->sun.flareMaterial);
|
||||
}
|
||||
|
||||
if (asset->skies)
|
||||
@ -64,7 +64,7 @@ namespace Assets
|
||||
{
|
||||
if (asset->skies[i].skyImage)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->skies[i].skyImage->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->skies[i].skyImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -75,14 +75,14 @@ namespace Assets
|
||||
{
|
||||
if (asset->materialMemory[i].material)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->materialMemory[i].material->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->materialMemory[i].material);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (asset->unknownImage)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->unknownImage->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->unknownImage);
|
||||
}
|
||||
|
||||
if (asset->dpvs.surfaces)
|
||||
@ -91,7 +91,7 @@ namespace Assets
|
||||
{
|
||||
if (asset->dpvs.surfaces[i].material)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->dpvs.surfaces[i].material->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->dpvs.surfaces[i].material);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -102,7 +102,7 @@ namespace Assets
|
||||
{
|
||||
if (asset->dpvs.smodelDrawInsts[i].model)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->dpvs.smodelDrawInsts[i].model->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->dpvs.smodelDrawInsts[i].model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -169,7 +169,7 @@ namespace Assets
|
||||
|
||||
for (unsigned int i = 0; i < asset->reflectionProbeCount; ++i)
|
||||
{
|
||||
imageDest[i] = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->reflectionImages[i]->name).image;
|
||||
imageDest[i] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->reflectionImages[i]).image;
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->reflectionImages);
|
||||
@ -213,12 +213,12 @@ namespace Assets
|
||||
|
||||
if (lightmapArray->primary)
|
||||
{
|
||||
lightmapArrayDest->primary = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, lightmapArray->primary->name).image;
|
||||
lightmapArrayDest->primary = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, lightmapArray->primary).image;
|
||||
}
|
||||
|
||||
if (lightmapArray->secondary)
|
||||
{
|
||||
lightmapArrayDest->secondary = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, lightmapArray->secondary->name).image;
|
||||
lightmapArrayDest->secondary = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, lightmapArray->secondary).image;
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,12 +245,12 @@ namespace Assets
|
||||
|
||||
if (asset->skyImage)
|
||||
{
|
||||
dest->skyImage = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->skyImage->name).image;
|
||||
dest->skyImage = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->skyImage).image;
|
||||
}
|
||||
|
||||
if (asset->outdoorImage)
|
||||
{
|
||||
dest->outdoorImage = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->outdoorImage->name).image;
|
||||
dest->outdoorImage = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->outdoorImage).image;
|
||||
}
|
||||
|
||||
// saveGfxWorldVertexData
|
||||
@ -334,14 +334,14 @@ namespace Assets
|
||||
|
||||
if (asset->spriteMaterial)
|
||||
{
|
||||
dest->spriteMaterial = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->spriteMaterial->name).material;
|
||||
dest->spriteMaterial = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->spriteMaterial).material;
|
||||
}
|
||||
|
||||
if (asset->flareMaterial)
|
||||
{
|
||||
dest->flareMaterial = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->flareMaterial->name).material;
|
||||
dest->flareMaterial = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->flareMaterial).material;
|
||||
}
|
||||
|
||||
|
||||
SaveLogExit();
|
||||
}
|
||||
|
||||
@ -405,7 +405,7 @@ namespace Assets
|
||||
|
||||
if (surface->material)
|
||||
{
|
||||
destSurface->material = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, surface->material->name).material;
|
||||
destSurface->material = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, surface->material).material;
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,7 +436,7 @@ namespace Assets
|
||||
|
||||
if (model->model)
|
||||
{
|
||||
destModel->model = builder->requireAsset(Game::XAssetType::ASSET_TYPE_XMODEL, model->model->name).model;
|
||||
destModel->model = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODEL, model->model).model;
|
||||
}
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ namespace Assets
|
||||
|
||||
if (sky->skyImage)
|
||||
{
|
||||
destSky->skyImage = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, sky->skyImage->name).image;
|
||||
destSky->skyImage = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, sky->skyImage).image;
|
||||
}
|
||||
}
|
||||
|
||||
@ -705,7 +705,7 @@ namespace Assets
|
||||
|
||||
if (materialMemory->material)
|
||||
{
|
||||
destMaterialMemory->material = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, materialMemory->material->name).material;
|
||||
destMaterialMemory->material = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, materialMemory->material).material;
|
||||
}
|
||||
}
|
||||
|
||||
@ -716,7 +716,7 @@ namespace Assets
|
||||
|
||||
if (asset->unknownImage)
|
||||
{
|
||||
dest->unknownImage = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->unknownImage->name).image;
|
||||
dest->unknownImage = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->unknownImage).image;
|
||||
}
|
||||
|
||||
buffer->pushBlock(Game::XFILE_BLOCK_RUNTIME);
|
||||
|
@ -168,7 +168,7 @@ namespace Assets
|
||||
|
||||
if (asset->techniqueSet)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_TECHSET, asset->techniqueSet->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_TECHSET, asset->techniqueSet);
|
||||
}
|
||||
|
||||
if (asset->textureTable)
|
||||
@ -181,12 +181,12 @@ namespace Assets
|
||||
{
|
||||
if (asset->textureTable[i].info.water->image)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->textureTable[i].info.water->image->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->textureTable[i].info.water->image);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->textureTable[i].info.image->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->textureTable[i].info.image);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -212,7 +212,7 @@ namespace Assets
|
||||
|
||||
if (asset->techniqueSet)
|
||||
{
|
||||
dest->techniqueSet = builder->requireAsset(Game::XAssetType::ASSET_TYPE_TECHSET, asset->techniqueSet->name).techniqueSet;
|
||||
dest->techniqueSet = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_TECHSET, asset->techniqueSet).techniqueSet;
|
||||
}
|
||||
|
||||
if (asset->textureTable)
|
||||
@ -267,13 +267,13 @@ namespace Assets
|
||||
|
||||
if (water->image)
|
||||
{
|
||||
destWater->image = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, water->image->name).image;
|
||||
destWater->image = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, water->image).image;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (textureDef->info.image)
|
||||
{
|
||||
destTextureDef->info.image = builder->requireAsset(Game::XAssetType::ASSET_TYPE_IMAGE, textureDef->info.image->name).image;
|
||||
destTextureDef->info.image = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, textureDef->info.image).image;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,17 +18,17 @@ namespace Assets
|
||||
|
||||
if (pass->vertexDecl)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_VERTEXDECL, pass->vertexDecl->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_VERTEXDECL, pass->vertexDecl);
|
||||
}
|
||||
|
||||
if (pass->vertexShader)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_VERTEXSHADER, pass->vertexShader->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_VERTEXSHADER, pass->vertexShader);
|
||||
}
|
||||
|
||||
if (pass->pixelShader)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_PIXELSHADER, pass->pixelShader->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_PIXELSHADER, pass->pixelShader);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -86,17 +86,17 @@ namespace Assets
|
||||
|
||||
if (pass->vertexDecl)
|
||||
{
|
||||
destPass->vertexDecl = builder->requireAsset(Game::XAssetType::ASSET_TYPE_VERTEXDECL, pass->vertexDecl->name).vertexDecl;
|
||||
destPass->vertexDecl = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_VERTEXDECL, pass->vertexDecl).vertexDecl;
|
||||
}
|
||||
|
||||
if (pass->vertexShader)
|
||||
{
|
||||
destPass->vertexShader = builder->requireAsset(Game::XAssetType::ASSET_TYPE_VERTEXSHADER, pass->vertexShader->name).vertexShader;
|
||||
destPass->vertexShader = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_VERTEXSHADER, pass->vertexShader).vertexShader;
|
||||
}
|
||||
|
||||
if (pass->pixelShader)
|
||||
{
|
||||
destPass->pixelShader = builder->requireAsset(Game::XAssetType::ASSET_TYPE_PIXELSHADER, pass->pixelShader->name).pixelShader;
|
||||
destPass->pixelShader = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_PIXELSHADER, pass->pixelShader).pixelShader;
|
||||
}
|
||||
|
||||
if (pass->argumentDef)
|
||||
|
@ -144,7 +144,7 @@ namespace Assets
|
||||
if (reader.readByte())
|
||||
{
|
||||
model->colSurf = reader.readArray<Game::XModelCollSurf>(model->numColSurfs);
|
||||
|
||||
|
||||
for (int i = 0; i < model->numColSurfs; ++i)
|
||||
{
|
||||
if (model->colSurf[i].tris)
|
||||
@ -195,7 +195,7 @@ namespace Assets
|
||||
{
|
||||
if (asset->materials[i])
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->materials[i]->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->materials[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -205,7 +205,7 @@ namespace Assets
|
||||
if (asset->lods[i].surfaces)
|
||||
{
|
||||
// We're not supposed to include xmodelsurfs as standalone asset
|
||||
//builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODELSURFS, asset->lods[i].surfaces->name);
|
||||
//builder->markAsset(Game::XAssetType::ASSET_TYPE_XMODELSURFS, asset->lods[i].surfaces->name);
|
||||
|
||||
IXModelSurfs().mark({ asset->lods[i].surfaces }, builder);
|
||||
}
|
||||
@ -213,12 +213,12 @@ namespace Assets
|
||||
|
||||
if (asset->physPreset)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, asset->physPreset->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, asset->physPreset);
|
||||
}
|
||||
|
||||
if (asset->physCollmap)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_PHYS_COLLMAP, asset->physCollmap->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_PHYS_COLLMAP, asset->physCollmap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ namespace Assets
|
||||
|
||||
unsigned short* destBoneNames = buffer->dest<unsigned short>();
|
||||
buffer->saveArray(asset->boneNames, asset->numBones);
|
||||
|
||||
|
||||
for (char i = 0; i < asset->numBones; ++i)
|
||||
{
|
||||
builder->mapScriptString(&destBoneNames[i]);
|
||||
@ -304,7 +304,7 @@ namespace Assets
|
||||
{
|
||||
if (asset->materials[i])
|
||||
{
|
||||
destMaterials[i] = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->materials[i]->name).material;
|
||||
destMaterials[i] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->materials[i]).material;
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ namespace Assets
|
||||
if (asset->lods[i].surfaces)
|
||||
{
|
||||
// Requiring this asset is not possible, it has to be loaded as part of the model
|
||||
//dest->lods[i].surfaces = builder->requireAsset(Game::XAssetType::ASSET_TYPE_XMODELSURFS, asset->lods[i].surfaces->name).surfaces;
|
||||
//dest->lods[i].surfaces = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODELSURFS, asset->lods[i].surfaces).surfaces;
|
||||
|
||||
buffer->pushBlock(Game::XFILE_BLOCK_TEMP);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
@ -372,12 +372,12 @@ namespace Assets
|
||||
|
||||
if (asset->physPreset)
|
||||
{
|
||||
dest->physPreset = builder->requireAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, asset->physPreset->name).physPreset;
|
||||
dest->physPreset = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, asset->physPreset).physPreset;
|
||||
}
|
||||
|
||||
if (asset->physCollmap)
|
||||
{
|
||||
dest->physCollmap = builder->requireAsset(Game::XAssetType::ASSET_TYPE_PHYS_COLLMAP, asset->physCollmap->name).physCollmap;
|
||||
dest->physCollmap = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_PHYS_COLLMAP, asset->physCollmap).physCollmap;
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
|
@ -56,7 +56,7 @@ namespace Assets
|
||||
{
|
||||
if (asset->staticModelList[i].xmodel)
|
||||
{
|
||||
destStaticModelList[i].xmodel = builder->requireAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->staticModelList[i].xmodel->name).model;
|
||||
destStaticModelList[i].xmodel = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->staticModelList[i].xmodel).model;
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +90,12 @@ namespace Assets
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
Game::cbrushside_t* sides = buffer->dest<Game::cbrushside_t>();
|
||||
buffer->saveArray(asset->cBrushSides, asset->numCBrushSides);
|
||||
// we need the pointer to each of these to be stored so we can't write them all at once
|
||||
for(int i = 0; i < asset->numCBrushSides; ++i)
|
||||
{
|
||||
builder->storePointer(&asset->cBrushSides[i]); // for reference in cBrush
|
||||
buffer->save(&asset->cBrushSides[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < asset->numCBrushSides; ++i)
|
||||
{
|
||||
@ -350,6 +355,8 @@ namespace Assets
|
||||
{
|
||||
AssertSize(Game::cbrushside_t, 8);
|
||||
|
||||
MessageBoxA(0, "BrushSide shouldn't be written in cBrush!", "WARNING", MB_ICONEXCLAMATION);
|
||||
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
builder->storePointer(brush->brushSide);
|
||||
|
||||
@ -427,7 +434,7 @@ namespace Assets
|
||||
|
||||
if (asset->mapEnts)
|
||||
{
|
||||
dest->mapEnts = builder->requireAsset(Game::XAssetType::ASSET_TYPE_MAP_ENTS, asset->name).mapEnts;
|
||||
dest->mapEnts = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MAP_ENTS, asset->mapEnts).mapEnts;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
@ -445,17 +452,17 @@ namespace Assets
|
||||
{
|
||||
if (dynEnt[j].xModel)
|
||||
{
|
||||
dynEntDest[j].xModel = builder->requireAsset(Game::XAssetType::ASSET_TYPE_XMODEL, dynEnt[j].xModel->name).model;
|
||||
dynEntDest[j].xModel = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODEL, dynEnt[j].xModel).model;
|
||||
}
|
||||
|
||||
if (dynEnt[j].destroyFx)
|
||||
{
|
||||
dynEntDest[j].destroyFx = builder->requireAsset(Game::XAssetType::ASSET_TYPE_FX, dynEnt[j].destroyFx->name).fx;
|
||||
dynEntDest[j].destroyFx = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_FX, dynEnt[j].destroyFx).fx;
|
||||
}
|
||||
|
||||
if (dynEnt[j].physPreset)
|
||||
{
|
||||
dynEntDest[j].physPreset = builder->requireAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, dynEnt[j].physPreset->name).physPreset;
|
||||
dynEntDest[j].physPreset = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, dynEnt[j].physPreset).physPreset;
|
||||
}
|
||||
}
|
||||
|
||||
@ -514,7 +521,7 @@ namespace Assets
|
||||
for (int i = 0; i < asset->numStaticModels; ++i)
|
||||
{
|
||||
Game::XModel* m = asset->staticModelList[i].xmodel;
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, m->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_XMODEL, m);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 2; ++j)
|
||||
@ -525,21 +532,21 @@ namespace Assets
|
||||
{
|
||||
if (def[i].xModel)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, def[i].xModel->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_XMODEL, def[i].xModel);
|
||||
}
|
||||
|
||||
if (def[i].destroyFx)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, def[i].destroyFx->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_FX, def[i].destroyFx);
|
||||
}
|
||||
|
||||
if (def[i].physPreset)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, def[i].physPreset->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_PHYSPRESET, def[i].physPreset);
|
||||
}
|
||||
}
|
||||
}
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MAP_ENTS, asset->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_MAP_ENTS, asset);
|
||||
}
|
||||
|
||||
void IclipMap_t::load(Game::XAssetHeader* /*header*/, std::string name, Components::ZoneBuilder::Zone* /*builder*/)
|
||||
|
@ -12,12 +12,12 @@ namespace Assets
|
||||
|
||||
if (alias->soundFile && alias->soundFile->type == Game::snd_alias_type_t::SAT_LOADED)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, alias->soundFile->data.loaded->name);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, alias->soundFile->data.loaded);
|
||||
}
|
||||
|
||||
if (alias->volumeFalloffCurve)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_SNDCURVE, alias->volumeFalloffCurve->filename);
|
||||
builder->markAsset(Game::XAssetType::ASSET_TYPE_SNDCURVE, alias->volumeFalloffCurve);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,7 +110,7 @@ namespace Assets
|
||||
{
|
||||
if (alias->soundFile->type == Game::snd_alias_type_t::SAT_LOADED)
|
||||
{
|
||||
destSoundFile->data.loaded = builder->requireAsset(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, alias->soundFile->data.loaded->name).loadSnd;
|
||||
destSoundFile->data.loaded = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, alias->soundFile->data.loaded).loadSnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -137,7 +137,7 @@ namespace Assets
|
||||
|
||||
if (alias->volumeFalloffCurve)
|
||||
{
|
||||
destAlias->volumeFalloffCurve = builder->requireAsset(Game::XAssetType::ASSET_TYPE_SNDCURVE, alias->volumeFalloffCurve->filename).sndCurve;
|
||||
destAlias->volumeFalloffCurve = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_SNDCURVE, alias->volumeFalloffCurve).sndCurve;
|
||||
}
|
||||
|
||||
if (alias->speakerMap)
|
||||
|
@ -160,10 +160,11 @@ namespace Components
|
||||
asset.type = type;
|
||||
asset.header = assetHeader;
|
||||
|
||||
// Handle script strings and referenced assets
|
||||
this->loadedAssets.push_back(asset);
|
||||
|
||||
// Handle script strings
|
||||
AssetHandler::ZoneMark(asset, this);
|
||||
|
||||
this->loadedAssets.push_back(asset);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -196,33 +197,95 @@ namespace Components
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t ZoneBuilder::Zone::getAssetOffset(int index)
|
||||
uint32_t ZoneBuilder::Zone::getAssetTableOffset(int index)
|
||||
{
|
||||
Utils::Stream::Offset offset;
|
||||
offset.block = Game::XFILE_BLOCK_VIRTUAL;
|
||||
offset.offset = (this->indexStart + (index * sizeof(Game::XAsset)) + 4);
|
||||
return offset.getPackedOffset();
|
||||
}
|
||||
/*
|
||||
void ZoneBuilder::Zone::pushAliasBase()
|
||||
{
|
||||
this->aliasBaseStack.push_back(this->buffer.getBlockSize(Game::XFILE_BLOCK_VIRTUAL));
|
||||
}
|
||||
|
||||
Game::XAssetHeader ZoneBuilder::Zone::requireAsset(Game::XAssetType type, const char* name)
|
||||
void ZoneBuilder::Zone::popAliasBase()
|
||||
{
|
||||
if (!this->aliasBaseStack.empty())
|
||||
{
|
||||
this->aliasBaseStack.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int ZoneBuilder::Zone::getAliasBase()
|
||||
{
|
||||
return this->aliasBaseStack.back();
|
||||
}
|
||||
*/
|
||||
|
||||
Game::XAssetHeader ZoneBuilder::Zone::saveSubAsset(Game::XAssetType type, void* ptr)
|
||||
{
|
||||
Game::XAssetHeader header;
|
||||
Utils::Stream::ClearPointer(&header.data);
|
||||
header.data = ptr;
|
||||
|
||||
int assetIndex = this->findAsset(type, name);
|
||||
|
||||
if (assetIndex != -1)
|
||||
int assetIndex = this->findAsset(type, Game::DB_GetXAssetNameHandlers[type](&header));
|
||||
if (assetIndex == -1) // nested asset
|
||||
{
|
||||
header.data = reinterpret_cast<void*>(this->getAssetOffset(assetIndex));
|
||||
const auto& cmp = header.data;
|
||||
|
||||
// already written. find alias and store in ptr
|
||||
if(std::find_if(this->savedAssets.begin(), this->savedAssets.end(), [&cmp] (const Game::XAssetHeader& s) { return cmp == s.data; } ) != this->savedAssets.end())
|
||||
{
|
||||
#ifdef DEBUG
|
||||
//Components::Logger::Print("Using alias for (%s): %s\n", Game::DB_GetXAssetTypeName(asset->type), Game::DB_GetXAssetName(asset));
|
||||
#endif
|
||||
Utils::Stream::Offset off;
|
||||
off.block = Game::XFILE_BLOCK_VIRTUAL;
|
||||
off.offset = this->getAlias(ptr);
|
||||
header.data = reinterpret_cast<void*>(off.getPackedOffset());
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
Components::Logger::Print("Saving Require (%s): %s\n", Game::DB_GetXAssetTypeName(type), Game::DB_GetXAssetNameHandlers[type](&header));
|
||||
#endif
|
||||
Game::XAsset assetToSave;
|
||||
assetToSave.header = header;
|
||||
assetToSave.type = type;
|
||||
|
||||
// we alias the next 4 (aligned) bytes of the stream b/c DB_InsertPointer gives us a nice pointer to use as the alias
|
||||
// otherwise it would be a fuckfest trying to figure out where the alias is in the stream
|
||||
this->buffer.align(Utils::Stream::ALIGN_4);
|
||||
this->storeAlias(ptr, this->buffer.getBlockSize(Game::XFILE_BLOCK_VIRTUAL));
|
||||
|
||||
this->buffer.increaseBlockSize(Game::XFILE_BLOCK_VIRTUAL, 4);
|
||||
|
||||
this->buffer.pushBlock(Game::XFILE_BLOCK_TEMP);
|
||||
AssetHandler::ZoneSave(assetToSave, this);
|
||||
this->buffer.popBlock();
|
||||
this->savedAssets.push_back(header);
|
||||
header.data = reinterpret_cast<void*>(-2); // DB_InsertPointer marker
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::Error("Missing required asset '%s' (%s). Export failed!", name, Game::DB_GetXAssetTypeName(type));
|
||||
// asset was written normally. not sure this is even possible but its here
|
||||
header.data = reinterpret_cast<void*>(this->getAssetTableOffset(assetIndex));
|
||||
}
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
void ZoneBuilder::Zone::markAsset(Game::XAssetType type, void* ptr)
|
||||
{
|
||||
Game::XAsset asset;
|
||||
asset.header.data = ptr;
|
||||
asset.type = type;
|
||||
|
||||
AssetHandler::ZoneMark(asset, this);
|
||||
}
|
||||
|
||||
void ZoneBuilder::Zone::writeZone()
|
||||
{
|
||||
FILETIME fileTime;
|
||||
@ -252,7 +315,7 @@ namespace Components
|
||||
Utils::IO::WriteFile(outFile, outBuffer);
|
||||
|
||||
Logger::Print("done.\n");
|
||||
Logger::Print("Zone '%s' written with %d assets\n", outFile.data(), this->loadedAssets.size());
|
||||
Logger::Print("Zone '%s' written with %d assets and %d script strings\n", outFile.data(), this->savedAssets.size(), this->scriptStrings.size());
|
||||
}
|
||||
|
||||
void ZoneBuilder::Zone::saveData()
|
||||
@ -277,7 +340,7 @@ namespace Components
|
||||
if (!this->scriptStrings.empty())
|
||||
{
|
||||
this->buffer.saveNull(4); // Empty script string?
|
||||
// This actually represents a NULL string, but as scriptString.
|
||||
// This actually represents a NULL string, but as scriptString.
|
||||
// So scriptString loading for NULL scriptStrings from fastfile results in a NULL scriptString.
|
||||
// That's the reason why the count is incremented by 1, if scriptStrings are available.
|
||||
|
||||
@ -312,16 +375,30 @@ namespace Components
|
||||
// Assets
|
||||
for (auto asset : this->loadedAssets)
|
||||
{
|
||||
/*
|
||||
const auto& cmp = asset.header.data;
|
||||
|
||||
if(std::find_if(this->savedAssets.begin(), this->savedAssets.end(), [&cmp] (const Game::XAsset& s) { return cmp == s.header.data; } ) != this->savedAssets.end())
|
||||
{
|
||||
#ifdef DEBUG
|
||||
Components::Logger::Print("Skipping (%s): %s\n", Game::DB_GetXAssetTypeName(asset.type), Game::DB_GetXAssetNameHandlers[type](header));
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
|
||||
this->buffer.pushBlock(Game::XFILE_BLOCK_TEMP);
|
||||
this->buffer.align(Utils::Stream::ALIGN_4);
|
||||
|
||||
#ifdef DEBUG
|
||||
Components::Logger::Print("Saving (%s): %s\n", Game::DB_GetXAssetTypeName(asset.type), Game::DB_GetXAssetName(&asset));
|
||||
Components::Logger::Print("Saving (%s): %s\n", Game::DB_GetXAssetTypeName(asset.type), Game::DB_GetXAssetNameHandlers[asset.type](&asset.header));
|
||||
#endif
|
||||
|
||||
this->store(asset.header);
|
||||
AssetHandler::ZoneSave(asset, this);
|
||||
|
||||
savedAssets.push_back(asset.header);
|
||||
|
||||
this->buffer.popBlock();
|
||||
}
|
||||
|
||||
@ -364,7 +441,7 @@ namespace Components
|
||||
}
|
||||
|
||||
// Get stored offset for given file pointer
|
||||
uint32_t ZoneBuilder::Zone::safeGetPointer(const void* pointer)
|
||||
unsigned int ZoneBuilder::Zone::safeGetPointer(const void* pointer)
|
||||
{
|
||||
if (this->hasPointer(pointer))
|
||||
{
|
||||
@ -379,6 +456,21 @@ namespace Components
|
||||
this->pointerMap[pointer] = this->buffer.getPackedOffset();
|
||||
}
|
||||
|
||||
void ZoneBuilder::Zone::storeAlias(const void* ptr, unsigned int alias)
|
||||
{
|
||||
this->aliasMap[ptr] = alias;
|
||||
}
|
||||
|
||||
unsigned int ZoneBuilder::Zone::getAlias(const void* ptr)
|
||||
{
|
||||
if((this->aliasMap.find(ptr) != this->aliasMap.end()))
|
||||
{
|
||||
return this->aliasMap[ptr];
|
||||
}
|
||||
Logger::Print("Warning: Missing Alias for pointer! Export will almost certainly fail!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZoneBuilder::Zone::addScriptString(std::string str)
|
||||
{
|
||||
return this->addScriptString(Game::SL_GetString(str.data(), 0));
|
||||
@ -525,7 +617,7 @@ namespace Components
|
||||
static_assert(Game::MAX_XFILE_COUNT == 8, "XFile block enum is invalid!");
|
||||
|
||||
ZoneBuilder::EndAssetTrace();
|
||||
|
||||
|
||||
if (ZoneBuilder::IsEnabled())
|
||||
{
|
||||
// Prevent loading textures (preserves loaddef)
|
||||
@ -537,7 +629,7 @@ namespace Components
|
||||
// Release the loaddef
|
||||
Game::DB_ReleaseXAssetHandlers[Game::XAssetType::ASSET_TYPE_IMAGE] = ZoneBuilder::ReleaseTexture;
|
||||
|
||||
//r_loadForrenderer = 0
|
||||
//r_loadForrenderer = 0
|
||||
Utils::Hook::Set<BYTE>(0x519DDF, 0);
|
||||
|
||||
//r_delayloadimage retn
|
||||
@ -611,9 +703,9 @@ namespace Components
|
||||
|
||||
Game::DB_LoadXAssets(&info, 1, true);
|
||||
AssetHandler::FindOriginalAsset(Game::XAssetType::ASSET_TYPE_RAWFILE, "default"); // Lock until zone is unloaded
|
||||
|
||||
|
||||
Logger::Print("Zone '%s' loaded with %d assets:\n", zone.data(), assets.size());
|
||||
|
||||
|
||||
int count = 0;
|
||||
for (auto i = assets.begin(); i != assets.end(); ++i, ++count)
|
||||
{
|
||||
|
@ -2,6 +2,9 @@
|
||||
#define XFILE_VERSION 276
|
||||
#define XFILE_VERSION_IW4X 0x78345749 // 'IW4x'
|
||||
|
||||
#define GET_ALIAS_OFFSET(_s, _m) offsetof((_s), (_m))
|
||||
#define GET_ALIAS_OFFSET_ARRAY(_s, _m, _loop) (offsetof((_s), (_m)) + (sizeof(_s) * (_loop)))
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class ZoneBuilder : public Component
|
||||
@ -20,15 +23,17 @@ namespace Components
|
||||
|
||||
bool hasPointer(const void* pointer);
|
||||
void storePointer(const void* pointer);
|
||||
void storePointer(const void* pointer, Utils::Stream::Offset offset);
|
||||
|
||||
template<typename T>
|
||||
inline T* getPointer(const T* pointer) { return reinterpret_cast<T*>(this->safeGetPointer(pointer)); }
|
||||
|
||||
int findAsset(Game::XAssetType type, std::string name);
|
||||
Game::XAsset* getAsset(int index);
|
||||
uint32_t getAssetOffset(int index);
|
||||
Game::XAssetHeader requireAsset(Game::XAssetType type, const char* name);
|
||||
uint32_t getAssetTableOffset(int index);
|
||||
Game::XAssetHeader saveSubAsset(Game::XAssetType type, void* ptr);
|
||||
bool loadAsset(Game::XAssetType type, std::string name);
|
||||
void markAsset(Game::XAssetType type, void* ptr);
|
||||
|
||||
int addScriptString(unsigned short gameIndex);
|
||||
int addScriptString(std::string str);
|
||||
@ -52,6 +57,9 @@ namespace Components
|
||||
void saveData();
|
||||
void writeZone();
|
||||
|
||||
unsigned int getAlias(const void* pointer);
|
||||
void storeAlias(const void* pointer, unsigned int alias);
|
||||
|
||||
void addBranding();
|
||||
|
||||
uint32_t safeGetPointer(const void* pointer);
|
||||
@ -66,10 +74,13 @@ namespace Components
|
||||
Utils::Memory::Allocator memAllocator;
|
||||
|
||||
std::vector<Game::XAsset> loadedAssets;
|
||||
std::vector<Game::XAssetHeader> savedAssets;
|
||||
std::vector<std::string> scriptStrings;
|
||||
std::map<unsigned short, unsigned int> scriptStringMap;
|
||||
std::map<std::string, std::string> renameMap[Game::XAssetType::ASSET_TYPE_COUNT];
|
||||
std::map<const void*, uint32_t> pointerMap;
|
||||
std::vector<uint32_t> aliasBaseStack;
|
||||
std::map<const void*, uint32_t> aliasMap;
|
||||
|
||||
Game::RawFile branding;
|
||||
};
|
||||
|
@ -63,7 +63,7 @@ namespace Utils
|
||||
{
|
||||
memset(this->blockSize, 0, sizeof(this->blockSize));
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef WRITE_LOGS
|
||||
this->structLevel = 0;
|
||||
Utils::IO::WriteFile("userraw/logs/zb_writes.log", "", false);
|
||||
#endif
|
||||
@ -235,7 +235,7 @@ namespace Utils
|
||||
this->blockSize[stream] += size;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef WRITE_LOGS
|
||||
std::string data = fmt::sprintf("%*s%d\n", this->structLevel, "", size);
|
||||
if(stream == Game::XFILE_BLOCK_RUNTIME) data = fmt::sprintf("%*s(%d)\n", this->structLevel, "", size);
|
||||
Utils::IO::WriteFile("userraw/logs/zb_writes.log", data, true);
|
||||
@ -321,7 +321,7 @@ namespace Utils
|
||||
return (this->criticalSectionState != 0);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef WRITE_LOGS
|
||||
void Stream::enterStruct(const char* structName)
|
||||
{
|
||||
if (this->structLevel >= 0)
|
||||
|
@ -1,5 +1,6 @@
|
||||
// write logs for ZoneBuilder
|
||||
#ifndef DEBUG
|
||||
//#define WRITE_LOGS
|
||||
#ifndef WRITE_LOGS // they take forever to run so only enable if needed
|
||||
#define SaveLogEnter(x)
|
||||
#define SaveLogExit()
|
||||
#else
|
||||
@ -131,7 +132,7 @@ namespace Utils
|
||||
bool isCriticalSection();
|
||||
|
||||
// for recording zb writes
|
||||
#ifdef DEBUG
|
||||
#ifdef WRITE_LOGS
|
||||
int structLevel;
|
||||
void enterStruct(const char* structName);
|
||||
void leaveStruct();
|
||||
|
Loading…
Reference in New Issue
Block a user