zeta0134 / LuaGB

A gameboy emulator written in pure Lua. Work in progress.
BSD 3-Clause "New" or "Revised" License
411 stars 35 forks source link

Explicitly pass Gameboy references into debug panels #19

Closed zeta0134 closed 5 years ago

zeta0134 commented 5 years ago

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.