mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-27 01:20:28 +03:00
Early versions of System4 (Sys42VM.dll < 3.0) execute destructors for global variables on exit. Dungeons & Dolls saves its game state in the destructors of global variables (~CDataDoll(), ~CDataItem(), ~CDataMain()), so the game was not saved in xsystem4 before this. This behavior has some quirks: * Destructors for variables on the call stack are not called on exit. * Destructors are called in the reverse order of the global variable declarations. * Inside a destructor, it is possible to access another global variable whose destructor has already been called (!). Since this is a problematic behavior that was removed in later versions of Sys42VM, let's add minimal support for it as a game-specific hack.