From 2fd21e3270aeec443568e50720b0c5d4b11a2e91 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 13 Jan 2018 20:42:13 -1000 Subject: [PATCH] More complete package step verification --- hecl-gui/CMakeLists.txt | 2 ++ hecl-gui/MacOSSystemVersion.mm | 4 ++++ hecl-gui/MainWindow.cpp | 29 +++++++++++++++++++++++++++-- hecl-gui/MainWindow.hpp | 1 + hecl-gui/SysReqTableView.cpp | 4 ++-- 5 files changed, 36 insertions(+), 4 deletions(-) diff --git a/hecl-gui/CMakeLists.txt b/hecl-gui/CMakeLists.txt index 03a913186..e213e7d19 100644 --- a/hecl-gui/CMakeLists.txt +++ b/hecl-gui/CMakeLists.txt @@ -10,6 +10,8 @@ find_package(Qt5Xml) if(APPLE) set(PLAT_SRCS MacOSSystemVersion.hpp MacOSSystemVersion.mm) + set_source_files_properties(MacOSSystemVersion.mm + PROPERTIES COMPILE_FLAGS -fobjc-arc) find_library(FOUNDATION_LIBRARY Foundation) set(PLAT_LIBS ${FOUNDATION_LIBRARY}) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") diff --git a/hecl-gui/MacOSSystemVersion.mm b/hecl-gui/MacOSSystemVersion.mm index 0db12e615..b6074c0c4 100644 --- a/hecl-gui/MacOSSystemVersion.mm +++ b/hecl-gui/MacOSSystemVersion.mm @@ -2,6 +2,10 @@ #include #include +#if !__has_feature(objc_arc) +#error ARC Required +#endif + void GetMacOSSystemVersion(int& major, int& minor, int& patch) { major = 0; diff --git a/hecl-gui/MainWindow.cpp b/hecl-gui/MainWindow.cpp index 3e2a91eee..197c96d52 100644 --- a/hecl-gui/MainWindow.cpp +++ b/hecl-gui/MainWindow.cpp @@ -317,7 +317,7 @@ void MainWindow::enableOperations() if (QFile::exists(m_path + "/MP1/!original_ids.yaml")) { m_ui->packageBtn->setEnabled(true); - if (QFile::exists(m_path + "/out/MP1/!original_ids.upak")) + if (isPackageComplete()) m_ui->launchBtn->setEnabled(true); } @@ -331,6 +331,30 @@ void MainWindow::enableOperations() insertContinueNote("Press 'Extract' to begin."); } +bool MainWindow::isPackageComplete() const +{ + return + QFile::exists(m_path + "/out/MP1/!original_ids.upak") && + QFile::exists(m_path + "/out/MP1/AudioGrp.upak") && + QFile::exists(m_path + "/out/MP1/GGuiSys.upak") && + QFile::exists(m_path + "/out/MP1/Metroid1.upak") && + QFile::exists(m_path + "/out/MP1/Metroid2.upak") && + QFile::exists(m_path + "/out/MP1/Metroid3.upak") && + QFile::exists(m_path + "/out/MP1/Metroid4.upak") && + QFile::exists(m_path + "/out/MP1/metroid5.upak") && + QFile::exists(m_path + "/out/MP1/Metroid6.upak") && + QFile::exists(m_path + "/out/MP1/Metroid7.upak") && + QFile::exists(m_path + "/out/MP1/Metroid8.upak") && + QFile::exists(m_path + "/out/MP1/MidiData.upak") && + QFile::exists(m_path + "/out/MP1/MiscData.upak") && + QFile::exists(m_path + "/out/MP1/NoARAM.upak") && + QFile::exists(m_path + "/out/MP1/SamGunFx.upak") && + QFile::exists(m_path + "/out/MP1/SamusGun.upak") && + QFile::exists(m_path + "/out/MP1/SlideShow.upak") && + QFile::exists(m_path + "/out/MP1/TestAnim.upak") && + QFile::exists(m_path + "/out/MP1/Tweaks.upak"); +} + static bool GetDLPackage(const QString& path, QString& dlPackage) { QProcess proc; @@ -464,7 +488,6 @@ void MainWindow::initSlots() connect(&m_heclProc, &QProcess::readyRead, [=](){ QByteArray bytes = m_heclProc.readAll(); setTextTermFormatting(bytes); - m_ui->processOutput->ensureCursorVisible(); }); connect(m_ui->extractBtn, SIGNAL(clicked()), this, SLOT(onExtract())); @@ -519,6 +542,7 @@ void MainWindow::setTextTermFormatting(const QString& text) } } m_cursor.setCharFormat(defaultTextCharFormat); + m_ui->processOutput->ensureCursorVisible(); } void MainWindow::insertContinueNote(const QString& text) @@ -532,4 +556,5 @@ void MainWindow::insertContinueNote(const QString& text) textCharFormat.setForeground(QColor(0,255,0)); m_cursor.insertText(text, textCharFormat); m_cursor.insertBlock(); + m_ui->processOutput->ensureCursorVisible(); } diff --git a/hecl-gui/MainWindow.hpp b/hecl-gui/MainWindow.hpp index 985652a6c..c0f6f9766 100644 --- a/hecl-gui/MainWindow.hpp +++ b/hecl-gui/MainWindow.hpp @@ -62,6 +62,7 @@ private: void onBinaryFailed(); void disableOperations(); void enableOperations(); + bool isPackageComplete() const; }; #endif // MAINWINDOW_HPP diff --git a/hecl-gui/SysReqTableView.cpp b/hecl-gui/SysReqTableView.cpp index 9c7ebd550..293cca34c 100644 --- a/hecl-gui/SysReqTableView.cpp +++ b/hecl-gui/SysReqTableView.cpp @@ -120,7 +120,7 @@ SysReqTableModel::SysReqTableModel(QObject* parent) #else m_memorySize = uint64_t(sysconf(_SC_PHYS_PAGES)) * sysconf(_SC_PAGESIZE); #endif - m_memorySizeStr.sprintf("%g GB", m_memorySize / 1024.f / 1024.f / 1024.f); + m_memorySizeStr.sprintf("%g GiB", m_memorySize / 1024.f / 1024.f / 1024.f); #ifdef __APPLE__ GetMacOSSystemVersion(m_macosMajor, m_macosMinor, m_macosPatch); if (m_macosPatch == 0) @@ -213,7 +213,7 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const case 1: return QStringLiteral("1.5 GHz"); case 2: - return QStringLiteral("3 GB"); + return QStringLiteral("3 GiB"); case 3: return QStringLiteral("16 GB (MP1)"); case 4: