@@ -633,9 +633,37 @@ bool DX8Wrapper::Reset_Device(bool reload_assets)
633633 memset (Vertex_Shader_Constants, 0 , sizeof (Vector4) * MAX_VERTEX_SHADER_CONSTANTS );
634634 memset (Pixel_Shader_Constants, 0 , sizeof (Vector4) * MAX_PIXEL_SHADER_CONSTANTS );
635635
636+ // TheSuperHackers @bugfix Tin Tin Hamans - Release all surface references before Reset().
637+ // D3D8 requires that no non-managed surfaces (render targets, depth buffers) have outstanding
638+ // references when Reset() is called. Failing to do so causes a crash inside the Intel integrated
639+ // graphics driver (igd9trinity32.dll) during DestroyResource inside CSwapChain::Reset.
640+ if (DefaultRenderTarget != nullptr )
641+ {
642+ DefaultRenderTarget->Release ();
643+ DefaultRenderTarget = nullptr ;
644+ }
645+ if (DefaultDepthBuffer != nullptr )
646+ {
647+ DefaultDepthBuffer->Release ();
648+ DefaultDepthBuffer = nullptr ;
649+ }
650+ if (CurrentRenderTarget != nullptr )
651+ {
652+ CurrentRenderTarget->Release ();
653+ CurrentRenderTarget = nullptr ;
654+ }
655+ if (CurrentDepthBuffer != nullptr )
656+ {
657+ CurrentDepthBuffer->Release ();
658+ CurrentDepthBuffer = nullptr ;
659+ }
660+
636661 HRESULT hr = _Get_D3D_Device8 ()->TestCooperativeLevel ();
637662 if (hr != D3DERR_DEVICELOST )
638663 {
664+ // TheSuperHackers @bugfix xezon 13/06/2025 Front load the system dbghelp.dll to prevent
665+ // the graphics driver from potentially loading the old game dbghelp.dll and then crashing the game process.
666+ DbgHelpGuard dbgHelpGuard;
639667 DX8CALL_HRES (Reset (&_PresentParameters), hr)
640668 if (hr != D3D_OK )
641669 return false ; // reset failed.
0 commit comments