| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
#pragma once |
| 19 |
|
| 20 |
#include <QPair> |
| 21 |
#include <quazip/quazip.h> |
| 22 |
#include <quazip/quazipfile.h> |
| 23 |
#include "fs.h" |
| 24 |
|
| 25 |
namespace FS { |
| 26 |
|
| 27 |
struct qinode { |
| 28 |
int size; |
| 29 |
QList<int> sectors; |
| 30 |
quint8 tiers; |
| 31 |
int time; |
| 32 |
quint16 perms; |
| 33 |
}; |
| 34 |
|
| 35 |
class QNX6 : public QFileSystem |
| 36 |
{ |
| 37 |
Q_OBJECT |
| 38 |
|
| 39 |
public: |
| 40 |
explicit QNX6(QString filename, QIODevice* file, qint64 offset, qint64 size, QString path) |
| 41 |
: QFileSystem(filename, file, offset, size, path, ".qnx6") |
| 42 |
, currentZip(nullptr) {} |
| 43 |
|
| 44 |
inline qint64 findSector(qint64 sector) { |
| 45 |
return _offset + ((sector - sectorOffset) * sectorSize); |
| 46 |
} |
| 47 |
inline qint64 findNode(int node) { |
| 48 |
return _offset + (0x80 * (node - 1)); |
| 49 |
} |
| 50 |
qint64 findIndexFromSig(unsigned char* signature, int startFrom, int distanceFrom, unsigned int maxBlocks = -1, int num = 4); |
| 51 |
qinode createNode(int node); |
| 52 |
|
| 53 |
|
| 54 |
void extractManifest(int nodenum); |
| 55 |
void extractDir(int offset, QString basedir, int numNodes); |
| 56 |
|
| 57 |
bool createContents(); |
| 58 |
|
| 59 |
|
| 60 |
bool extractApps; |
| 61 |
|
| 62 |
signals: |
| 63 |
void currentNameChanged(QString name); |
| 64 |
|
| 65 |
private: |
| 66 |
QPair<int, QString> nodeInfo(QNXStream* stream, qint64 offset); |
| 67 |
quint16 sectorSize; |
| 68 |
quint16 sectorOffset; |
| 69 |
QList<int> lfn; |
| 70 |
QuaZip* currentZip; |
| 71 |
QList<QString> manifestApps; |
| 72 |
|
| 73 |
}; |
| 74 |
|
| 75 |
} |