Skip to content

Commit

Permalink
Fixes permission problem in the CLI from queued event processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
travisgoodspeed committed Jul 27, 2024
1 parent f29c67d commit 9e16279
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 9 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "romdecoderphotograph.h"
#include "romdecoderhistogram.h"
#include "romencoderdiff.h"
#include "romscene.h"

#include <QApplication>
#include <QLocale>
Expand Down Expand Up @@ -150,6 +151,7 @@ int main(int argc, char *argv[]){
mrt.show();
for(int i=0; i<args.count(); i++)
mrt.fileOpen(args[i]);
a.processEvents();

//Chooses the sampling algorithm.
if(parser.isSet(samplerOption)){
Expand All @@ -174,14 +176,13 @@ int main(int argc, char *argv[]){
qDebug()<<"Exporting ROM";
RomDecoderGato exporter;
exporter.writeFile(&mrt, parser.value(rombytesExportOption));

a.processEvents();
}
//Export histogram bytes.
if(parser.isSet(histogramExportOption)){
qDebug()<<"Exporting Histogram";
RomDecoderHistogram exporter;
exporter.writeFile(&mrt, parser.value(histogramExportOption));

}

//Export to CSV.
Expand Down Expand Up @@ -215,14 +216,18 @@ int main(int argc, char *argv[]){
for(int i=0; i<10; i++){
qDebug()<<"Round"<<i;
mrt.markBits();
a.processEvents();
}
}

//We don't return a failure code yet, but will if it comes to that.
if(parser.isSet(DRCOption))
if(parser.isSet(DRCOption)){
mrt.runDRC(true);
else if(parser.isSet(drcOption))
a.processEvents();
}else if(parser.isSet(drcOption)){
mrt.runDRC(false);
a.processEvents();
}

//We let the GUI take hold unless asked to do otherwise.
if(!parser.isSet(exitOption)){
Expand Down
8 changes: 5 additions & 3 deletions maskromtool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1559,14 +1559,16 @@ void MaskRomTool::markBits(){

//Mark up all of the bits where rows and columns collide.
void MaskRomTool::clearBits(){
/* FIXME: The performance of this function absolutely
* sucks. It takes a lot longer than the rest of the
* bit marking process.
/* FIXME: This leaves behind some unhandled events. If calling
* this from the CLI, be sure to call QApplication.processEvents()
* to clear them or processing will become progressively slower
* as the count rises.
*/
foreach (QGraphicsItem* item, bits){
scene->removeItem(item);
delete item;
}

bits.clear();
assert(bits.isEmpty());
bitcount=0;
Expand Down

0 comments on commit 9e16279

Please sign in to comment.