Skip to content

Commit

Permalink
GatoROM solve set now uses descriptive filenames in --solve-set. #94
Browse files Browse the repository at this point in the history
  • Loading branch information
travisgoodspeed committed Jul 20, 2024
1 parent 72ec62b commit 6b23da6
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ is a Zilog Z8 ROM from a music synthesize module.

## Release Changelog

`master` -- Gatorom's solver-set option now uses descriptive
fiilenames.

2024-07-14 -- Fixes crash when deleting a double-selected item. Delete
and backspace now delete objects like `D`. Multiple disassemblers.
Decodings are now updated as decoding thresholds are changed.
Expand Down
8 changes: 4 additions & 4 deletions gatomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,18 +426,18 @@ int main(int argc, char *argv[]) {
GatoSolver solver(gr, grader);
for(solver.init(); !solver.finished(); solver.next()){
int state=solver.state;
QString statestring=QString::asprintf("%04x", state);
//QString statestring=QString::asprintf("%04x", state); //Older behavior, with hash.
QString statestring=gr->descriptiveFilename();

//We aren't interested in zero scores or empty results.
if(solver.grade()>0 && gr->preview().length()>0){
std::cout<<solver.grade()<<" \t"
<<statestring.toStdString()<<"\t"
<<gr->preview().toStdString()<<"\t"
<<gr->description().toStdString()<<"\n";
<<parser.value(solvesetOption).toStdString()<<statestring.toStdString()<<".bin\n";
//All outputs go when we're dumping the set.
if(parser.isSet(solvesetOption)){

QFile outfile(parser.value(solvesetOption)+"-"+statestring+".bin");
QFile outfile(parser.value(solvesetOption)+statestring+".bin");
outfile.open(QIODevice::WriteOnly);
outfile.write(gr->decoded);
outfile.close();
Expand Down
28 changes: 28 additions & 0 deletions gatorom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,34 @@ QString GatoROM::description(){
return d;
}

//Returns an English description of the current ROM state as a filename.
QString GatoROM::descriptiveFilename(){
QString d="";

if(wordsize!=8)
d.append("-word"+QString::number(wordsize));

if(zorrommode)
d.append("-z");
if(decoder)
d.append("-"+decoder->name);
if(inverted)
d.append("-i");
d.append("-r"+QString::number(angle));
if(flippedx)
d.append("-flipx");
if(flippedy)
d.append("-flipy");

//Cuts the image in half. Needed for MC6801U4.
if(bank==1)
d.append("-leftbank");
if(bank==2)
d.append("-rightbank");

return d;
}

//Loads from the same description.
void GatoROM::configFromDescription(QString d){
//Forgive me for using a shotgun parser here.
Expand Down
3 changes: 3 additions & 0 deletions gatorom.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class GatoROM{
QString description();
//Loads from the same description.
void configFromDescription(QString description);
//Returns an English description of the current ROM state as a filename.
QString descriptiveFilename();


//Returns the first eight bytes as a preview.
QString preview();
Expand Down

0 comments on commit 6b23da6

Please sign in to comment.