forked from travisgoodspeed/maskromtool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathromdecodergato.cpp
49 lines (41 loc) · 1.37 KB
/
romdecodergato.cpp
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
39
40
41
42
43
44
45
46
47
48
49
#include "romdecodergato.h"
#include "maskromtool.h"
#include "romdecoderascii.h"
#include "gatorom.h"
RomDecoderGato::RomDecoderGato(){}
//Returns a GatoROM structure of the bits.
GatoROM RomDecoderGato::gatorom(MaskRomTool *mrt){
//FIXME: This works well enough to print, but doesn't return links to MRT objects.
RomDecoderAscii exporter;
QString ascii=exporter.preview(mrt);
//We rebuild from the preserved class
mrt->gr.loadFromString(ascii);
RomBitItem* rowbit = mrt->markBitTable();
unsigned int row=0, col=0;
//Prints all bits in the row.
while(rowbit){
RomBitItem* bit=rowbit;
while(bit){
/* Update the input bit to point to the RomBitItem*.
This can be handy in drawing results back to the screen,
but be careful that the pointers don't become stale!
*/
mrt->gr.inputbits[row][col]->ptr=bit;
bit=bit->nexttoright; //Skip down the row.
col++;
}
ascii.append("\n");
rowbit=rowbit->nextrow; //Skip to the next row.
col=0;
row++;
}
return mrt->gr;
}
//This returns a text preview.
QString RomDecoderGato::preview(MaskRomTool *m){
return "";
}
//Exports the preview to a file.
void RomDecoderGato::writeFile(MaskRomTool *m, QString filename){
qDebug()<<"Not writing a GatoRom file.";
}