15 #include <ff7tkformats_export.h>
17 #define LGP_COMPANY_NAME_SIZE 12
18 #define LGP_PRODUCT_NAME_SIZE 14
20 #define LOOKUP_VALUE_MAX 30
21 #define LOOKUP_TABLE_ENTRIES LOOKUP_VALUE_MAX * LOOKUP_VALUE_MAX
23 #define MAX_CONFLICTS 4096
26 # define PACK(structure) \
27 __pragma(pack(push, 1)) \
31 # define PACK(structure) structure Q_PACKED
35 struct FF7TKFORMATS_EXPORT LgpLookupTableEntry {
43 fileDir(fileDir), tocIndex(tocIndex) {}
51 conflict(conflict), tocIndex(tocIndex) {}
61 const QString &fileName()
const;
62 const QString &fileDir()
const;
63 QString filePath()
const;
64 quint32 filePosition()
const;
65 qint64 fileSize()
const;
66 void setFileName(
const QString &fileName);
67 void setFileDir(
const QString &fileDir);
68 void setFilePath(
const QString &filePath);
69 void setFilePosition(quint32 filePosition);
70 void setFileSize(quint32 fileSize);
71 QIODevice *file(QIODevice *lgp);
72 QIODevice *modifiedFile(QIODevice *lgp);
73 void setFile(QIODevice *io);
74 void setModifiedFile(QIODevice *io);
76 QIODevice *createFile(QIODevice *lgp);
79 quint32 _filePosition;
86 class FF7TKFORMATS_EXPORT
LgpIO :
public QIODevice
90 bool open(OpenMode mode)
override;
91 qint64 size()
const override;
92 bool canReadLine()
const override;
94 qint64 readData(
char *data, qint64 maxSize)
override;
95 qint64 writeData(
const char *data, qint64 maxSize)
override;
111 QList<LgpHeaderEntry *> entries(quint16
id)
const;
112 const QMultiHash<quint16, LgpHeaderEntry *> &table()
const;
113 bool hasEntries(quint16
id)
const;
114 bool removeEntry(
const QString &filePath);
115 static bool isNameValid(
const QString &filePath);
116 bool renameEntry(
const QString &filePath,
const QString &newFilePath);
117 bool contains(
const QString &filePath)
const;
119 bool isEmpty()
const;
121 QList<const LgpHeaderEntry *> filesSortedByPosition()
const;
125 static qint16 lookupValue(
const QString &filePath);
126 static qint8 lookupValue(
const QChar &qc);
127 QMultiHash<quint16, LgpHeaderEntry *> _header;