The debug panels were using an awkward pattern where the gameboy reference was passed in during init, and then utilized during the draw routines. Since the gameboy reference isn't permanent, the debug panels can outlive them (when a new game is loaded) and this can lead to stale reference issues. Instead, we pass debug panels the active gameboy during their draw and update routines. Much cleaner!
Also included is a minor fix: audio debug data is now written all the time. I figure this is cheap enough that the complexity of exposing and managing a "debug mode" flag wasn't worth any minuscule performance gain. Now audio debugging continues to work properly through game loads, even if the panel is already open.
The debug panels were using an awkward pattern where the gameboy reference was passed in during init, and then utilized during the draw routines. Since the gameboy reference isn't permanent, the debug panels can outlive them (when a new game is loaded) and this can lead to stale reference issues. Instead, we pass debug panels the active gameboy during their draw and update routines. Much cleaner!
Also included is a minor fix: audio debug data is now written all the time. I figure this is cheap enough that the complexity of exposing and managing a "debug mode" flag wasn't worth any minuscule performance gain. Now audio debugging continues to work properly through game loads, even if the panel is already open.