mirror of https://github.com/stella-emu/stella.git
Add an 'exec'-prefix to snapshot name when saving from a script.
Allow the user to specify an additional 'prefix' string in the exec command that will be prepended the ticks-part of the snapshot name when saving a snapshot from script.
This commit is contained in:
parent
7010400235
commit
0ecb4f5ae7
|
@ -59,7 +59,8 @@ DebuggerParser::DebuggerParser(Debugger& d, Settings& s)
|
|||
: debugger(d),
|
||||
settings(s),
|
||||
argCount(0),
|
||||
execDepth(0)
|
||||
execDepth(0),
|
||||
execPrefix("")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1063,11 +1064,19 @@ void DebuggerParser::executeExec()
|
|||
string file = argStrings[0];
|
||||
if(file.find_last_of('.') == string::npos)
|
||||
file += ".script";
|
||||
|
||||
FilesystemNode node(file);
|
||||
if (!node.exists()) {
|
||||
node = FilesystemNode(debugger.myOSystem.defaultSaveDir() + file);
|
||||
}
|
||||
|
||||
if (argCount == 2) {
|
||||
execPrefix = argStrings[1];
|
||||
}
|
||||
else {
|
||||
ostringstream prefix;
|
||||
prefix << std::hex << std::setw(8) << std::setfill('0') << (debugger.myOSystem.getTicks()/1000 & 0xffffffff);
|
||||
execPrefix = prefix.str();
|
||||
}
|
||||
execDepth++;
|
||||
commandResult << exec(node);
|
||||
execDepth--;
|
||||
|
@ -1711,7 +1720,7 @@ void DebuggerParser::executeSaveses()
|
|||
// "savesnap"
|
||||
void DebuggerParser::executeSavesnap()
|
||||
{
|
||||
debugger.tiaOutput().saveSnapshot(execDepth);
|
||||
debugger.tiaOutput().saveSnapshot(execDepth, execPrefix);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -2389,11 +2398,11 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
|
|||
|
||||
{
|
||||
"exec",
|
||||
"Execute script file <xx>",
|
||||
"Execute script file <xx> [prefix]",
|
||||
"Example: exec script.dat, exec auto.txt",
|
||||
true,
|
||||
true,
|
||||
{ kARG_FILE, kARG_END_ARGS },
|
||||
{ kARG_FILE, kARG_LABEL, kARG_MULTI_BYTE },
|
||||
std::mem_fn(&DebuggerParser::executeExec)
|
||||
},
|
||||
|
||||
|
|
|
@ -124,6 +124,7 @@ class DebuggerParser
|
|||
uInt32 argCount;
|
||||
|
||||
uInt32 execDepth;
|
||||
string execPrefix;
|
||||
|
||||
StringList myWatches;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ void TiaOutputWidget::loadConfig()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TiaOutputWidget::saveSnapshot(int execDepth)
|
||||
void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
|
||||
{
|
||||
if (execDepth > 0) {
|
||||
drawWidget(false);
|
||||
|
@ -66,8 +66,12 @@ void TiaOutputWidget::saveSnapshot(int execDepth)
|
|||
int number = int(instance().getTicks() / 1000);
|
||||
ostringstream sspath;
|
||||
sspath << instance().snapshotSaveDir()
|
||||
<< instance().console().properties().get(Cartridge_Name)
|
||||
<< "_dbg_" << std::hex << std::setw(8) << std::setfill('0') << number << ".png";
|
||||
<< instance().console().properties().get(Cartridge_Name);
|
||||
sspath << "_dbg_";
|
||||
if (execDepth > 0 && !execPrefix.empty()) {
|
||||
sspath << execPrefix << "_";
|
||||
}
|
||||
sspath << std::hex << std::setw(8) << std::setfill('0') << (number/1000 & 0xffffffff) << ".png";
|
||||
|
||||
const uInt32 width = instance().console().tia().width(),
|
||||
height = instance().console().tia().height();
|
||||
|
|
|
@ -36,8 +36,8 @@ class TiaOutputWidget : public Widget, public CommandSender
|
|||
void loadConfig() override;
|
||||
void setZoomWidget(TiaZoomWidget* w) { myZoom = w; }
|
||||
|
||||
void saveSnapshot() { saveSnapshot(0); };
|
||||
void saveSnapshot(int execDepth);
|
||||
void saveSnapshot() { saveSnapshot(0, ""); };
|
||||
void saveSnapshot(int execDepth, const string& execPrefix);
|
||||
|
||||
// Eventually, these methods will enable access to the onscreen TIA image
|
||||
// For example, clicking an area may cause an action
|
||||
|
|
Loading…
Reference in New Issue