mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-25 21:27:45 +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
|
||||
|
||||
public:
|
||||
explicit FileTreeModel(GameData *data);
|
||||
explicit FileTreeModel(QString gamePath, GameData *data);
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
|
|
@ -12,7 +12,7 @@ class FileTreeWindow : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FileTreeWindow(GameData *data, QWidget *parent = nullptr);
|
||||
explicit FileTreeWindow(QString gamePath, GameData *data, QWidget *parent = nullptr);
|
||||
|
||||
Q_SIGNALS:
|
||||
void extractFile(QString path);
|
||||
|
|
|
@ -14,7 +14,7 @@ struct GameData;
|
|||
class MainWindow : public NovusMainWindow
|
||||
{
|
||||
public:
|
||||
MainWindow(GameData *data);
|
||||
MainWindow(QString gamePath, GameData *data);
|
||||
|
||||
private:
|
||||
QMdiArea *mdiArea = nullptr;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <QtConcurrent>
|
||||
|
||||
FileTreeModel::FileTreeModel(GameData *data)
|
||||
FileTreeModel::FileTreeModel(QString gamePath, GameData *data)
|
||||
: gameData(data)
|
||||
, QAbstractItemModel()
|
||||
{
|
||||
|
@ -17,16 +17,24 @@ FileTreeModel::FileTreeModel(GameData *data)
|
|||
addKnownFolder(knownFolder);
|
||||
}
|
||||
|
||||
auto indexEntries = physis_index_parse("/home/josh/.local/share/astra/game/{1973dab7-aa23-4af1-8a48-bfec78dd6c8e}/game/sqpack/ffxiv/000000.win32.index");
|
||||
for (int i = 0; i < indexEntries.num_entries; i++) {
|
||||
if (knownDirHashes.contains(indexEntries.dir_entries[i])) {
|
||||
QString name;
|
||||
if (m_database.knowsFile(indexEntries.filename_entries[i])) {
|
||||
name = m_database.getFilename(indexEntries.filename_entries[i]);
|
||||
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++) {
|
||||
if (knownDirHashes.contains(indexEntries.dir_entries[i])) {
|
||||
QString name;
|
||||
if (m_database.knowsFile(indexEntries.filename_entries[i])) {
|
||||
name = m_database.getFilename(indexEntries.filename_entries[i]);
|
||||
}
|
||||
addFile(knownDirHashes[indexEntries.dir_entries[i]], indexEntries.filename_entries[i], name);
|
||||
} else {
|
||||
addFolder(rootItem, indexEntries.dir_entries[i]);
|
||||
}
|
||||
}
|
||||
addFile(knownDirHashes[indexEntries.dir_entries[i]], indexEntries.filename_entries[i], name);
|
||||
} else {
|
||||
addFolder(rootItem, indexEntries.dir_entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <QMenu>
|
||||
#include <QTreeWidget>
|
||||
|
||||
FileTreeWindow::FileTreeWindow(GameData *data, QWidget *parent)
|
||||
FileTreeWindow::FileTreeWindow(QString gamePath, GameData *data, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, data(data)
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ FileTreeWindow::FileTreeWindow(GameData *data, QWidget *parent)
|
|||
auto layout = new QHBoxLayout();
|
||||
setLayout(layout);
|
||||
|
||||
m_fileModel = new FileTreeModel(data);
|
||||
m_fileModel = new FileTreeModel(gamePath, data);
|
||||
|
||||
auto treeWidget = new QTreeView();
|
||||
treeWidget->setModel(m_fileModel);
|
||||
|
|
|
@ -147,6 +147,8 @@ int main(int argc, char *argv[])
|
|||
database.addFile(QLatin1String(file));
|
||||
}
|
||||
|
||||
database.addFile(QStringLiteral("exd/root.exl"));
|
||||
|
||||
/*const QString gameDir{getGameDirectory()};
|
||||
const std::string gameDirStd{gameDir.toStdString()};
|
||||
auto data = physis_gamedata_initialize(gameDirStd.c_str());
|
||||
|
|
|
@ -20,7 +20,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
const QString gameDir{getGameDirectory()};
|
||||
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();
|
||||
|
||||
return app.exec();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "filetreewindow.h"
|
||||
#include "hexpart.h"
|
||||
|
||||
MainWindow::MainWindow(GameData *data)
|
||||
MainWindow::MainWindow(QString gamePath, GameData *data)
|
||||
: NovusMainWindow()
|
||||
, data(data)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ MainWindow::MainWindow(GameData *data)
|
|||
auto layout = new QHBoxLayout();
|
||||
dummyWidget->setLayout(layout);
|
||||
|
||||
auto tree = new FileTreeWindow(data);
|
||||
auto tree = new FileTreeWindow(gamePath, data);
|
||||
connect(tree, &FileTreeWindow::extractFile, this, [this, data](QString path) {
|
||||
const QFileInfo info(path);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue