diff --git a/apps/sagasu/include/mainwindow.h b/apps/sagasu/include/mainwindow.h index 9004a73..b6f6c8b 100644 --- a/apps/sagasu/include/mainwindow.h +++ b/apps/sagasu/include/mainwindow.h @@ -13,6 +13,8 @@ #include "hashdatabase.h" #include "novusmainwindow.h" +#include + 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); }; \ No newline at end of file diff --git a/apps/sagasu/src/indexer.cpp b/apps/sagasu/src/indexer.cpp index 94b24a6..07721f6 100644 --- a/apps/sagasu/src/indexer.cpp +++ b/apps/sagasu/src/indexer.cpp @@ -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; } \ No newline at end of file diff --git a/apps/sagasu/src/mainwindow.cpp b/apps/sagasu/src/mainwindow.cpp index 14a8471..cab872c 100644 --- a/apps/sagasu/src/mainwindow.cpp +++ b/apps/sagasu/src/mainwindow.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #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); diff --git a/extern/libphysis b/extern/libphysis index 6669060..c66307b 160000 --- a/extern/libphysis +++ b/extern/libphysis @@ -1 +1 @@ -Subproject commit 6669060bbd87d7c13e0750426853575778049b93 +Subproject commit c66307bde1bce11a2102418b8349ed67afb345ab