From c7a3f9cf5a755a2c908c8605b6cb58c5af8c5ec0 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 12 Oct 2023 20:18:22 -0400 Subject: [PATCH] sagasu: Add support for viewing raw data with the new hex part --- sagasu/CMakeLists.txt | 2 +- sagasu/include/filepropertieswindow.h | 2 +- sagasu/src/filepropertieswindow.cpp | 6 ++---- sagasu/src/mainwindow.cpp | 9 ++++++++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/sagasu/CMakeLists.txt b/sagasu/CMakeLists.txt index ce0243f..b4391a0 100644 --- a/sagasu/CMakeLists.txt +++ b/sagasu/CMakeLists.txt @@ -22,6 +22,6 @@ target_sources(novus-sagasu PRIVATE src/filepropertieswindow.cpp src/filetreemodel.cpp) target_include_directories(novus-sagasu PRIVATE include) -target_link_libraries(novus-sagasu PRIVATE Qt6::Concurrent novus-sagasu-static) +target_link_libraries(novus-sagasu PRIVATE Qt6::Concurrent hexpart novus-sagasu-static) install(TARGETS novus-sagasu ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/sagasu/include/filepropertieswindow.h b/sagasu/include/filepropertieswindow.h index e35c267..a08349a 100644 --- a/sagasu/include/filepropertieswindow.h +++ b/sagasu/include/filepropertieswindow.h @@ -10,7 +10,7 @@ class FilePropertiesWindow : public QWidget { Q_OBJECT public: - explicit FilePropertiesWindow(GameData *data, QString path, QWidget *parent = nullptr); + explicit FilePropertiesWindow(QString path, physis_Buffer buffer, QWidget *parent = nullptr); private: GameData *data = nullptr; diff --git a/sagasu/src/filepropertieswindow.cpp b/sagasu/src/filepropertieswindow.cpp index e3b261d..91a08e5 100644 --- a/sagasu/src/filepropertieswindow.cpp +++ b/sagasu/src/filepropertieswindow.cpp @@ -9,7 +9,7 @@ #include "filepropertieswindow.h" -FilePropertiesWindow::FilePropertiesWindow(GameData *data, QString path, QWidget *parent) +FilePropertiesWindow::FilePropertiesWindow(QString path, physis_Buffer buffer, QWidget *parent) : QWidget(parent) , data(data) { @@ -24,9 +24,7 @@ FilePropertiesWindow::FilePropertiesWindow(GameData *data, QString path, QWidget auto typeLabel = new QLabel(QStringLiteral("Unknown type")); layout->addRow(QStringLiteral("Type"), typeLabel); - auto file = physis_gamedata_extract_file(data, path.toStdString().c_str()); - - auto sizeLabel = new QLabel(QString::number(file.size)); + auto sizeLabel = new QLabel(QString::number(buffer.size)); layout->addRow(QStringLiteral("Size (in bytes)"), sizeLabel); } diff --git a/sagasu/src/mainwindow.cpp b/sagasu/src/mainwindow.cpp index b8d1fce..de2ed12 100644 --- a/sagasu/src/mainwindow.cpp +++ b/sagasu/src/mainwindow.cpp @@ -11,6 +11,7 @@ #include "filepropertieswindow.h" #include "filetreewindow.h" +#include "hexpart.h" MainWindow::MainWindow(GameData *data) : NovusMainWindow() @@ -63,7 +64,13 @@ void MainWindow::refreshParts(QString path) return; } + auto file = physis_gamedata_extract_file(data, path.toStdString().c_str()); + // Add properties tab - auto propertiesWidget = new FilePropertiesWindow(data, path); + auto propertiesWidget = new FilePropertiesWindow(path, file); partHolder->addTab(propertiesWidget, QStringLiteral("Properties")); + + auto hexWidget = new HexPart(); + hexWidget->loadFile(file); + partHolder->addTab(hexWidget, QStringLiteral("Raw Hex")); }