-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathFieldPS.h
131 lines (119 loc) · 3.74 KB
/
FieldPS.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/****************************************************************************
** Deling Final Fantasy VIII Field Editor
** Copyright (C) 2009-2012 Arzel Jérôme <[email protected]>
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef FIELDPS_H
#define FIELDPS_H
#include "Field.h"
class HeaderPS
{
quint32 *posSections;
int memoryPos;
int sectionCount;
public:
explicit HeaderPS(const QByteArray &data, int count);
HeaderPS(const HeaderPS &other);
virtual ~HeaderPS();
bool isValid(int size) const;
quint32 position(int section) const;
quint32 size(int section) const;
QByteArray sectionData(int section, const QByteArray &data) const;
void setSize(int section, quint32 newSize);
QByteArray save() const;
};
class FieldDatHeader : public HeaderPS
{
public:
enum DatSections {
Inf, Ca, Id, Map, Msk, Rat, Mrt, AKAO, Msd, Pmd, Jsm, Last
};
explicit FieldDatHeader(const QByteArray &data);
virtual ~FieldDatHeader() {}
inline quint32 position(DatSections section) const {
return HeaderPS::position(section);
}
inline quint32 size(DatSections section) const {
return HeaderPS::size(section);
}
inline void setSize(DatSections section, quint32 newSize) {
HeaderPS::setSize(section, newSize);
}
private:
inline quint32 position(int section) const {
return HeaderPS::position(section);
}
inline quint32 size(int section) const {
return HeaderPS::size(section);
}
inline void setSize(int section, quint32 newSize) {
HeaderPS::setSize(section, newSize);
}
};
class FieldDatJpDemoHeader : public HeaderPS
{
public:
enum DatSections {
Inf, Ca, Id, Map, InfPartial, Msd, AKAO, Jsm, Last
};
explicit FieldDatJpDemoHeader(const QByteArray &data);
virtual ~FieldDatJpDemoHeader() {}
inline quint32 position(DatSections section) const {
return HeaderPS::position(section);
}
inline quint32 size(DatSections section) const {
return HeaderPS::size(section);
}
inline void setSize(DatSections section, quint32 newSize) {
HeaderPS::setSize(section, newSize);
}
private:
inline quint32 position(int section) const {
return HeaderPS::position(section);
}
inline quint32 size(int section) const {
return HeaderPS::size(section);
}
inline void setSize(int section, quint32 newSize) {
HeaderPS::setSize(section, newSize);
}
};
class FieldPS : public Field
{
public:
enum MimSections {
Pvp, Mim, Tdw, Pmp
};
FieldPS(quint32 isoFieldID);
virtual ~FieldPS();
bool isPc() const;
bool hasFiles2() const;
// void setIsoFieldID(quint32 isoFieldID);
quint32 isoFieldID() const;
virtual bool open(const QByteArray &dat);
virtual bool open2(const QByteArray &dat, const QByteArray &mim, const QByteArray &lzk);
bool save(QByteArray &dat, QByteArray &mim);
private:
quint32 _isoFieldID;
};
class FieldJpDemoPS : public FieldPS
{
public:
FieldJpDemoPS(quint32 isoFieldID);
virtual ~FieldJpDemoPS() {}
bool open(const QByteArray &dat);
bool open2(const QByteArray &dat, const QByteArray &mim, const QByteArray &lzk);
};
#endif // FIELDPS_H