From 317603709ebcaedaf0aa39472ec57ca8f6c3c62e Mon Sep 17 00:00:00 2001 From: Braiden Gent Date: Mon, 15 Apr 2024 04:25:40 -0700 Subject: [PATCH] better debugging --- src/gameboy.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gameboy.cpp b/src/gameboy.cpp index 164206c..d900dfa 100644 --- a/src/gameboy.cpp +++ b/src/gameboy.cpp @@ -54,6 +54,7 @@ void GameBoy::start(const std::string& bootrom, const std::string& game) { bool quit = false; bool setIME = false; bool debug = false; + bool step = false; while (!quit) { // Event loop @@ -89,7 +90,10 @@ void GameBoy::start(const std::string& bootrom, const std::string& game) { joypadInput.START = true; break; case SDLK_h: - debug = true; + debug = !debug; + break; + case SDLK_n: + step = true; break; default: break; @@ -121,9 +125,6 @@ void GameBoy::start(const std::string& bootrom, const std::string& game) { case SDLK_p: joypadInput.START = false; break; - case SDLK_h: - debug = false; - break; default: break; } @@ -134,6 +135,9 @@ void GameBoy::start(const std::string& bootrom, const std::string& game) { } while (!rendered) { + if (debug == true && step == false) + break; + step = false; joypadHandler(); if (PC > 0xFF && addressSpace.getBootromState()) { addressSpace.unmapBootrom();