-
Notifications
You must be signed in to change notification settings - Fork 0
/
QGBTextbank.h
69 lines (55 loc) · 1.45 KB
/
QGBTextbank.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef QGBTEXTBANK_H
#define QGBTEXTBANK_H
#include <QtCore/QObject>
#include <QtCore/QFile>
#define MAX_STRINGS 161
struct QGByesNoBox
{
quint32 offset;
quint8 textBlock;
quint8 yes;
quint8 no;
};
struct QGBjump
{
quint32 writeOffset;
quint8 textBlock;
quint8 firstTxtBlock;
quint16 firstTxtBlockOffset;
quint8 secondTxtBlock;
quint16 secondTxtBlockOffset;
};
class QGBTextbank : public QObject
{
Q_OBJECT
private:
quint16 txtPointers[MAX_STRINGS];
QGByesNoBox yesNoBoxes[32];
QGBjump txtJump[256];
quint8 yesNoBoxCounter;
quint8 txtJumpCounter;
quint32 pointerToOffset(int i);
bool updatePointer(int i, quint32 newOffset);
quint8 writeDecodedTile(quint8 tileNum);
void writeUnicode(quint16 unicodeNum);
void writePlainText(QString text);
void writePlainText(QString text, quint8 additionalBytes);
void readPointers();
void dumpPointer(int i);
void writeByteField(QByteArray *byteArray, QFile *outFile);
void dumpByteArray(QByteArray *byteArray);
bool getDTE(quint8 ¤tTile, quint8 lastTile);
quint8 unicodeToTile(quint16 unicode);
quint8 nameToTile(QString str);
QByteArray *readTextBlock(QFile *in, quint8 blockNum);
QFile *romFile;
QFile *txtFile;
public:
explicit QGBTextbank(QString rom, QString dump);
~QGBTextbank();
void dumpText();
void insertText();
signals:
public slots:
};
#endif // QGBTEXTBANK_H