1
Fork 0
mirror of https://github.com/redstrate/Novus.git synced 2025-04-24 13:07:44 +00:00

Data Explorer: Add status bar with hash, offset and file type info

This commit is contained in:
Joshua Goins 2024-05-25 10:57:43 -04:00
parent 04aab49f34
commit d9438ad88a
4 changed files with 34 additions and 3 deletions

View file

@ -13,6 +13,8 @@
#include "hashdatabase.h"
#include "novusmainwindow.h"
#include <QLabel>
struct GameData;
class MainWindow : public NovusMainWindow
@ -30,6 +32,9 @@ private:
HashDatabase m_database;
QNetworkAccessManager *m_mgr = nullptr;
FileTreeWindow *m_tree = nullptr;
QLabel *m_offsetLabel = nullptr;
QLabel *m_hashLabel = nullptr;
QLabel *m_fileTypeLabel = nullptr;
void refreshParts(const QString &path);
};

View file

@ -257,6 +257,7 @@ int main(int argc, char *argv[])
database.addFile(QStringLiteral("chara/xls/charamake/human.cmp"));
database.addFile(QStringLiteral("chara/human/c0101/skeleton/base/b0001/skl_c0101b0001.sklb"));
database.addFile(QStringLiteral("chara/equipment/e0028/material/v0001/mt_c0101e0028_top_a.mtrl"));
database.addFile(QStringLiteral("exd/item.exh"));
return 0;
}

View file

@ -14,6 +14,7 @@
#include <QMessageBox>
#include <QNetworkReply>
#include <QSplitter>
#include <QStatusBar>
#include <QTemporaryDir>
#include "cmppart.h"
@ -39,6 +40,19 @@ MainWindow::MainWindow(const QString &gamePath, GameData *data)
m_mgr = new QNetworkAccessManager(this);
m_offsetLabel = new QLabel(i18n("Offset: Unknown"));
statusBar()->addWidget(m_offsetLabel);
auto separatorLine = new QFrame();
separatorLine->setFrameShape(QFrame::VLine);
statusBar()->addWidget(separatorLine);
m_hashLabel = new QLabel(i18n("Hash: Unknown"));
statusBar()->addWidget(m_hashLabel);
auto separatorLine2 = new QFrame();
separatorLine2->setFrameShape(QFrame::VLine);
statusBar()->addWidget(separatorLine2);
m_fileTypeLabel = new QLabel(i18n("File Type: Unknown"));
statusBar()->addWidget(m_fileTypeLabel);
auto dummyWidget = new QSplitter();
dummyWidget->setChildrenCollapsible(false);
setCentralWidget(dummyWidget);
@ -83,11 +97,22 @@ void MainWindow::refreshParts(const QString &path)
return;
}
QFileInfo info(path);
std::string filenameStd = info.fileName().toStdString();
auto crcHash = physis_calculate_hash(filenameStd.c_str());
m_hashLabel->setText(i18n("Hash: 0x%1", QString::number(crcHash, 16).toUpper().rightJustified(8, QLatin1Char('0'))));
// FIXME: this is terrible, we should not be recalculating this. it isn't a huge deal with the file + index caching, but still
auto datOffset = physis_gamedata_find_offset(data, pathStd.c_str());
m_offsetLabel->setText(i18n("Offset: 0x%1", QString::number(datOffset, 16).toUpper().rightJustified(8, QLatin1Char('0'))));
auto file = physis_gamedata_extract_file(data, path.toStdString().c_str());
QFileInfo info(path);
const FileType type = FileTypes::getFileType(info.completeSuffix());
m_fileTypeLabel->setText(i18n("File Type: %1", FileTypes::getFiletypeName(type)));
switch (type) {
case FileType::ExcelList: {
auto exlWidget = new EXLPart(data);

2
extern/libphysis vendored

@ -1 +1 @@
Subproject commit 6669060bbd87d7c13e0750426853575778049b93
Subproject commit c66307bde1bce11a2102418b8349ed67afb345ab