Handmade Hero»Forums»Code
Jim R. Didriksen
63 posts
Request: Add an Assert or similar If loading function DebugGameFrameEnd from the DLL fails and HANDMADE_INTERNAL=1.
Edited by Jim R. Didriksen on
The code doesn't enter an official fail-state/Assert if HANDMADE_INTERNAL is on but loading of DEBUGGameFrameEnd fails inside Win32LoadGameCode.

The game will accumulating a Debug information but since the DEBUGFrameEnd function pointer is not set it won't collate any so it fills the GlobalDebugTable and crashes after about 2-3 seconds.

TL:DR; If HANDMADE_INTERNAL=1 , but Win32LoadGameCode fails to Load DEBUGGameFrameEnd the game will crash in a few seconds mostly siting the use of a null pointer in the debug_event destructor.

I notice this after I had changed the name of DEBUGGameFrameEnd in the build.bat and the .._debug.cpp to make it consistent with the name of the game_code variable it gets assigned to. ("Luckily" I changed the name before taking a month break from following the series so I had forgotten and the crash baffled me for too many hours.)


fix ex.

Adding Result.DEBUGFrameEnd to the Result.IsValid "calculation" if HANDMADE_INTERNAL=1.

or by adding this to line 2369 in win32_handmade.cpp

1
 else { Assert(!"DEBUGGameFrameEnd not loaded"); } 


so we'll assert instead of just skip the FrameEnd function call (this is inside a #if HANDMADE_INTERNAL already.)


Clarification: I write out all the code as I follow the series, only checking the official Handmade code if I notice inconsistencies.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Request: Add an Assert or similar If loading function DebugGameFrameEnd from the DLL fails and HANDMADE_INTERNAL=1.
Can you file an issue ticket for this on the GitHub? That way it'll definitely get fixed.

- Casey
Jim R. Didriksen
63 posts
Request: Add an Assert or similar If loading function DebugGameFrameEnd from the DLL fails and HANDMADE_INTERNAL=1.
Done, wasn't sure if saving me from myself warranted a GitHub Issue report.


https://github.com/HandmadeHero/cpp/issues/28