-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathromdecoderascii.cpp
More file actions
38 lines (30 loc) · 881 Bytes
/
Copy pathromdecoderascii.cpp
File metadata and controls
38 lines (30 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<QDebug>
#include<QFile>
#include "romdecoderascii.h"
RomDecoderAscii::RomDecoderAscii(){}
//This returns a text preview.
QString RomDecoderAscii::preview(MaskRomTool *m){
QString ascii="";
RomBitItem* rowbit = m->markBitTable();
//Prints all bits in the row.
while(rowbit){
RomBitItem* bit=rowbit;
while(bit){
ascii.append(bit->bitValue()?"1":"0");
bit=bit->nexttoright; //Skip down the row.
}
ascii.append("\n");
rowbit=rowbit->nextrow; //Skip to the next row.
}
return ascii;
}
//Exports the preview to a file.
void RomDecoderAscii::writeFile(MaskRomTool *m, QString filename){
QFile fout(filename);
if(!fout.open(QIODevice::WriteOnly)){
qDebug()<<"Unable to write"<<filename;
return;
}
fout.write(preview(m).toUtf8());
fout.close();
}