-
Notifications
You must be signed in to change notification settings - Fork 0
/
scfdecoder.h
61 lines (50 loc) · 1.76 KB
/
scfdecoder.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
/*
This file is a part of the
Amagami SS PS2 Translation Project
You may feel free to use this code if you want so.
I provide no guarantee that this code is working,
useful or anything else. Use it at your own risk.
*/
#ifndef XMLCODER_H
#define XMLCODER_H
#include <QFile>
#include <QtXml>
#include <QString>
#include "module.h"
typedef QByteArray::iterator DataIterator;
class ScfDecoder : public Module
{
public:
ScfDecoder();
void load(QString path);
void saveXml(QString path);
private:
void createXml();
void checkHeader(QFile &file);
void checkLabelsHeader(QFile &file);
void readLabelsSection(QFile &file);
void readVariablesSection(QFile &file);
void readBlocksSection(QFile &file);
void readCodeSection(QFile &file);
void processEntryType(QFile &file, QDomElement &parentNode, size_t subi);
void processEntryType03(QFile &file, QDomElement &parentNode);
void processTextString(size_t index,
DataIterator startIt,
DataIterator finishIt,
QTextCodec *codec,
QDomElement &parentNode);
void processAsciiString(size_t index,
DataIterator startIt,
DataIterator finishIt,
QDomElement &parentNode);
void processEntryType05(QFile &file, QDomElement &parentNode);
void processEntryType07(QFile &file, QDomElement &parentNode);
void processEntryType08(QFile &file, QDomElement &parentNode);
private:
// ----- Read buffer 64 KB
char buffer[64 * 1024];
// ----- XML data container
QDomDocument xmlData;
QDomElement root;
};
#endif // XMLCODER_H