mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-29 06:57:46 +00:00
sagasu: Index all ffxiv index files, stop hardcoding a path you dunce
This commit is contained in:
parent
ec1338fa03
commit
9cdddae7a6
8 changed files with 28 additions and 18 deletions
|
@ -26,7 +26,7 @@ class FileTreeModel : public QAbstractItemModel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FileTreeModel(GameData *data);
|
explicit FileTreeModel(QString gamePath, GameData *data);
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
|
|
|
@ -12,7 +12,7 @@ class FileTreeWindow : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit FileTreeWindow(GameData *data, QWidget *parent = nullptr);
|
explicit FileTreeWindow(QString gamePath, GameData *data, QWidget *parent = nullptr);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void extractFile(QString path);
|
void extractFile(QString path);
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct GameData;
|
||||||
class MainWindow : public NovusMainWindow
|
class MainWindow : public NovusMainWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MainWindow(GameData *data);
|
MainWindow(QString gamePath, GameData *data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMdiArea *mdiArea = nullptr;
|
QMdiArea *mdiArea = nullptr;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
|
|
||||||
FileTreeModel::FileTreeModel(GameData *data)
|
FileTreeModel::FileTreeModel(QString gamePath, GameData *data)
|
||||||
: gameData(data)
|
: gameData(data)
|
||||||
, QAbstractItemModel()
|
, QAbstractItemModel()
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,13 @@ FileTreeModel::FileTreeModel(GameData *data)
|
||||||
addKnownFolder(knownFolder);
|
addKnownFolder(knownFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto indexEntries = physis_index_parse("/home/josh/.local/share/astra/game/{1973dab7-aa23-4af1-8a48-bfec78dd6c8e}/game/sqpack/ffxiv/000000.win32.index");
|
QDirIterator it(QStringLiteral("%1/sqpack/ffxiv").arg(gamePath));
|
||||||
|
while (it.hasNext()) {
|
||||||
|
it.next();
|
||||||
|
QFileInfo info = it.fileInfo();
|
||||||
|
if (info.exists() && (info.completeSuffix() == QStringLiteral("win32.index") || info.completeSuffix() == QStringLiteral("win32.index2"))) {
|
||||||
|
std::string pathStd = info.filePath().toStdString();
|
||||||
|
auto indexEntries = physis_index_parse(pathStd.c_str());
|
||||||
for (int i = 0; i < indexEntries.num_entries; i++) {
|
for (int i = 0; i < indexEntries.num_entries; i++) {
|
||||||
if (knownDirHashes.contains(indexEntries.dir_entries[i])) {
|
if (knownDirHashes.contains(indexEntries.dir_entries[i])) {
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -30,6 +36,8 @@ FileTreeModel::FileTreeModel(GameData *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int FileTreeModel::rowCount(const QModelIndex &parent) const
|
int FileTreeModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
|
|
||||||
FileTreeWindow::FileTreeWindow(GameData *data, QWidget *parent)
|
FileTreeWindow::FileTreeWindow(QString gamePath, GameData *data, QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, data(data)
|
, data(data)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ FileTreeWindow::FileTreeWindow(GameData *data, QWidget *parent)
|
||||||
auto layout = new QHBoxLayout();
|
auto layout = new QHBoxLayout();
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
m_fileModel = new FileTreeModel(data);
|
m_fileModel = new FileTreeModel(gamePath, data);
|
||||||
|
|
||||||
auto treeWidget = new QTreeView();
|
auto treeWidget = new QTreeView();
|
||||||
treeWidget->setModel(m_fileModel);
|
treeWidget->setModel(m_fileModel);
|
||||||
|
|
|
@ -147,6 +147,8 @@ int main(int argc, char *argv[])
|
||||||
database.addFile(QLatin1String(file));
|
database.addFile(QLatin1String(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
database.addFile(QStringLiteral("exd/root.exl"));
|
||||||
|
|
||||||
/*const QString gameDir{getGameDirectory()};
|
/*const QString gameDir{getGameDirectory()};
|
||||||
const std::string gameDirStd{gameDir.toStdString()};
|
const std::string gameDirStd{gameDir.toStdString()};
|
||||||
auto data = physis_gamedata_initialize(gameDirStd.c_str());
|
auto data = physis_gamedata_initialize(gameDirStd.c_str());
|
||||||
|
|
|
@ -20,7 +20,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
const QString gameDir{getGameDirectory()};
|
const QString gameDir{getGameDirectory()};
|
||||||
const std::string gameDirStd{gameDir.toStdString()};
|
const std::string gameDirStd{gameDir.toStdString()};
|
||||||
MainWindow w(physis_gamedata_initialize(gameDirStd.c_str()));
|
MainWindow w(gameDir, physis_gamedata_initialize(gameDirStd.c_str()));
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "filetreewindow.h"
|
#include "filetreewindow.h"
|
||||||
#include "hexpart.h"
|
#include "hexpart.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData *data)
|
MainWindow::MainWindow(QString gamePath, GameData *data)
|
||||||
: NovusMainWindow()
|
: NovusMainWindow()
|
||||||
, data(data)
|
, data(data)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ MainWindow::MainWindow(GameData *data)
|
||||||
auto layout = new QHBoxLayout();
|
auto layout = new QHBoxLayout();
|
||||||
dummyWidget->setLayout(layout);
|
dummyWidget->setLayout(layout);
|
||||||
|
|
||||||
auto tree = new FileTreeWindow(data);
|
auto tree = new FileTreeWindow(gamePath, data);
|
||||||
connect(tree, &FileTreeWindow::extractFile, this, [this, data](QString path) {
|
connect(tree, &FileTreeWindow::extractFile, this, [this, data](QString path) {
|
||||||
const QFileInfo info(path);
|
const QFileInfo info(path);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue