[IclipMap_t] Store pointers for other structs as well. Should fix other collision related crashes

This commit is contained in:
TheApadayo 2016-12-23 22:38:24 -05:00
parent d075617328
commit fb8f618ddc
2 changed files with 17 additions and 7 deletions

View File

@ -32,9 +32,13 @@ namespace Assets
else else
{ {
buffer->align(Utils::Stream::ALIGN_4); buffer->align(Utils::Stream::ALIGN_4);
builder->storePointer(asset->cPlanes);
buffer->saveArray(asset->cPlanes, asset->numCPlanes); // not sure if this is neede but both brushside and brushedge need it and it can't hurt
for(int i = 0; i < asset->numCPlanes; i++)
{
builder->storePointer(&asset->cPlanes[i]);
buffer->save(&asset->cPlanes[i]);
}
Utils::Stream::ClearPointer(&dest->cPlanes); Utils::Stream::ClearPointer(&dest->cPlanes);
} }
@ -127,7 +131,11 @@ namespace Assets
SaveLogEnter("cBrushEdge"); SaveLogEnter("cBrushEdge");
// no align for char // no align for char
buffer->saveArray(asset->cBrushEdges, asset->numCBrushEdges); for(int i = 0; i < asset->numCBrushEdges; ++i)
{
builder->storePointer(&asset->cBrushEdges[i]); // for reference in cBrush
buffer->save(&asset->cBrushEdges[i]);
}
Utils::Stream::ClearPointer(&dest->cBrushEdges); Utils::Stream::ClearPointer(&dest->cBrushEdges);
SaveLogExit(); SaveLogExit();

View File

@ -144,7 +144,7 @@ namespace Components
bool Zones::LoadXSurfaceArray(bool atStreamStart, char* buffer, int size) bool Zones::LoadXSurfaceArray(bool atStreamStart, char* buffer, int size)
{ {
int count = 0; int count = 0;
if (Zones::Version() >= VERSION_ALPHA2) if (Zones::Version() >= VERSION_ALPHA2)
{ {
size >>= 6; size >>= 6;
@ -578,7 +578,7 @@ namespace Components
*Game::varFxEffectDefHandle = reinterpret_cast<Game::FxEffectDef**>(varWeaponCompleteDef + 2308); *Game::varFxEffectDefHandle = reinterpret_cast<Game::FxEffectDef**>(varWeaponCompleteDef + 2308);
Game::Load_FxEffectDefHandle(false); Game::Load_FxEffectDefHandle(false);
*Game::varFxEffectDefHandle = reinterpret_cast<Game::FxEffectDef**>(varWeaponCompleteDef + 2336); *Game::varFxEffectDefHandle = reinterpret_cast<Game::FxEffectDef**>(varWeaponCompleteDef + 2336);
Game::Load_FxEffectDefHandle(false); Game::Load_FxEffectDefHandle(false);
} }
else else
@ -612,7 +612,7 @@ namespace Components
if (Zones::ZoneVersion >= 359) if (Zones::ZoneVersion >= 359)
{ {
if (*reinterpret_cast<DWORD*>(varWeaponCompleteDef + 2524) == -1) if (*reinterpret_cast<DWORD*>(varWeaponCompleteDef + 2524) == -1)
{ {
void* vec2 = Game::DB_AllocStreamPos(3); void* vec2 = Game::DB_AllocStreamPos(3);
*reinterpret_cast<void**>(varWeaponCompleteDef + 2524) = vec2; *reinterpret_cast<void**>(varWeaponCompleteDef + 2524) = vec2;
@ -1533,7 +1533,7 @@ namespace Components
popad popad
push 4189AEh push 4189AEh
retn retn
returnSafe: returnSafe:
popad popad
push 41899Dh push 41899Dh
@ -1645,6 +1645,8 @@ namespace Components
#ifdef DEBUG #ifdef DEBUG
// Easy dirty disk debugging // Easy dirty disk debugging
Utils::Hook::Set<WORD>(0x4CF7F0, 0xC3CC); Utils::Hook::Set<WORD>(0x4CF7F0, 0xC3CC);
// disable _invoke_watson to allow debugging
Utils::Hook::Set<WORD>(0x6B9602,0xCCCC);
#endif #endif
} }