diff --git a/rpcs3/headless_application.cpp b/rpcs3/headless_application.cpp index 3cb0dabefa..1b0572d748 100644 --- a/rpcs3/headless_application.cpp +++ b/rpcs3/headless_application.cpp @@ -1,6 +1,7 @@ #include "headless_application.h" #include "Emu/RSX/GSRender.h" +#include "Emu/RSX/Null/NullGSRender.h" #include "Emu/Cell/Modules/cellMsgDialog.h" #include "Emu/Cell/Modules/cellOskDialog.h" #include "Emu/Cell/Modules/cellSaveData.h" @@ -54,7 +55,38 @@ void headless_application::InitializeCallbacks() RequestCallAfter(std::move(func)); }; - callbacks.get_gs_frame = []() -> std::unique_ptr { return std::unique_ptr(); }; + callbacks.init_gs_render = []() + { + switch (video_renderer type = g_cfg.video.renderer) + { + case video_renderer::null: + { + g_fxo->init>(); + break; + } + case video_renderer::opengl: +#if defined(_WIN32) || defined(HAVE_VULKAN) + case video_renderer::vulkan: +#endif + { + fmt::throw_exception("Headless mode can only be used with the %s video renderer. Current renderer: %s", video_renderer::null, type); + } + default: + { + fmt::throw_exception("Invalid video renderer: %s" HERE, type); + } + } + }; + + callbacks.get_gs_frame = []() -> std::unique_ptr + { + if (g_cfg.video.renderer != video_renderer::null) + { + fmt::throw_exception("Headless mode can only be used with the %s video renderer. Current renderer: %s", video_renderer::null, g_cfg.video.renderer.get()); + } + return std::unique_ptr(); + }; + callbacks.get_msg_dialog = []() -> std::shared_ptr { return std::shared_ptr(); }; callbacks.get_osk_dialog = []() -> std::shared_ptr { return std::shared_ptr(); }; callbacks.get_save_dialog = []() -> std::unique_ptr { return std::unique_ptr(); }; diff --git a/rpcs3/main.cpp b/rpcs3/main.cpp index 8d2155269e..1948b5912a 100644 --- a/rpcs3/main.cpp +++ b/rpcs3/main.cpp @@ -62,7 +62,7 @@ LOG_CHANNEL(sys_log, "SYS"); if (s_headless) { fprintf(stderr, "RPCS3: %s\n", text.c_str()); - return; + std::abort(); } const bool local = s_qt_init.try_lock(); diff --git a/rpcs3/main_application.cpp b/rpcs3/main_application.cpp index 7eedd444f4..52e5490217 100644 --- a/rpcs3/main_application.cpp +++ b/rpcs3/main_application.cpp @@ -2,6 +2,8 @@ #include "Input/pad_thread.h" #include "Emu/System.h" +#include "Emu/system_config.h" +#include "Emu/IdManager.h" #include "Emu/Io/Null/NullKeyboardHandler.h" #include "Emu/Io/Null/NullMouseHandler.h" #include "Emu/Io/KeyboardHandler.h" @@ -25,14 +27,6 @@ #include "Emu/Audio/FAudio/FAudioBackend.h" #endif -#include "Emu/RSX/GSRender.h" -#include "Emu/RSX/Null/NullGSRender.h" -#include "Emu/RSX/GL/GLGSRender.h" - -#if defined(_WIN32) || defined(HAVE_VULKAN) -#include "Emu/RSX/VK/VKGSRender.h" -#endif - LOG_CHANNEL(sys_log, "SYS"); /** Emu.Init() wrapper for user manager */ @@ -110,31 +104,6 @@ EmuCallbacks main_application::CreateCallbacks() g_fxo->init(get_thread(), m_game_window, title_id); }; - callbacks.init_gs_render = []() - { - switch (video_renderer type = g_cfg.video.renderer) - { - case video_renderer::null: - { - g_fxo->init>(); - break; - } - case video_renderer::opengl: - { - g_fxo->init>(); - break; - } -#if defined(_WIN32) || defined(HAVE_VULKAN) - case video_renderer::vulkan: - { - g_fxo->init>(); - break; - } -#endif - default: fmt::throw_exception("Invalid video renderer: %s" HERE, type); - } - }; - callbacks.get_audio = []() -> std::shared_ptr { std::shared_ptr result; diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index 1cebf476d7..e9b64bd5f4 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -29,6 +29,14 @@ #include +#include "Emu/RSX/GSRender.h" +#include "Emu/RSX/Null/NullGSRender.h" +#include "Emu/RSX/GL/GLGSRender.h" + +#if defined(_WIN32) || defined(HAVE_VULKAN) +#include "Emu/RSX/VK/VKGSRender.h" +#endif + LOG_CHANNEL(gui_log, "GUI"); gui_application::gui_application(int& argc, char** argv) : QApplication(argc, argv) @@ -290,6 +298,34 @@ void gui_application::InitializeCallbacks() RequestCallAfter(std::move(func)); }; + callbacks.init_gs_render = []() + { + switch (video_renderer type = g_cfg.video.renderer) + { + case video_renderer::null: + { + g_fxo->init>(); + break; + } + case video_renderer::opengl: + { + g_fxo->init>(); + break; + } +#if defined(_WIN32) || defined(HAVE_VULKAN) + case video_renderer::vulkan: + { + g_fxo->init>(); + break; + } +#endif + default: + { + fmt::throw_exception("Invalid video renderer: %s" HERE, type); + } + } + }; + 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; };