BonneCW / GD3D11

D3D11-Renderer for Gothic and Gothic 2
GNU General Public License v3.0
25 stars 4 forks source link

Models get invisible sometimes #8

Open BonneCW opened 6 years ago

kirides commented 4 years ago

Stacktrace of the player becoming invisible:

Error: [A:\Dev\GD3D11\D3D11Engine\GothicAPI.cpp(1086), void __thiscall GothicAPI::OnVisualDeleted(class zCVisual *)]: Player visual was removed! 26_12_2019_11_21_51
STACK: A:\Dev\GD3D11\D3D11Engine\StackWalker.cpp (921): StackWalker::ShowCallstack
STACK: A:\Dev\GD3D11\D3D11Engine\GothicAPI.cpp (1087): GothicAPI::OnVisualDeleted
STACK: A:\Dev\GD3D11\D3D11Engine\zCVisual.h (30): zCVisual::Hooked_Destructor
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 00577F5B)
STACK: P:\dev\g2addon\release\ZenGin\_dieter\zModel.cpp (1265): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 00576728)
STACK: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00576728)
STACK: 00576728 (Gothic2): (filename not available): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 00602549)
STACK: P:\dev\g2addon\release\ZenGin\_dieter\zVob.cpp (1946): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 0072E3FD)
STACK: P:\dev\g2addon\release\Gothic\_ulf\oNpc.cpp (1476): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 0076178A)
STACK: ..\\ZenGin\_dieter\zSparseArray.h (340): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 0072E8BE)
STACK: P:\dev\g2addon\release\Gothic\_ulf\oNpc.cpp (1559): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 0072E3A8)
STACK: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 0072E3A8)
STACK: 0072E3A8 (Gothic2): (filename not available): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 0040C325)
STACK: ..\\ZenGin\_dieter\zObject.h (290): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 00780B94)
STACK: P:\dev\g2addon\release\Gothic\_ulf\oWorld.cpp (724): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 007802FF)
STACK: P:\dev\g2addon\release\Gothic\_ulf\oWorld.cpp (479): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 00778515)
STACK: P:\dev\g2addon\release\Gothic\_ulf\oSpawn.cpp (306): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 006C87FB)
STACK: P:\dev\g2addon\release\Gothic\_ulf\oGame.cpp (2664): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 00425E6E)
STACK: P:\dev\g2addon\release\Gothic\_bert\oGameManager.cpp (767): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 0078188B)
STACK: P:\dev\g2addon\release\Gothic\_ulf\Phoenix.cpp (111): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 00503270)
STACK: P:\dev\g2addon\release\ZenGin\_carsten\zWin32.cpp (1169): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 00502DFD)
STACK: P:\dev\g2addon\release\ZenGin\_carsten\zWin32.cpp (1054): (function-name not available)
STACK: ERROR: SymGetSymFromAddr64, GetLastError: 487 (Address: 007D43F8)
STACK: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 007D43F8)
STACK: 007D43F8 (Gothic2): (filename not available): (function-name not available)
STACK: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 755A6359)
STACK: 755A6359 (KERNEL32): (filename not available): BaseThreadInitThunk
STACK: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 77547B74)
STACK: 77547B74 (ntdll): (filename not available): RtlGetAppContainerNamedObjectPath
STACK: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 77547B44)
STACK: 77547B44 (ntdll): (filename not available): RtlGetAppContainerNamedObjectPath

A little more humanized (from IDA)

GothicAPI::OnVisualDeleted
zCVisual::Hooked_Destructor

_DWORD __thiscall zCModel::~zCModel(zCModel *__hidden this)
void *__thiscall zCModel::`scalar deleting destructor'(zCModel *this, char)
void __thiscall zCVob::SetVisual(zCVob *this, struct zCVisual *)
void __thiscall oCNpc::SetVisual(oCNpc *this, struct zCVisual *)
public: void __thiscall zCCacheData<class oCNpc const *, class oCShrinkHelper>::Clear(void)
_DWORD __thiscall oCNpc::~oCNpc(oCNpc *this)
void *__thiscall oCNpc::`scalar deleting destructor'(oCNpc *this, char)
int __thiscall zCObject::Release(zCObject *__hidden this)
void __fastcall oCWorld::RemoveFromLists(oCWorld *__hidden this, struct zCVob *)
void __thiscall oCWorld::RemoveVob(oCWorld *this, struct zCVob *)
void __thiscall oCSpawnManager::CheckInsertNpc(oCSpawnManager *this)
void __thiscall oCGame::Render(oCGame *this)
kirides commented 4 years ago

I implemented a very rudimentary work-around for this in Kirides/GD3D11@ed6004a8 by intoducing _canClearVobsByVisual in GothicAPI.

it seems like the games Cache-Manager invalidates some cached models/visuals but we are removing the VOBs aswell.

Currently my fork only clears that while loading a save or entering a different world.