-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathromdecoderascii.cpp
More file actions
34 lines (26 loc) · 789 Bytes
/
romdecoderascii.cpp
File metadata and controls
34 lines (26 loc) · 789 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
#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);
fout.open(QIODevice::WriteOnly);
fout.write(preview(m).toUtf8());
}