diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 83b84f2c5..6eb8e72ac 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -156,14 +156,15 @@ class Debugger : public DialogContainer */ TIADebug& tiaDebug() const { return *myTiaDebug; } - const GUI::Font& lfont() const { return myDialog->lfont(); } - const GUI::Font& nlfont() const { return myDialog->nfont(); } - DebuggerParser& parser() const { return *myParser; } - PackedBitArray& breakpoints() const { return *myBreakPoints; } - PackedBitArray& readtraps() const { return *myReadTraps; } - PackedBitArray& writetraps() const { return *myWriteTraps; } - PromptWidget& prompt() const { return myDialog->prompt(); } - RomWidget& rom() const { return myDialog->rom(); } + const GUI::Font& lfont() const { return myDialog->lfont(); } + const GUI::Font& nlfont() const { return myDialog->nfont(); } + DebuggerParser& parser() const { return *myParser; } + PackedBitArray& breakpoints() const { return *myBreakPoints; } + PackedBitArray& readtraps() const { return *myReadTraps; } + PackedBitArray& writetraps() const { return *myWriteTraps; } + PromptWidget& prompt() const { return myDialog->prompt(); } + RomWidget& rom() const { return myDialog->rom(); } + TiaOutputWidget& tiaOutput() const { return myDialog->tiaOutput(); } /** Run the debugger command and return the result. diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 031e73e49..347873afc 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -26,6 +26,7 @@ #include "CpuDebug.hxx" #include "RiotDebug.hxx" #include "TIADebug.hxx" +#include "TiaOutputWidget.hxx" #include "DebuggerParser.hxx" #include "YaccParser.hxx" #include "M6502.hxx" @@ -1432,12 +1433,7 @@ void DebuggerParser::executeSaveses() // "savesnap" void DebuggerParser::executeSavesnap() { - // FIXME - for now, temporarily enable 1x snapshot mode, and reset it - // afterwards; this will change once we move to FBSurfaces - bool ss1x = settings.getBool("ss1x"); - settings.setValue("ss1x", true); - debugger.myOSystem->eventHandler().takeSnapshot(); - settings.setValue("ss1x", ss1x); + debugger.tiaOutput().saveSnapshot(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx index e5fd8db24..6a386599d 100644 --- a/src/debugger/gui/TiaOutputWidget.cxx +++ b/src/debugger/gui/TiaOutputWidget.cxx @@ -66,6 +66,27 @@ void TiaOutputWidget::loadConfig() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaOutputWidget::saveSnapshot() { + int number = instance().getTicks() / 1000; + ostringstream sspath; + sspath << instance().snapshotSaveDir() + << instance().console().properties().get(Cartridge_Name) + << "_dbg_" << hex << setw(8) << setfill('0') << number << ".png"; + + const uInt32 width = instance().console().tia().width(), + height = instance().console().tia().height(); + FBSurface& s = dialog().surface(); + + GUI::Rect rect(_x, _y, _x + width*2, _y + height); + string message = "Snapshot saved"; + try + { + instance().png().saveImage(sspath.str(), s, rect); + } + catch(const char* msg) + { + message = msg; + } + instance().frameBuffer().showMessage(message); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -