From ae5f29c884e1544fd099cfbe465f0da61080eeb3 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Tue, 10 Dec 2024 21:11:45 +0100 Subject: [PATCH 1/5] document 2017 gog hashes --- launcher/innoextract.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/launcher/innoextract.cpp b/launcher/innoextract.cpp index 20e1e7182..f20ae641e 100644 --- a/launcher/innoextract.cpp +++ b/launcher/innoextract.cpp @@ -83,6 +83,8 @@ QString Innoextract::getHashError(QString exeFile, QString binFile, QString exeF }; std::vector knownHashes = { + // { H3_COMPLETE, "english", 973162040, 0, "7cf1ecec73e8c2f2c2619415cd16749be5641942", "" }, // setup_homm_3_complete_4.0_(10665).exe + // { H3_COMPLETE, "french", ???, 0, "7e5a737c51530a1888033d188ab0635825ee622f", "" }, // setup_homm_3_complete_french_4.0_(10665).exe { H3_COMPLETE, "english", 822520, 1005040617, "66646a353b06417fa12c6384405688c84a315cc1", "c624e2071f4e35386765ab044ad5860ac245b7f4" }, // setup_heroes_of_might_and_magic_3_complete_4.0_(28740).exe { H3_COMPLETE, "french", 824960, 997305870, "072f1d4466ff16444d8c7949c6530448a9c53cfa", "9b6b451d2bd2f8b4be159e62fa6d32e87ee10455" }, // setup_heroes_of_might_and_magic_3_complete_4.0_(french)_(28740).exe { H3_COMPLETE, "polish", 822288, 849286313, "74ffde00156dd5a8e237668f87213387f0dd9c7c", "2523cf9943043ae100186f89e4ebf7c28be09804" }, // setup_heroes_of_might_and_magic_3_complete_4.0_(polish)_(28740).exe From f0bf6eb8080eb9fa1688135db5e141a9d6a06457 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:28:11 +0100 Subject: [PATCH 2/5] improved manual install process --- launcher/mainwindow_moc.cpp | 9 ++++++++- launcher/modManager/cmodlistview_moc.cpp | 5 +++++ launcher/modManager/cmodlistview_moc.h | 2 +- launcher/startGame/StartGameTab.h | 4 ++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/launcher/mainwindow_moc.cpp b/launcher/mainwindow_moc.cpp index 47c796903..243aec6a7 100644 --- a/launcher/mainwindow_moc.cpp +++ b/launcher/mainwindow_moc.cpp @@ -164,6 +164,10 @@ void MainWindow::switchToStartTab() ui->startGameButton->setEnabled(true); ui->startGameButton->setChecked(true); ui->tabListWidget->setCurrentIndex(TabRows::START); + + auto* startGameTabWidget = qobject_cast(ui->tabListWidget->widget(TabRows::START)); + if(startGameTabWidget) + startGameTabWidget->refreshState(); } void MainWindow::switchToModsTab() @@ -247,6 +251,9 @@ void MainWindow::dropEvent(QDropEvent* event) void MainWindow::manualInstallFile(QString filePath) { + if(filePath.endsWith(".zip", Qt::CaseInsensitive) || filePath.endsWith(".exe", Qt::CaseInsensitive)) + switchToModsTab(); + QString fileName = QFileInfo{filePath}.fileName(); if(filePath.endsWith(".zip", Qt::CaseInsensitive)) getModView()->downloadFile(fileName.toLower() @@ -279,7 +286,7 @@ void MainWindow::manualInstallFile(QString filePath) } } else - getModView()->downloadFile(fileName, QUrl::fromLocalFile(filePath), fileName); + getModView()->installFiles(QStringList{filePath}); } ETranslationStatus MainWindow::getTranslationStatus() diff --git a/launcher/modManager/cmodlistview_moc.cpp b/launcher/modManager/cmodlistview_moc.cpp index 4ecd9060a..1dfde0518 100644 --- a/launcher/modManager/cmodlistview_moc.cpp +++ b/launcher/modManager/cmodlistview_moc.cpp @@ -788,6 +788,8 @@ void CModListView::installFiles(QStringList files) if(!exe.empty()) { + ui->progressWidget->setVisible(true); + ui->pushButton->setEnabled(false); ui->progressBar->setFormat(tr("Installing chronicles")); float prog = 0.0; @@ -807,6 +809,9 @@ void CModListView::installFiles(QStringList files) if(futureExtract.get()) { + hideProgressBar(); + ui->pushButton->setEnabled(true); + ui->progressWidget->setVisible(false); //update modStateModel->reloadLocalState(); modModel->reloadRepositories(); diff --git a/launcher/modManager/cmodlistview_moc.h b/launcher/modManager/cmodlistview_moc.h index c0c589290..cf23a4319 100644 --- a/launcher/modManager/cmodlistview_moc.h +++ b/launcher/modManager/cmodlistview_moc.h @@ -54,7 +54,6 @@ class CModListView : public QWidget void installMods(QStringList archives); void installMaps(QStringList maps); - void installFiles(QStringList mods); QString genChangelogText(const ModState & mod); QString genModInfoText(const ModState & mod); @@ -113,6 +112,7 @@ public: bool isModInstalled(const QString & modName); void downloadFile(QString file, QUrl url, QString description, qint64 sizeBytes = 0); + void installFiles(QStringList mods); public slots: void enableModByName(QString modName); diff --git a/launcher/startGame/StartGameTab.h b/launcher/startGame/StartGameTab.h index 9768600dc..9f165278c 100644 --- a/launcher/startGame/StartGameTab.h +++ b/launcher/startGame/StartGameTab.h @@ -33,8 +33,6 @@ class StartGameTab : public QWidget MainWindow * getMainWindow(); - void refreshState(); - void refreshUpdateStatus(EGameUpdateStatus status); void refreshTranslation(ETranslationStatus status); void refreshMods(); @@ -45,6 +43,8 @@ public: explicit StartGameTab(QWidget * parent = nullptr); ~StartGameTab(); + void refreshState(); + private slots: void on_buttonGameStart_clicked(); void on_buttonOpenChangelog_clicked(); From dbd4f5b48e334ccd94ec830d54e7d651360a26a2 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:38:58 +0100 Subject: [PATCH 3/5] fix drag & drop --- launcher/mainwindow_moc.cpp | 2 ++ launcher/modManager/cmodlistview_moc.cpp | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/launcher/mainwindow_moc.cpp b/launcher/mainwindow_moc.cpp index 243aec6a7..6967b6dbc 100644 --- a/launcher/mainwindow_moc.cpp +++ b/launcher/mainwindow_moc.cpp @@ -77,6 +77,8 @@ MainWindow::MainWindow(QWidget * parent) ui->setupUi(this); + setAcceptDrops(true); + setWindowIcon(QIcon{":/icons/menu-game.png"}); ui->modslistButton->setIcon(QIcon{":/icons/menu-mods.png"}); ui->settingsButton->setIcon(QIcon{":/icons/menu-settings.png"}); diff --git a/launcher/modManager/cmodlistview_moc.cpp b/launcher/modManager/cmodlistview_moc.cpp index 1dfde0518..6e23fb4f6 100644 --- a/launcher/modManager/cmodlistview_moc.cpp +++ b/launcher/modManager/cmodlistview_moc.cpp @@ -110,8 +110,6 @@ CModListView::CModListView(QWidget * parent) { ui->setupUi(this); - setAcceptDrops(true); - ui->uninstallButton->setIcon(QIcon{":/icons/mod-delete.png"}); ui->enableButton->setIcon(QIcon{":/icons/mod-enabled.png"}); ui->disableButton->setIcon(QIcon{":/icons/mod-disabled.png"}); From 7cc5c06d2a76d40a677e11b49da639d23439f8fa Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Tue, 10 Dec 2024 23:14:27 +0100 Subject: [PATCH 4/5] fix fileuri error on android --- launcher/modManager/chroniclesextractor.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/launcher/modManager/chroniclesextractor.cpp b/launcher/modManager/chroniclesextractor.cpp index d3949fe1d..0ecd1f4d1 100644 --- a/launcher/modManager/chroniclesextractor.cpp +++ b/launcher/modManager/chroniclesextractor.cpp @@ -235,16 +235,19 @@ void ChroniclesExtractor::installChronicles(QStringList exe) for(QString f : exe) { extractionFile++; - QFile file(f); + + if(!createTempDir()) + continue; + + QString filepath = tempDir.filePath("chr.exe"); + QFile(f).copy(filepath); + QFile file(filepath); int chronicleNo = getChronicleNo(file); if(!chronicleNo) continue; - if(!createTempDir()) - continue; - - if(!extractGogInstaller(f)) + if(!extractGogInstaller(filepath)) continue; createBaseMod(); From 922d467d775d75f958501a9f21156588b3d6b96c Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Wed, 11 Dec 2024 00:49:23 +0100 Subject: [PATCH 5/5] replace boost with qt (fix android crash) --- launcher/modManager/chroniclesextractor.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/launcher/modManager/chroniclesextractor.cpp b/launcher/modManager/chroniclesextractor.cpp index 0ecd1f4d1..a8a4ccd62 100644 --- a/launcher/modManager/chroniclesextractor.cpp +++ b/launcher/modManager/chroniclesextractor.cpp @@ -129,16 +129,14 @@ void ChroniclesExtractor::createBaseMod() const for(auto & dataPath : VCMIDirs::get().dataPaths()) { - auto file = dataPath / "config" / "heroes" / "portraitsChronicles.json"; + auto file = pathToQString(dataPath / "config" / "heroes" / "portraitsChronicles.json"); auto destFolder = VCMIDirs::get().userDataPath() / "Mods" / "chronicles" / "content" / "config"; - if(boost::filesystem::exists(file)) + auto destFile = pathToQString(destFolder / "portraitsChronicles.json"); + if(QFile::exists(file)) { - boost::filesystem::create_directories(destFolder); -#if BOOST_VERSION >= 107400 - boost::filesystem::copy_file(file, destFolder / "portraitsChronicles.json", boost::filesystem::copy_options::overwrite_existing); -#else - boost::filesystem::copy_file(file, destFolder / "portraitsChronicles.json", boost::filesystem::copy_option::overwrite_if_exists); -#endif + QDir().mkpath(pathToQString(destFolder)); + QFile::remove(destFile); + QFile::copy(file, destFile); } } }