From 05d12f68ad01d64fed29320d76771fae174300e5 Mon Sep 17 00:00:00 2001 From: Darkhost1999 <60384196+Darkhost1999@users.noreply.github.com> Date: Wed, 4 Dec 2024 08:27:55 -0600 Subject: [PATCH 1/4] Test Works on my machine --- rpcs3/Emu/Cell/lv2/sys_fs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 9fe295894a..29401b922b 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -22,7 +22,7 @@ LOG_CHANNEL(sys_fs); lv2_fs_mount_point g_mp_sys_dev_usb{"/dev_usb", "CELL_FS_FAT", "CELL_FS_IOS:USB_MASS_STORAGE", 512, 0x100, 4096, lv2_mp_flag::no_uid_gid}; lv2_fs_mount_point g_mp_sys_dev_dvd{"/dev_ps2disc", "CELL_FS_ISO9660", "CELL_FS_IOS:PATA1_BDVD_DRIVE", 2048, 0x100, 32768, lv2_mp_flag::read_only + lv2_mp_flag::no_uid_gid, &g_mp_sys_dev_usb}; -lv2_fs_mount_point g_mp_sys_dev_bdvd{"/dev_bdvd", "CELL_FS_ISO9660", "CELL_FS_IOS:PATA0_BDVD_DRIVE", 2048, 0x4D955, 65536, lv2_mp_flag::read_only + lv2_mp_flag::no_uid_gid, &g_mp_sys_dev_dvd}; +lv2_fs_mount_point g_mp_sys_dev_bdvd{"/dev_bdvd", "CELL_FS_ISO9660", "CELL_FS_IOS:PATA0_BDVD_DRIVE", 2048, 0x4D955, 2048, lv2_mp_flag::read_only + lv2_mp_flag::no_uid_gid, &g_mp_sys_dev_dvd}; lv2_fs_mount_point g_mp_sys_dev_hdd1{"/dev_hdd1", "CELL_FS_FAT", "CELL_FS_UTILITY:HDD1", 512, 0x3FFFF8, 32768, lv2_mp_flag::no_uid_gid + lv2_mp_flag::cache, &g_mp_sys_dev_bdvd}; lv2_fs_mount_point g_mp_sys_dev_hdd0{"/dev_hdd0", "CELL_FS_UFS", "CELL_FS_UTILITY:HDD0", 512, 0x24FAEA98, 4096, {}, &g_mp_sys_dev_hdd1}; lv2_fs_mount_point g_mp_sys_dev_flash3{"/dev_flash3", "CELL_FS_FAT", "CELL_FS_IOS:BUILTIN_FLSH3", 512, 0x400, 8192, lv2_mp_flag::no_uid_gid, &g_mp_sys_dev_hdd0}; // TODO confirm From 24655fd9758ee7f568c121b39866e6ab23eb7d4c Mon Sep 17 00:00:00 2001 From: Antonino Di Guardo <64427768+digant73@users.noreply.github.com> Date: Fri, 6 Dec 2024 20:14:35 +0100 Subject: [PATCH 2/4] fix dark theme switching on initial welcome dialog (#16373) --- rpcs3/rpcs3qt/gui_application.cpp | 12 ------------ rpcs3/rpcs3qt/gui_settings.h | 7 ++++--- rpcs3/rpcs3qt/qt_utils.h | 2 ++ rpcs3/rpcs3qt/welcome_dialog.cpp | 10 +++++++--- rpcs3/rpcs3qt/welcome_dialog.h | 5 ----- 5 files changed, 13 insertions(+), 23 deletions(-) diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index e41ee9ce69..02e55416e3 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -161,19 +161,7 @@ bool gui_application::Init() { welcome_dialog* welcome = new welcome_dialog(m_gui_settings, false); - bool use_dark_theme = false; - - connect(welcome, &QDialog::accepted, this, [&]() - { - use_dark_theme = welcome->does_user_want_dark_theme(); - }); - welcome->exec(); - - if (use_dark_theme) - { - m_gui_settings->SetValue(gui::m_currentStylesheet, "Darker Style by TheMitoSan"); - } } // Check maxfiles diff --git a/rpcs3/rpcs3qt/gui_settings.h b/rpcs3/rpcs3qt/gui_settings.h index 98835431b5..7a3b3535a3 100644 --- a/rpcs3/rpcs3qt/gui_settings.h +++ b/rpcs3/rpcs3qt/gui_settings.h @@ -87,10 +87,11 @@ namespace gui return q_string_pair(path, title.simplified()); // simplified() forces single line text } - const QString Settings = "CurrentSettings"; + const QString Settings = "CurrentSettings"; const QString DefaultStylesheet = "default"; - const QString NoStylesheet = "none"; - const QString NativeStylesheet = "native"; + const QString NoStylesheet = "none"; + const QString NativeStylesheet = "native"; + const QString DarkStylesheet = "Darker Style by TheMitoSan"; const QString main_window = "main_window"; const QString game_list = "GameList"; diff --git a/rpcs3/rpcs3qt/qt_utils.h b/rpcs3/rpcs3qt/qt_utils.h index 11e4341927..fbac5270f5 100644 --- a/rpcs3/rpcs3qt/qt_utils.h +++ b/rpcs3/rpcs3qt/qt_utils.h @@ -150,11 +150,13 @@ namespace gui static inline Qt::ColorScheme color_scheme() { + // use the QGuiApplication's properties to report the default GUI color scheme return QGuiApplication::styleHints()->colorScheme(); } static inline bool dark_mode_active() { + // "true" if the default GUI color scheme is dark. "false" otherwise return color_scheme() == Qt::ColorScheme::Dark; } diff --git a/rpcs3/rpcs3qt/welcome_dialog.cpp b/rpcs3/rpcs3qt/welcome_dialog.cpp index 0dce4ecd4c..00860f58a5 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.cpp +++ b/rpcs3/rpcs3qt/welcome_dialog.cpp @@ -22,10 +22,11 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool setWindowFlag(Qt::WindowCloseButtonHint, is_manual_show); ui->okay->setEnabled(is_manual_show); - ui->i_have_read->setChecked(is_manual_show); ui->i_have_read->setEnabled(!is_manual_show); + ui->i_have_read->setChecked(is_manual_show); ui->do_not_show->setEnabled(!is_manual_show); ui->do_not_show->setChecked(!m_gui_settings->GetValue(gui::ib_show_welcome).toBool()); + ui->use_dark_theme->setEnabled(!is_manual_show); ui->use_dark_theme->setChecked(gui::utils::dark_mode_active()); ui->icon_label->load(QStringLiteral(":/rpcs3.svg")); ui->label_3->setText(tr( @@ -76,7 +77,7 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool layout()->setSizeConstraint(QLayout::SetFixedSize); - connect(this, &QDialog::finished, this, [this]() + connect(this, &QDialog::accepted, this, [this]() { if (ui->create_desktop_shortcut->isChecked()) { @@ -88,7 +89,10 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool gui::utils::create_shortcut("RPCS3", "", "", "RPCS3", ":/rpcs3.svg", fs::get_temp_dir(), gui::utils::shortcut_location::applications); } - m_user_wants_dark_theme = ui->use_dark_theme->isChecked(); + if (ui->use_dark_theme->isChecked() && ui->use_dark_theme->isEnabled()) // if checked and also on initial welcome dialog + { + m_gui_settings->SetValue(gui::m_currentStylesheet, gui::DarkStylesheet); + } }); } diff --git a/rpcs3/rpcs3qt/welcome_dialog.h b/rpcs3/rpcs3qt/welcome_dialog.h index 6e32117e2c..3f04cfdb9f 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.h +++ b/rpcs3/rpcs3qt/welcome_dialog.h @@ -17,12 +17,7 @@ public: explicit welcome_dialog(std::shared_ptr gui_settings, bool is_manual_show, QWidget* parent = nullptr); ~welcome_dialog(); - bool does_user_want_dark_theme() const - { - return m_user_wants_dark_theme; - } private: std::unique_ptr ui; std::shared_ptr m_gui_settings; - bool m_user_wants_dark_theme = false; }; From cee427ef2c289afe74cce7b17fb91232b42b54c2 Mon Sep 17 00:00:00 2001 From: daviDarthemis Date: Sat, 7 Dec 2024 00:34:14 -0300 Subject: [PATCH 3/4] update --- rpcs3/util/atomic.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpcs3/util/atomic.cpp b/rpcs3/util/atomic.cpp index 48e3cc6dc7..09babab873 100644 --- a/rpcs3/util/atomic.cpp +++ b/rpcs3/util/atomic.cpp @@ -27,10 +27,11 @@ namespace utils #include "Utilities/sync.h" #include "Utilities/StrFmt.h" -#include #ifdef __linux__ +#include + bool is_kernel_at_least(int required_major, int required_minor, int required_patch) { struct utsname buf {}; From 68b7e5971d8e279d7d385b96b5aa2feebd220506 Mon Sep 17 00:00:00 2001 From: Antonino Di Guardo <64427768+digant73@users.noreply.github.com> Date: Sat, 7 Dec 2024 19:56:05 +0100 Subject: [PATCH 4/4] Welcome Dialog: Reject users that reject our TOS * Improved welcome dialog * "show at startup" checkbox always changeable --- rpcs3/rpcs3qt/gui_application.cpp | 6 ++- rpcs3/rpcs3qt/main_window.cpp | 27 ++++++++++--- rpcs3/rpcs3qt/welcome_dialog.cpp | 66 ++++++++++++++++++------------- rpcs3/rpcs3qt/welcome_dialog.ui | 20 +++++++--- 4 files changed, 81 insertions(+), 38 deletions(-) diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index 02e55416e3..fd5a50e326 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -161,7 +161,11 @@ bool gui_application::Init() { welcome_dialog* welcome = new welcome_dialog(m_gui_settings, false); - welcome->exec(); + if (welcome->exec() == QDialog::Rejected) + { + // If the agreement on RPCS3's usage conditions was not accepted by the user, ask the main window to gracefully terminate + return false; + } } // Check maxfiles diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 9c02b4a0d9..09a09ce221 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -1848,12 +1848,29 @@ void main_window::SaveWindowState() const // Save gui settings m_gui_settings->SetValue(gui::mw_geometry, saveGeometry(), false); m_gui_settings->SetValue(gui::mw_windowState, saveState(), false); - m_gui_settings->SetValue(gui::mw_mwState, m_mw->saveState(), true); - // Save column settings - m_game_list_frame->SaveSettings(); - // Save splitter state - m_debugger_frame->SaveSettings(); + // NOTE: + // + // This method is also invoked in case the gui_application::Init() method failed ("false" was returned) + // to initialize some modules leaving other modules uninitialized (NULL pointed). + // So, the following checks on NULL pointer are provided before accessing the related module's object + + if (m_mw) + { + m_gui_settings->SetValue(gui::mw_mwState, m_mw->saveState(), true); + } + + if (m_game_list_frame) + { + // Save column settings + m_game_list_frame->SaveSettings(); + } + + if (m_debugger_frame) + { + // Save splitter state + m_debugger_frame->SaveSettings(); + } } void main_window::RepaintThumbnailIcons() diff --git a/rpcs3/rpcs3qt/welcome_dialog.cpp b/rpcs3/rpcs3qt/welcome_dialog.cpp index 00860f58a5..8d6c6916ed 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.cpp +++ b/rpcs3/rpcs3qt/welcome_dialog.cpp @@ -19,17 +19,12 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); - setWindowFlag(Qt::WindowCloseButtonHint, is_manual_show); + setWindowFlag(Qt::WindowCloseButtonHint, false); // disable the close button shown on the dialog's top right corner + layout()->setSizeConstraint(QLayout::SetFixedSize); - ui->okay->setEnabled(is_manual_show); - ui->i_have_read->setEnabled(!is_manual_show); - ui->i_have_read->setChecked(is_manual_show); - ui->do_not_show->setEnabled(!is_manual_show); - ui->do_not_show->setChecked(!m_gui_settings->GetValue(gui::ib_show_welcome).toBool()); - ui->use_dark_theme->setEnabled(!is_manual_show); - ui->use_dark_theme->setChecked(gui::utils::dark_mode_active()); ui->icon_label->load(QStringLiteral(":/rpcs3.svg")); - ui->label_3->setText(tr( + + ui->label_desc->setText(tr( R"(

RPCS3 is an open-source Sony PlayStation 3 emulator and debugger.
@@ -51,33 +46,44 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool )" ).arg(gui::utils::get_link_style())); +#ifdef __APPLE__ + ui->create_applications_menu_shortcut->setText(tr("&Create Launchpad shortcut")); + ui->use_dark_theme->setVisible(false); + ui->use_dark_theme->setEnabled(false); +#else +#ifndef _WIN32 + ui->create_applications_menu_shortcut->setText(tr("&Create Application Menu shortcut")); +#endif + + ui->use_dark_theme->setVisible(!is_manual_show); + ui->use_dark_theme->setEnabled(!is_manual_show); + ui->use_dark_theme->setChecked(gui::utils::dark_mode_active()); +#endif + + ui->accept->setEnabled(is_manual_show); + ui->reject->setVisible(!is_manual_show); + ui->i_have_read->setVisible(!is_manual_show); + ui->i_have_read->setChecked(is_manual_show); + ui->show_at_startup->setChecked(m_gui_settings->GetValue(gui::ib_show_welcome).toBool()); + if (!is_manual_show) { connect(ui->i_have_read, &QCheckBox::clicked, this, [this](bool checked) { - ui->okay->setEnabled(checked); - }); - - connect(ui->do_not_show, &QCheckBox::clicked, this, [this](bool checked) - { - m_gui_settings->SetValue(gui::ib_show_welcome, QVariant(!checked)); + ui->accept->setEnabled(checked); + ui->reject->setEnabled(!checked); }); } - connect(ui->okay, &QPushButton::clicked, this, &QDialog::accept); + connect(ui->show_at_startup, &QCheckBox::clicked, this, [this](bool checked) + { + m_gui_settings->SetValue(gui::ib_show_welcome, QVariant(checked)); + }); -#ifdef _WIN32 - ui->create_applications_menu_shortcut->setText(tr("&Create Start Menu shortcut")); -#elif defined(__APPLE__) - ui->create_applications_menu_shortcut->setText(tr("&Create Launchpad shortcut")); - ui->use_dark_theme->setVisible(false); -#else - ui->create_applications_menu_shortcut->setText(tr("&Create Application Menu shortcut")); -#endif + connect(ui->accept, &QPushButton::clicked, this, &QDialog::accept); // trigger "accept" signal (setting also dialog's result code to QDialog::Accepted) + connect(ui->reject, &QPushButton::clicked, this, &QDialog::reject); // trigger "reject" signal (setting also dialog's result code to QDialog::Rejected) - layout()->setSizeConstraint(QLayout::SetFixedSize); - - connect(this, &QDialog::accepted, this, [this]() + connect(this, &QDialog::accepted, this, [this]() // "accept" signal's event handler { if (ui->create_desktop_shortcut->isChecked()) { @@ -94,6 +100,12 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool m_gui_settings->SetValue(gui::m_currentStylesheet, gui::DarkStylesheet); } }); + + connect(this, &QDialog::rejected, this, [this]() // "reject" signal's event handler + { + // if the agreement on RPCS3's usage conditions was not accepted by the user, always display the initial welcome dialog at next startup + m_gui_settings->SetValue(gui::ib_show_welcome, QVariant(true)); + }); } welcome_dialog::~welcome_dialog() diff --git a/rpcs3/rpcs3qt/welcome_dialog.ui b/rpcs3/rpcs3qt/welcome_dialog.ui index a1026854ee..5562af0ed7 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.ui +++ b/rpcs3/rpcs3qt/welcome_dialog.ui @@ -103,7 +103,7 @@ - + Arial @@ -201,7 +201,7 @@ - Use Dark Theme (Can Be Configured Later) + Use Dark Theme (can be configured later) @@ -233,7 +233,7 @@ 0 - + Continue @@ -242,6 +242,16 @@ + + + + Exit + + + true + + + @@ -276,9 +286,9 @@ - + - Do not show again + Show at startup