From 64834145ae2b4b0ad0ed499a7b059792310de276 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 27 Apr 2024 04:42:12 +1000 Subject: [PATCH] -osd: Update slider list on demand rather than on frame updated (fixes MT08857). -konami/konamigq.cpp: No need to cancel a newly allocated timer. --- docs/source/commandline/sdlconfig.rst | 2 +- src/mame/konami/konamigq.cpp | 1 - src/osd/mac/osdmac.h | 4 ---- src/osd/mac/window.cpp | 25 +----------------------- src/osd/modules/lib/osdobj_common.cpp | 28 ++++++++++++++++++++++++--- src/osd/modules/lib/osdobj_common.h | 3 --- src/osd/sdl/osdsdl.h | 4 ---- src/osd/sdl/window.cpp | 24 ----------------------- src/osd/windows/window.cpp | 28 +-------------------------- src/osd/windows/winmain.h | 4 ---- 10 files changed, 28 insertions(+), 95 deletions(-) diff --git a/docs/source/commandline/sdlconfig.rst b/docs/source/commandline/sdlconfig.rst index 3d3582fa69e32..a6f3a7d8e519c 100644 --- a/docs/source/commandline/sdlconfig.rst +++ b/docs/source/commandline/sdlconfig.rst @@ -62,7 +62,7 @@ SDL Keyboard Mapping SDL Input Options --------------------- +----------------- .. _mame-scommandline-enabletouch: diff --git a/src/mame/konami/konamigq.cpp b/src/mame/konami/konamigq.cpp index ba8291a3444ac..17ecb2323c247 100644 --- a/src/mame/konami/konamigq.cpp +++ b/src/mame/konami/konamigq.cpp @@ -330,7 +330,6 @@ void konamigq_state::machine_start() save_item(NAME(m_sound_intck)); m_dma_timer = timer_alloc(FUNC(konamigq_state::scsi_dma_transfer), this); - m_dma_timer->adjust(attotime::never); } void konamigq_state::machine_reset() diff --git a/src/osd/mac/osdmac.h b/src/osd/mac/osdmac.h index 04d5a0e1b2cab..081c5757c17ed 100644 --- a/src/osd/mac/osdmac.h +++ b/src/osd/mac/osdmac.h @@ -68,10 +68,6 @@ class mac_osd_interface : public osd_common_t virtual mac_options &options() override { return m_options; } -protected: - virtual void build_slider_list() override; - virtual void update_slider_list() override; - private: virtual void osd_exit() override; diff --git a/src/osd/mac/window.cpp b/src/osd/mac/window.cpp index f4fc7b7f8b033..161bc8b677b78 100644 --- a/src/osd/mac/window.cpp +++ b/src/osd/mac/window.cpp @@ -73,30 +73,6 @@ bool mac_osd_interface::window_init() } -void mac_osd_interface::update_slider_list() -{ - for (auto const &window : osd_common_t::window_list()) - { - // check if any window has dirty sliders - if (window->renderer().sliders_dirty()) - { - build_slider_list(); - return; - } - } -} - -void mac_osd_interface::build_slider_list() -{ - m_sliders.clear(); - - for (auto const &window : osd_common_t::window_list()) - { - std::vector window_sliders = window->renderer().get_slider_list(); - m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end()); - } -} - void mac_osd_interface::process_events() { } @@ -106,6 +82,7 @@ bool mac_osd_interface::has_focus() const return true; } + //============================================================ // macwindow_exit // (main thread) diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 46a709b415fab..12ba7cb8042b6 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -463,9 +463,6 @@ void osd_common_t::update(bool skip_redraw) // if (m_watchdog != nullptr) m_watchdog->reset(); - - update_slider_list(); - } @@ -568,6 +565,31 @@ void osd_common_t::customize_input_type_list(std::vector &type std::vector osd_common_t::get_slider_list() { + // check if any window has dirty sliders + bool dirty = false; + for (const auto &window : window_list()) + { + if (window->has_renderer() && window->renderer().sliders_dirty()) + { + dirty = true; + break; + } + } + + if (dirty) + { + m_sliders.clear(); + + for (const auto &window : osd_common_t::window_list()) + { + if (window->has_renderer()) + { + std::vector window_sliders = window->renderer().get_slider_list(); + m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end()); + } + } + } + return m_sliders; } diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 919bbc4f717de..1bcebb5afa93b 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -277,9 +277,6 @@ class osd_common_t : public osd_interface, osd_output protected: virtual bool input_init(); - virtual void build_slider_list() { } - virtual void update_slider_list() { } - void poll_input_modules(bool relative_reset); static std::list > s_window_list; diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index e1d472d9e4582..74730f69df522 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -168,10 +168,6 @@ class sdl_osd_interface : public osd_common_t, public sdl_event_manager virtual void process_events() override; -protected: - virtual void build_slider_list() override; - virtual void update_slider_list() override; - private: enum { diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 1e6318f57a969..ff79388ea5de6 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -111,30 +111,6 @@ bool sdl_osd_interface::window_init() } -void sdl_osd_interface::update_slider_list() -{ - for (auto const &window : osd_common_t::window_list()) - { - // check if any window has dirty sliders - if (window->renderer().sliders_dirty()) - { - build_slider_list(); - return; - } - } -} - -void sdl_osd_interface::build_slider_list() -{ - m_sliders.clear(); - - for (auto const &window : osd_common_t::window_list()) - { - std::vector window_sliders = window->renderer().get_slider_list(); - m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end()); - } -} - //============================================================ // sdlwindow_exit // (main thread) diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 30afd7bc9d37d..c4929f1d82c0f 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -146,39 +146,12 @@ bool windows_osd_interface::window_init() return true; } -void windows_osd_interface::update_slider_list() -{ - for (const auto &window : osd_common_t::window_list()) - { - // check if any window has dirty sliders - if (window->has_renderer() && window->renderer().sliders_dirty()) - { - build_slider_list(); - return; - } - } -} int windows_osd_interface::window_count() { return osd_common_t::window_list().size(); } -void windows_osd_interface::build_slider_list() -{ - m_sliders.clear(); - - for (const auto &window : osd_common_t::window_list()) - { - if (window->has_renderer()) - { - // take the sliders of the first window - std::vector window_sliders = window->renderer().get_slider_list(); - m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end()); - } - } -} - void windows_osd_interface::add_audio_to_recording(const int16_t *buffer, int samples_this_frame) { auto const &window = osd_common_t::window_list().front(); // We only record on the first window @@ -186,6 +159,7 @@ void windows_osd_interface::add_audio_to_recording(const int16_t *buffer, int sa window->renderer().add_audio_to_recording(buffer, samples_this_frame); } + //============================================================ // winwindow_exit // (main thread) diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index 16bde1ddff482..5b8e992be6bac 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -92,10 +92,6 @@ class windows_osd_interface : public osd_common_t using osd_common_t::poll_input_modules; // Win32 debugger calls this directly, which it shouldn't -protected: - virtual void build_slider_list() override; - virtual void update_slider_list() override; - private: void process_events(bool ingame, bool nodispatch); virtual void osd_exit() override;