-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPatcher.h
60 lines (49 loc) · 1.54 KB
/
Patcher.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
#ifndef PATCHER_H
#define PATCHER_H
#include "ColorLog.h"
#include <QObject>
#include <QFile>
#include <QBuffer>
#include <QThread>
class Patcher : public QThread
{
Q_OBJECT
public:
explicit Patcher();
~Patcher();
private:
QString fileNameCG45;
QString patchedFileNameCG45;
QString dirNameCG45;
enum EPhoneModels {
ZN5,
ZN5Tmobile,
UnknownModel
};
int foundPatches;
int appliedPatches;
int countOfPatches;
int progressValue;
private:
bool createPatchFile();
Patcher::EPhoneModels determinePhoneModel(const QByteArray &aHeader);
bool patchCG45to(QFile &aFile, const EPhoneModels aPhone);
void patchFound(int aPatch, const QByteArray &aValue);
void patchFound(int aBegin, int aEnd, const QString &aValue);
void patchApplied(int aPatch, const QByteArray &aValue, const QByteArray &hexString);
void patchApplied(int aBegin, int aEnd, const QString &aFromValue, const QString &aToValue);
void applyPatch(QBuffer &aBuffer, int aLength, int aOffset, const QByteArray &hexString);
void fillBytes(QBuffer &aBuffer, int aLength, int aOffset, const QByteArray &hexString);
bool writePatchedCG45file(const QString &aFullName, const QByteArray &aByteArray);
void run();
public:
void setFileName(const QString aFileName);
void setDirName(const QString aDirName);
void setPatchedFileName(const QString aFileName);
signals:
void toLogArea(ColError, QString);
void clearLogArea();
void toProgressBar(int);
void done();
};
#endif // PATCHER_H