diff --git a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp index f685f50587..2dfb75f70f 100644 --- a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "Emu/System.h" #include "Emu/IdManager.h" #include "Emu/Cell/PPUModule.h" diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index f4e4d403ed..2482d55b6d 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -250,6 +250,7 @@ class Emulator final u32 m_usrid{1}; bool m_force_boot = false; + bool m_has_gui = true; public: Emulator() = default; @@ -372,6 +373,9 @@ public: bool IsStopped() const { return m_state == system_state::stopped; } bool IsReady() const { return m_state == system_state::ready; } auto GetStatus() const { return m_state.load(); } + + bool HasGui() const { return m_has_gui; } + void SetHasGui(bool has_gui) { m_has_gui = has_gui; } }; extern Emulator Emu; diff --git a/rpcs3/headless_application.cpp b/rpcs3/headless_application.cpp index cc88fe3b1e..67d003cbb8 100644 --- a/rpcs3/headless_application.cpp +++ b/rpcs3/headless_application.cpp @@ -14,7 +14,7 @@ headless_application::headless_application(int& argc, char** argv) : QCoreApplic void headless_application::Init() { // Force init the emulator - InitializeEmulator("1", true); // TODO: get user from cli args if possible + InitializeEmulator("1", true, false); // TODO: get user from cli args if possible // Create callbacks from the emulator, which reference the handlers. InitializeCallbacks(); diff --git a/rpcs3/main_application.cpp b/rpcs3/main_application.cpp index f233ea946c..ce03e5a839 100644 --- a/rpcs3/main_application.cpp +++ b/rpcs3/main_application.cpp @@ -44,8 +44,10 @@ #endif /** Emu.Init() wrapper for user manager */ -bool main_application::InitializeEmulator(const std::string& user, bool force_init) +bool main_application::InitializeEmulator(const std::string& user, bool force_init, bool show_gui) { + Emu.SetHasGui(show_gui); + // try to set a new user const bool user_was_set = Emu.SetUsr(user); diff --git a/rpcs3/main_application.h b/rpcs3/main_application.h index 7f52d9d655..7931c8252c 100644 --- a/rpcs3/main_application.h +++ b/rpcs3/main_application.h @@ -9,7 +9,7 @@ class main_application public: virtual void Init() = 0; - static bool InitializeEmulator(const std::string& user, bool force_init); + static bool InitializeEmulator(const std::string& user, bool force_init, bool show_gui); protected: virtual QThread* get_thread() = 0; diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index 7c30fb47c2..c0f0ef0fc7 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -37,7 +37,7 @@ void gui_application::Init() m_gui_settings.reset(new gui_settings()); // Force init the emulator - InitializeEmulator(m_gui_settings->GetCurrentUser().toStdString(), true); + InitializeEmulator(m_gui_settings->GetCurrentUser().toStdString(), true, m_show_gui); // Create the main window if (m_show_gui) @@ -182,8 +182,8 @@ void gui_application::InitializeCallbacks() callbacks.get_gs_frame = [this]() -> std::unique_ptr { return get_gs_frame(); }; callbacks.get_msg_dialog = [this]() -> std::shared_ptr { return m_show_gui ? std::make_shared() : nullptr; }; callbacks.get_osk_dialog = [this]() -> std::shared_ptr { return m_show_gui ? std::make_shared() : nullptr; }; - callbacks.get_save_dialog = [this]() -> std::unique_ptr { return m_show_gui ? std::make_unique() : nullptr; }; - callbacks.get_trophy_notification_dialog = [this]() -> std::unique_ptr { return m_show_gui ? std::make_unique(m_game_window) : nullptr; }; + callbacks.get_save_dialog = []() -> std::unique_ptr { return std::make_unique(); }; + callbacks.get_trophy_notification_dialog = [this]() -> std::unique_ptr { return std::make_unique(m_game_window); }; callbacks.on_run = [=]() { OnEmulatorRun(); }; callbacks.on_pause = [=]() { OnEmulatorPause(); }; diff --git a/rpcs3/rpcs3qt/save_data_dialog.cpp b/rpcs3/rpcs3qt/save_data_dialog.cpp index e5da72787f..2208174eb0 100644 --- a/rpcs3/rpcs3qt/save_data_dialog.cpp +++ b/rpcs3/rpcs3qt/save_data_dialog.cpp @@ -14,6 +14,11 @@ s32 save_data_dialog::ShowSaveDataList(std::vector& save_entries, return result; } + if (!Emu.HasGui()) + { + return -2; + } + // Fall back to front-end GUI atomic_t dlg_result(false); atomic_t selection; diff --git a/rpcs3/rpcs3qt/trophy_notification_helper.cpp b/rpcs3/rpcs3qt/trophy_notification_helper.cpp index 9def126b74..bd0d636dcb 100644 --- a/rpcs3/rpcs3qt/trophy_notification_helper.cpp +++ b/rpcs3/rpcs3qt/trophy_notification_helper.cpp @@ -1,4 +1,4 @@ -#include "trophy_notification_helper.h" +#include "trophy_notification_helper.h" #include "trophy_notification_frame.h" @@ -12,6 +12,11 @@ s32 trophy_notification_helper::ShowTrophyNotification(const SceNpTrophyDetails& return manager->create()->show(trophy, trophy_icon_buffer); } + if (!Emu.HasGui()) + { + return 0; + } + Emu.CallAfter([=] { trophy_notification_frame* trophy_notification = new trophy_notification_frame(trophy_icon_buffer, trophy, m_game_window->frameGeometry().height() / 10); diff --git a/rpcs3/rpcs3qt/trophy_notification_helper.h b/rpcs3/rpcs3qt/trophy_notification_helper.h index ce73167a9e..b2c7fd7ea9 100644 --- a/rpcs3/rpcs3qt/trophy_notification_helper.h +++ b/rpcs3/rpcs3qt/trophy_notification_helper.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "stdafx.h" #include "Emu/Memory/vm.h" diff --git a/rpcs3/rpcs3qt/user_manager_dialog.cpp b/rpcs3/rpcs3qt/user_manager_dialog.cpp index f0a755a77d..2f5a6d6f24 100644 --- a/rpcs3/rpcs3qt/user_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/user_manager_dialog.cpp @@ -368,7 +368,7 @@ void user_manager_dialog::OnUserLogin() const u32 key = GetUserKey(); const std::string new_user = m_user_list[key].GetUserId(); - if (!main_application::InitializeEmulator(new_user, false)) + if (!main_application::InitializeEmulator(new_user, false, Emu.HasGui())) { LOG_FATAL(GENERAL, "Failed to login user! username=%s key=%d", new_user, key); return;