Allow disable the auto updater (#1490)

This commit is contained in:
Quang Ngô 2024-11-07 19:56:02 +07:00 committed by GitHub
parent f45cad6bc9
commit a547b2774f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 49 additions and 7 deletions

View file

@ -143,7 +143,7 @@ jobs:
arch: amd64 arch: amd64
- name: Configure CMake - name: Configure CMake
run: cmake --fresh -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_QT_GUI=ON -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache run: cmake --fresh -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
@ -265,7 +265,7 @@ jobs:
variant: sccache variant: sccache
- name: Configure CMake - name: Configure CMake
run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DENABLE_QT_GUI=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(sysctl -n hw.ncpu) run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(sysctl -n hw.ncpu)
@ -368,7 +368,7 @@ jobs:
key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Configure CMake - name: Configure CMake
run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DENABLE_QT_GUI=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel3 run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel3

View file

@ -31,6 +31,7 @@ endif()
option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" OFF) option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" OFF)
option(ENABLE_DISCORD_RPC "Enable the Discord RPC integration" ON) option(ENABLE_DISCORD_RPC "Enable the Discord RPC integration" ON)
option(ENABLE_UPDATER "Enables the options to updater" ON)
# First, determine whether to use CMAKE_OSX_ARCHITECTURES or CMAKE_SYSTEM_PROCESSOR. # First, determine whether to use CMAKE_OSX_ARCHITECTURES or CMAKE_SYSTEM_PROCESSOR.
if (APPLE AND CMAKE_OSX_ARCHITECTURES) if (APPLE AND CMAKE_OSX_ARCHITECTURES)
@ -732,6 +733,12 @@ set(EMULATOR src/emulator.cpp
if(ENABLE_QT_GUI) if(ENABLE_QT_GUI)
qt_add_resources(RESOURCE_FILES src/shadps4.qrc) qt_add_resources(RESOURCE_FILES src/shadps4.qrc)
if (ENABLE_UPDATER)
set(UPDATER src/qt_gui/check_update.cpp
src/qt_gui/check_update.h
)
endif()
set(QT_GUI src/qt_gui/about_dialog.cpp set(QT_GUI src/qt_gui/about_dialog.cpp
src/qt_gui/about_dialog.h src/qt_gui/about_dialog.h
src/qt_gui/about_dialog.ui src/qt_gui/about_dialog.ui
@ -739,8 +746,6 @@ set(QT_GUI src/qt_gui/about_dialog.cpp
src/qt_gui/background_music_player.h src/qt_gui/background_music_player.h
src/qt_gui/cheats_patches.cpp src/qt_gui/cheats_patches.cpp
src/qt_gui/cheats_patches.h src/qt_gui/cheats_patches.h
src/qt_gui/check_update.cpp
src/qt_gui/check_update.h
src/qt_gui/main_window_ui.h src/qt_gui/main_window_ui.h
src/qt_gui/main_window.cpp src/qt_gui/main_window.cpp
src/qt_gui/main_window.h src/qt_gui/main_window.h
@ -771,6 +776,7 @@ set(QT_GUI src/qt_gui/about_dialog.cpp
${EMULATOR} ${EMULATOR}
${RESOURCE_FILES} ${RESOURCE_FILES}
${TRANSLATIONS} ${TRANSLATIONS}
${UPDATER}
) )
endif() endif()
@ -843,8 +849,11 @@ else()
endif() endif()
if (ENABLE_QT_GUI) if (ENABLE_QT_GUI)
target_link_libraries(shadps4 PRIVATE Qt6::Widgets Qt6::Concurrent Qt6::Network Qt6::Multimedia) target_link_libraries(shadps4 PRIVATE Qt6::Widgets Qt6::Concurrent Qt6::Network Qt6::Multimedia)
add_definitions(-DENABLE_QT_GUI) add_definitions(-DENABLE_QT_GUI)
if (ENABLE_UPDATER)
add_definitions(-DENABLE_UPDATER)
endif()
endif() endif()
if (WIN32) if (WIN32)

View file

@ -7,7 +7,9 @@
#include "about_dialog.h" #include "about_dialog.h"
#include "cheats_patches.h" #include "cheats_patches.h"
#ifdef ENABLE_UPDATER
#include "check_update.h" #include "check_update.h"
#endif
#include "common/io_file.h" #include "common/io_file.h"
#include "common/path_util.h" #include "common/path_util.h"
#include "common/scm_rev.h" #include "common/scm_rev.h"
@ -59,8 +61,10 @@ bool MainWindow::Init() {
this->show(); this->show();
// load game list // load game list
LoadGameLists(); LoadGameLists();
#ifdef ENABLE_UPDATER
// Check for update // Check for update
CheckUpdateMain(true); CheckUpdateMain(true);
#endif
auto end = std::chrono::steady_clock::now(); auto end = std::chrono::steady_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
@ -183,6 +187,7 @@ void MainWindow::LoadGameLists() {
} }
} }
#ifdef ENABLE_UPDATER
void MainWindow::CheckUpdateMain(bool checkSave) { void MainWindow::CheckUpdateMain(bool checkSave) {
if (checkSave) { if (checkSave) {
if (!Config::autoUpdate()) { if (!Config::autoUpdate()) {
@ -192,6 +197,7 @@ void MainWindow::CheckUpdateMain(bool checkSave) {
auto checkUpdate = new CheckUpdate(false); auto checkUpdate = new CheckUpdate(false);
checkUpdate->exec(); checkUpdate->exec();
} }
#endif
void MainWindow::GetPhysicalDevices() { void MainWindow::GetPhysicalDevices() {
Vulkan::Instance instance(false, false); Vulkan::Instance instance(false, false);
@ -254,10 +260,12 @@ void MainWindow::CreateConnects() {
settingsDialog->exec(); settingsDialog->exec();
}); });
#ifdef ENABLE_UPDATER
connect(ui->updaterAct, &QAction::triggered, this, [this]() { connect(ui->updaterAct, &QAction::triggered, this, [this]() {
auto checkUpdate = new CheckUpdate(true); auto checkUpdate = new CheckUpdate(true);
checkUpdate->exec(); checkUpdate->exec();
}); });
#endif
connect(ui->aboutAct, &QAction::triggered, this, [this]() { connect(ui->aboutAct, &QAction::triggered, this, [this]() {
auto aboutDialog = new AboutDialog(this); auto aboutDialog = new AboutDialog(this);
@ -933,7 +941,9 @@ void MainWindow::SetUiIcons(bool isWhite) {
ui->bootInstallPkgAct->setIcon(RecolorIcon(ui->bootInstallPkgAct->icon(), isWhite)); ui->bootInstallPkgAct->setIcon(RecolorIcon(ui->bootInstallPkgAct->icon(), isWhite));
ui->bootGameAct->setIcon(RecolorIcon(ui->bootGameAct->icon(), isWhite)); ui->bootGameAct->setIcon(RecolorIcon(ui->bootGameAct->icon(), isWhite));
ui->exitAct->setIcon(RecolorIcon(ui->exitAct->icon(), isWhite)); ui->exitAct->setIcon(RecolorIcon(ui->exitAct->icon(), isWhite));
#ifdef ENABLE_UPDATER
ui->updaterAct->setIcon(RecolorIcon(ui->updaterAct->icon(), isWhite)); ui->updaterAct->setIcon(RecolorIcon(ui->updaterAct->icon(), isWhite));
#endif
ui->downloadCheatsPatchesAct->setIcon( ui->downloadCheatsPatchesAct->setIcon(
RecolorIcon(ui->downloadCheatsPatchesAct->icon(), isWhite)); RecolorIcon(ui->downloadCheatsPatchesAct->icon(), isWhite));
ui->dumpGameListAct->setIcon(RecolorIcon(ui->dumpGameListAct->icon(), isWhite)); ui->dumpGameListAct->setIcon(RecolorIcon(ui->dumpGameListAct->icon(), isWhite));

View file

@ -56,7 +56,9 @@ private:
void CreateDockWindows(); void CreateDockWindows();
void GetPhysicalDevices(); void GetPhysicalDevices();
void LoadGameLists(); void LoadGameLists();
#ifdef ENABLE_UPDATER
void CheckUpdateMain(bool checkSave); void CheckUpdateMain(bool checkSave);
#endif
void CreateConnects(); void CreateConnects();
void SetLastUsedTheme(); void SetLastUsedTheme();
void SetLastIconSizeBullet(); void SetLastIconSizeBullet();

View file

@ -26,7 +26,9 @@ public:
QAction* downloadCheatsPatchesAct; QAction* downloadCheatsPatchesAct;
QAction* dumpGameListAct; QAction* dumpGameListAct;
QAction* pkgViewerAct; QAction* pkgViewerAct;
#ifdef ENABLE_UPDATER
QAction* updaterAct; QAction* updaterAct;
#endif
QAction* aboutAct; QAction* aboutAct;
QAction* configureAct; QAction* configureAct;
QAction* setThemeDark; QAction* setThemeDark;
@ -130,9 +132,11 @@ public:
pkgViewerAct = new QAction(MainWindow); pkgViewerAct = new QAction(MainWindow);
pkgViewerAct->setObjectName("pkgViewer"); pkgViewerAct->setObjectName("pkgViewer");
pkgViewerAct->setIcon(QIcon(":images/file_icon.png")); pkgViewerAct->setIcon(QIcon(":images/file_icon.png"));
#ifdef ENABLE_UPDATER
updaterAct = new QAction(MainWindow); updaterAct = new QAction(MainWindow);
updaterAct->setObjectName("updaterAct"); updaterAct->setObjectName("updaterAct");
updaterAct->setIcon(QIcon(":images/update_icon.png")); updaterAct->setIcon(QIcon(":images/update_icon.png"));
#endif
aboutAct = new QAction(MainWindow); aboutAct = new QAction(MainWindow);
aboutAct->setObjectName("aboutAct"); aboutAct->setObjectName("aboutAct");
aboutAct->setIcon(QIcon(":images/about_icon.png")); aboutAct->setIcon(QIcon(":images/about_icon.png"));
@ -291,7 +295,9 @@ public:
menuUtils->addAction(downloadCheatsPatchesAct); menuUtils->addAction(downloadCheatsPatchesAct);
menuUtils->addAction(dumpGameListAct); menuUtils->addAction(dumpGameListAct);
menuUtils->addAction(pkgViewerAct); menuUtils->addAction(pkgViewerAct);
#ifdef ENABLE_UPDATER
menuHelp->addAction(updaterAct); menuHelp->addAction(updaterAct);
#endif
menuHelp->addAction(aboutAct); menuHelp->addAction(aboutAct);
retranslateUi(MainWindow); retranslateUi(MainWindow);
@ -306,8 +312,10 @@ public:
bootInstallPkgAct->setText( bootInstallPkgAct->setText(
QCoreApplication::translate("MainWindow", "Install Packages (PKG)", nullptr)); QCoreApplication::translate("MainWindow", "Install Packages (PKG)", nullptr));
bootGameAct->setText(QCoreApplication::translate("MainWindow", "Boot Game", nullptr)); bootGameAct->setText(QCoreApplication::translate("MainWindow", "Boot Game", nullptr));
#ifdef ENABLE_UPDATER
updaterAct->setText( updaterAct->setText(
QCoreApplication::translate("MainWindow", "Check for Updates", nullptr)); QCoreApplication::translate("MainWindow", "Check for Updates", nullptr));
#endif
aboutAct->setText(QCoreApplication::translate("MainWindow", "About shadPS4", nullptr)); aboutAct->setText(QCoreApplication::translate("MainWindow", "About shadPS4", nullptr));
configureAct->setText(QCoreApplication::translate("MainWindow", "Configure...", nullptr)); configureAct->setText(QCoreApplication::translate("MainWindow", "Configure...", nullptr));
#if QT_CONFIG(tooltip) #if QT_CONFIG(tooltip)

View file

@ -6,7 +6,9 @@
#include <QHoverEvent> #include <QHoverEvent>
#include <common/version.h> #include <common/version.h>
#ifdef ENABLE_UPDATER
#include "check_update.h" #include "check_update.h"
#endif
#include "common/logging/backend.h" #include "common/logging/backend.h"
#include "common/logging/filter.h" #include "common/logging/filter.h"
#include "main_window.h" #include "main_window.h"
@ -143,6 +145,7 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
connect(ui->logFilterLineEdit, &QLineEdit::textChanged, this, connect(ui->logFilterLineEdit, &QLineEdit::textChanged, this,
[](const QString& text) { Config::setLogFilter(text.toStdString()); }); [](const QString& text) { Config::setLogFilter(text.toStdString()); });
#ifdef ENABLE_UPDATER
connect(ui->updateCheckBox, &QCheckBox::stateChanged, this, connect(ui->updateCheckBox, &QCheckBox::stateChanged, this,
[](int state) { Config::setAutoUpdate(state == Qt::Checked); }); [](int state) { Config::setAutoUpdate(state == Qt::Checked); });
@ -153,6 +156,10 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
auto checkUpdate = new CheckUpdate(true); auto checkUpdate = new CheckUpdate(true);
checkUpdate->exec(); checkUpdate->exec();
}); });
#else
ui->updaterGroupBox->setVisible(false);
ui->GUIgroupBox->setMaximumSize(265, 16777215);
#endif
connect(ui->playBGMCheckBox, &QCheckBox::stateChanged, this, [](int val) { connect(ui->playBGMCheckBox, &QCheckBox::stateChanged, this, [](int val) {
Config::setPlayBGM(val); Config::setPlayBGM(val);
@ -278,7 +285,9 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
ui->userName->installEventFilter(this); ui->userName->installEventFilter(this);
ui->logTypeGroupBox->installEventFilter(this); ui->logTypeGroupBox->installEventFilter(this);
ui->logFilter->installEventFilter(this); ui->logFilter->installEventFilter(this);
#ifdef ENABLE_UPDATER
ui->updaterGroupBox->installEventFilter(this); ui->updaterGroupBox->installEventFilter(this);
#endif
ui->GUIgroupBox->installEventFilter(this); ui->GUIgroupBox->installEventFilter(this);
// Input // Input
@ -340,6 +349,7 @@ void SettingsDialog::LoadValuesFromConfig() {
ui->vkSyncValidationCheckBox->setChecked(Config::vkValidationSyncEnabled()); ui->vkSyncValidationCheckBox->setChecked(Config::vkValidationSyncEnabled());
ui->rdocCheckBox->setChecked(Config::isRdocEnabled()); ui->rdocCheckBox->setChecked(Config::isRdocEnabled());
#ifdef ENABLE_UPDATER
ui->updateCheckBox->setChecked(Config::autoUpdate()); ui->updateCheckBox->setChecked(Config::autoUpdate());
std::string updateChannel = Config::getUpdateChannel(); std::string updateChannel = Config::getUpdateChannel();
if (updateChannel != "Release" && updateChannel != "Nightly") { if (updateChannel != "Release" && updateChannel != "Nightly") {
@ -350,6 +360,7 @@ void SettingsDialog::LoadValuesFromConfig() {
} }
} }
ui->updateComboBox->setCurrentText(QString::fromStdString(updateChannel)); ui->updateComboBox->setCurrentText(QString::fromStdString(updateChannel));
#endif
for (const auto& dir : Config::getGameInstallDirs()) { for (const auto& dir : Config::getGameInstallDirs()) {
QString path_string; QString path_string;
@ -451,8 +462,10 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) {
text = tr("logTypeGroupBox"); text = tr("logTypeGroupBox");
} else if (elementName == "logFilter") { } else if (elementName == "logFilter") {
text = tr("logFilter"); text = tr("logFilter");
#ifdef ENABLE_UPDATER
} else if (elementName == "updaterGroupBox") { } else if (elementName == "updaterGroupBox") {
text = tr("updaterGroupBox"); text = tr("updaterGroupBox");
#endif
} else if (elementName == "GUIgroupBox") { } else if (elementName == "GUIgroupBox") {
text = tr("GUIgroupBox"); text = tr("GUIgroupBox");
} }