diff --git a/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp b/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp index 42d2fe6338..7fcebf1bd3 100644 --- a/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp @@ -47,7 +47,7 @@ error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr msgString, if (res == CELL_OK && is_blocking) { - if (auto manager = fxm::get()) + if (auto manager = g_fxo->get()) { while (auto dlg = manager->get()) { @@ -167,7 +167,7 @@ error_code cellMsgDialogOpen2(u32 type, vm::cptr msgString, vm::ptr()) + if (auto manager = g_fxo->get()) { if (manager->get()) { @@ -338,7 +338,7 @@ error_code cellMsgDialogClose(f32 delay) extern u64 get_guest_system_time(); const u64 wait_until = get_guest_system_time() + static_cast(std::max(delay, 0.0f) * 1000); - if (auto manager = fxm::get()) + if (auto manager = g_fxo->get()) { if (auto dlg = manager->get()) { @@ -388,7 +388,7 @@ error_code cellMsgDialogAbort() { cellSysutil.warning("cellMsgDialogAbort()"); - if (auto manager = fxm::get()) + if (auto manager = g_fxo->get()) { if (auto dlg = manager->get()) { @@ -437,7 +437,7 @@ error_code cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::cptr m return CELL_MSGDIALOG_ERROR_PARAM; } - if (auto manager = fxm::get()) + if (auto manager = g_fxo->get()) { if (auto dlg = manager->get()) { @@ -469,7 +469,7 @@ error_code cellMsgDialogProgressBarReset(u32 progressBarIndex) { cellSysutil.warning("cellMsgDialogProgressBarReset(progressBarIndex=%d)", progressBarIndex); - if (auto manager = fxm::get()) + if (auto manager = g_fxo->get()) { if (auto dlg = manager->get()) { @@ -501,7 +501,7 @@ error_code cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta) { cellSysutil.warning("cellMsgDialogProgressBarInc(progressBarIndex=%d, delta=%d)", progressBarIndex, delta); - if (auto manager = fxm::get()) + if (auto manager = g_fxo->get()) { if (auto dlg = manager->get()) { diff --git a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp index b217206f96..d81f56b2ae 100644 --- a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp @@ -34,7 +34,7 @@ OskDialogBase::~OskDialogBase() std::shared_ptr _get_osk_dialog(bool always = false) { - if (auto manager = fxm::get()) + if (auto manager = g_fxo->get()) { // NOTE: Osk lifetime is managed by fxm, not display manager // Visibility is still managed by display manager diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 32b0f997af..51d00338a9 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -38,7 +38,6 @@ GLGSRender::GLGSRender() : GSRender() supports_hw_a2c = false; supports_multidraw = true; - supports_native_ui = (bool)g_cfg.misc.use_native_interface; } extern CellGcmContextData current_context; @@ -896,7 +895,7 @@ void GLGSRender::on_init_thread() m_gl_texture_cache.initialize(); - if (!supports_native_ui) + if (!m_overlay_manager) { m_frame->hide(); m_shaders_cache->load(nullptr); @@ -918,7 +917,7 @@ void GLGSRender::on_init_thread() type.disable_cancel = true; type.progress_bar_count = 2; - dlg = fxm::get()->create((bool)g_cfg.video.shader_preloading_dialog.use_custom_background); + dlg = g_fxo->get()->create((bool)g_cfg.video.shader_preloading_dialog.use_custom_background); dlg->progress_bar_set_taskbar_index(-1); dlg->show("Loading precompiled shaders from disk...", type, [](s32 status) { diff --git a/rpcs3/Emu/RSX/Overlays/overlays.cpp b/rpcs3/Emu/RSX/Overlays/overlays.cpp index 2337832c9c..a9b186eba4 100644 --- a/rpcs3/Emu/RSX/Overlays/overlays.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlays.cpp @@ -309,7 +309,7 @@ namespace rsx { // Force unload exit = true; - if (auto manager = fxm::get()) + if (auto manager = g_fxo->get()) { if (auto dlg = manager->get()) { diff --git a/rpcs3/Emu/RSX/Overlays/overlays.h b/rpcs3/Emu/RSX/Overlays/overlays.h index 1336dbd03a..ec70df4690 100644 --- a/rpcs3/Emu/RSX/Overlays/overlays.h +++ b/rpcs3/Emu/RSX/Overlays/overlays.h @@ -97,7 +97,7 @@ namespace rsx class display_manager { private: - atomic_t m_uid_ctr { 0u }; + atomic_t m_uid_ctr = 0; std::vector> m_iface_list; std::vector> m_dirty_list; @@ -158,8 +158,10 @@ namespace rsx } public: - display_manager() = default; - ~display_manager() = default; + // Disable default construction to make it conditionally available in g_fxo + explicit display_manager(int) noexcept + { + } // Adds an object to the internal list. Optionally removes other objects of the same type. // Original handle loses ownership but a usable pointer is returned diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index e6799bacee..fe9c161a54 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -271,6 +271,11 @@ namespace rsx memset(m_vertex_textures_dirty, -1, sizeof(m_vertex_textures_dirty)); m_graphics_state = pipeline_state::all_dirty; + + if (g_cfg.misc.use_native_interface && (g_cfg.video.renderer == video_renderer::opengl || g_cfg.video.renderer == video_renderer::vulkan)) + { + m_overlay_manager = g_fxo->init(0); + } } thread::~thread() @@ -420,10 +425,8 @@ namespace rsx return fmt::format("RSX [0x%07x]", +rsx->ctrl->get); }; - if (supports_native_ui) + if (m_overlay_manager) { - m_overlay_manager = fxm::make_always(); - if (g_cfg.video.perf_overlay.perf_overlay_enabled) { auto perf_overlay = m_overlay_manager->create(); diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 082799ae40..f50d946208 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -429,7 +429,6 @@ namespace rsx bool skip_frame = false; bool supports_multidraw = false; // Draw call batching - bool supports_native_ui = false; // Native UI rendering bool supports_hw_a2c = false; // Alpha to coverage // FIFO @@ -447,7 +446,7 @@ namespace rsx bool framebuffer_status_valid = false; // Overlays - std::shared_ptr m_overlay_manager; + rsx::overlays::display_manager* m_overlay_manager = nullptr; // Invalidated memory range address_range m_invalidated_memory_range; diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 028aec2335..5e0b5fbbbd 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -529,7 +529,6 @@ VKGSRender::VKGSRender() : GSRender() m_ui_renderer->create(*m_current_command_buffer, m_texture_upload_buffer_ring_info); supports_multidraw = true; - supports_native_ui = (bool)g_cfg.misc.use_native_interface; // NOTE: We do not actually need multiple sample support for A2C to work // This is here for visual consistency - will be removed when AA problems due to mipmaps are fixed supports_hw_a2c = (g_cfg.video.antialiasing_level != msaa_level::none); @@ -1809,7 +1808,7 @@ void VKGSRender::on_init_thread() GSRender::on_init_thread(); zcull_ctrl.reset(static_cast<::rsx::reports::ZCULL_control*>(this)); - if (!supports_native_ui) + if (!m_overlay_manager) { m_frame->hide(); m_shaders_cache->load(nullptr, *m_device, pipeline_layout); @@ -1831,7 +1830,7 @@ void VKGSRender::on_init_thread() type.disable_cancel = true; type.progress_bar_count = 2; - dlg = fxm::get()->create((bool)g_cfg.video.shader_preloading_dialog.use_custom_background); + dlg = g_fxo->get()->create((bool)g_cfg.video.shader_preloading_dialog.use_custom_background); dlg->progress_bar_set_taskbar_index(-1); dlg->show("Loading precompiled shaders from disk...", type, [](s32 status) { diff --git a/rpcs3/rpcs3qt/save_data_dialog.cpp b/rpcs3/rpcs3qt/save_data_dialog.cpp index 282e4f6467..e5da72787f 100644 --- a/rpcs3/rpcs3qt/save_data_dialog.cpp +++ b/rpcs3/rpcs3qt/save_data_dialog.cpp @@ -7,7 +7,7 @@ s32 save_data_dialog::ShowSaveDataList(std::vector& save_entries, s32 focused, u32 op, vm::ptr listSet) { // TODO: Install native shell as an Emu callback - if (auto manager = fxm::get()) + if (auto manager = g_fxo->get()) { auto result = manager->create()->show(save_entries, focused, op, listSet); if (result != rsx::overlays::user_interface::selection_code::error) diff --git a/rpcs3/rpcs3qt/trophy_notification_helper.cpp b/rpcs3/rpcs3qt/trophy_notification_helper.cpp index 9ae7016a6f..9def126b74 100644 --- a/rpcs3/rpcs3qt/trophy_notification_helper.cpp +++ b/rpcs3/rpcs3qt/trophy_notification_helper.cpp @@ -7,7 +7,7 @@ s32 trophy_notification_helper::ShowTrophyNotification(const SceNpTrophyDetails& trophy, const std::vector& trophy_icon_buffer) { - if (auto manager = fxm::get()) + if (auto manager = g_fxo->get()) { return manager->create()->show(trophy, trophy_icon_buffer); }