-
Notifications
You must be signed in to change notification settings - Fork 15
/
FieldPC.h
71 lines (66 loc) · 2.77 KB
/
FieldPC.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
/****************************************************************************
** 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 FIELDPC_H
#define FIELDPC_H
#include "Field.h"
#include "FsArchive.h"
class FieldPC : public Field
{
public:
enum FileExt {
Msd, Jsm, Id, Ca, Rat, Mrt, Inf, Pmp, Pmd, Pvp, Map, Tdw, Msk, Sfx, CharaOne, Mim, Sym
};
FieldPC(const QString &name, const QString &path, FsArchive *archive, const QString &gameLang);
explicit FieldPC(const QString &path, const QString &gameLang);
virtual ~FieldPC();
bool isPc() const;
bool hasFiles2() const;
// void setArchiveHeader(FsArchive *header);
FsArchive *getArchiveHeader() const;
const QString &path() const;
bool open(const QString &path);
bool open(FsArchive *archive);
bool open2(FsArchive *archive = nullptr);
bool save(const QString &path);
void save(QByteArray &fs_data, QByteArray &fl_data, QByteArray &fi_data);
void optimize(QByteArray &fs_data, QByteArray &fl_data, QByteArray &fi_data);
bool isMultiLanguage() const;
QStringList languages() const;
protected:
virtual void setFile(FileType fileType);
private:
bool openOptimized(const QList<FileExt> &selectedExts);
bool openOptimized(const QList<FileExt> &selectedExts, FsArchive *archive);
QString fileName(FileExt fileExt, bool useGameLang) const;
QString filePath(FileExt fileExt) const;
QString filePath(FileExt fileType, bool useGameLang) const;
QString filePath(const QString &fileName) const;
inline static QList<FileExt> openExts() {
return QList<FileExt>() << Inf << Msd << Jsm << Mrt << Sym;
}
inline static QList<FileExt> open2Exts() {
return QList<FileExt>() << Msk << Rat << Pmp << Pmd << Pvp << Sfx
<< Id << Ca << Tdw << Map << Mim << CharaOne;
}
static FileType extToType(FileExt fileExt, bool *ok);
static FileExt typeToExt(FileType fileType, bool *ok);
QString _path;
QString _lang, _subDir, _gameLang;
FsArchive *header;
};
#endif // FIELDPC_H