YaLTeR / bxt-rs

Fastest video recording and TAS tools for Half-Life & mods.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pointers are not always reset

YaLTeR opened this issue · comments

Pointers are reset in Host_Shutdown(), however there's a code path in the engine that calls Memory_Init() and then exits out with an error without ever calling Host_Shutdown()—particularly, when it fails setting the OpenGL video mode and displays an error dialog with a button to restart in Software (specifically, this is not due to GL_SetMode() failing, because that happens before Memory_Init()). When this happens, pointers are not reset, which means that when sw.dll loads, all pointers that aren't found in it are kept as stale, invalid values. bxt-rs then crashes when trying to hook them.

To fix this, we need to figure out how this early exit can happen and reset pointers there too.