added alternative debugger snapshot naming option

This commit is contained in:
Thomas Jentzsch 2022-08-21 12:49:13 +02:00
parent df8c7a6ff6
commit faf7e8b775
3 changed files with 37 additions and 8 deletions

View File

@ -2063,7 +2063,7 @@ void DebuggerParser::executeSaveSes()
// "saveSnap"
void DebuggerParser::executeSaveSnap()
{
debugger.tiaOutput().saveSnapshot(execDepth, execPrefix);
debugger.tiaOutput().saveSnapshot(execDepth, execPrefix, argCount == 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -63,7 +63,8 @@ void TiaOutputWidget::loadConfig()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix,
bool mark)
{
#ifdef IMAGE_SUPPORT
if(execDepth > 0)
@ -72,12 +73,39 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
ostringstream sspath;
sspath << instance().snapshotSaveDir()
<< instance().console().properties().get(PropType::Cart_Name);
sspath << "_dbg_";
if (execDepth > 0 && !execPrefix.empty()) {
sspath << execPrefix << "_";
if(mark)
{
sspath << "_dbg_";
if(execDepth > 0 && !execPrefix.empty()) {
sspath << execPrefix << "_";
}
sspath << std::hex << std::setw(8) << std::setfill('0')
<< static_cast<uInt32>(TimerManager::getTicks() / 1000);
}
sspath << std::hex << std::setw(8) << std::setfill('0')
<< static_cast<uInt32>(TimerManager::getTicks()/1000) << ".png";
else
{
// Determine if the file already exists, checking each successive filename
// until one doesn't exist
FSNode node(sspath.str() + ".png");
if(node.exists())
{
ostringstream suffix;
ostringstream buf;
for(uInt32 i = 1; ; ++i)
{
buf.str("");
suffix.str("");
suffix << "_" << i;
buf << sspath.str() << suffix.str() << ".png";
FSNode next(buf.str());
if(!next.exists())
break;
}
sspath << suffix.str();
}
}
sspath << ".png";
const uInt32 width = instance().console().tia().width(),
height = instance().console().tia().height();

View File

@ -36,7 +36,8 @@ class TiaOutputWidget : public Widget, public CommandSender
void loadConfig() override;
void setZoomWidget(TiaZoomWidget* w) { myZoom = w; }
void saveSnapshot(int execDepth = 0, const string& execPrefix = "");
void saveSnapshot(int execDepth = 0, const string& execPrefix = EmptyString,
bool mark = true);
// Eventually, these methods will enable access to the onscreen TIA image
// For example, clicking an area may cause an action