diff options
| author | 2026-02-07 12:38:30 +0100 | |
|---|---|---|
| committer | 2026-02-07 12:38:43 +0100 | |
| commit | 3c00ac28f354e08eb8adcbbe7e40cde3a15dc956 (patch) | |
| tree | d58c00122227956fea91da534669877935ee2883 /src/frontend | |
| parent | 561f214f51b1a205e0d5050642c000d22faf295c (diff) | |
ui: add throttled frame update to another startup event loop and sleep for 1ms
Diffstat (limited to 'src/frontend')
| -rw-r--r-- | src/frontend/mame/ui/ui.cpp | 33 | ||||
| -rw-r--r-- | src/frontend/mame/ui/ui.h | 1 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index be1342b15c7..3b63c90fe23 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -266,6 +266,7 @@ mame_ui_manager::mame_ui_manager(running_machine &machine) , m_showfps_end(0) , m_show_profiler(false) , m_popup_text_end(0) + , m_last_frame_update(0) , m_mouse_bitmap(32, 32) , m_mouse_arrow_texture(nullptr) , m_pointers_changed(false) @@ -339,7 +340,7 @@ void mame_ui_manager::update_target_font_height() //------------------------------------------------- -// exit - called for each emulated frame +// frame_update - called for each emulated frame //------------------------------------------------- void mame_ui_manager::frame_update() @@ -354,6 +355,8 @@ void mame_ui_manager::frame_update() target->update_pointer_fields(); } } + + m_last_frame_update = osd_ticks(); } @@ -835,15 +838,11 @@ void mame_ui_manager::display_startup_screens(bool first_time) // loop while we have a handler while (m_handler_callback_type == ui_callback_type::MODAL && !machine().scheduled_event_pending() && !ui::menu::stack_has_special_main_menu(*this)) { - static osd_ticks_t lastupdatetime = 0; - osd_ticks_t curtime = osd_ticks(); + osd_sleep(osd_ticks_per_second() / 1000); - // don't update more than 60 times/second - if ((curtime - lastupdatetime) > osd_ticks_per_second() / 60) - { - lastupdatetime = curtime; + // don't update more than 60 times per second + if ((osd_ticks() - m_last_frame_update) > (osd_ticks_per_second() / screen_device::DEFAULT_FRAME_RATE)) machine().video().frame_update(); - } } } @@ -867,7 +866,13 @@ void mame_ui_manager::display_startup_screens(bool first_time) // loop while we have a handler while (m_handler_callback_type != ui_callback_type::GENERAL && !machine().scheduled_event_pending()) - machine().video().frame_update(); + { + osd_sleep(osd_ticks_per_second() / 1000); + + // don't update more than 60 times per second + if ((osd_ticks() - m_last_frame_update) > (osd_ticks_per_second() / screen_device::DEFAULT_FRAME_RATE)) + machine().video().frame_update(); + } } } @@ -879,18 +884,12 @@ void mame_ui_manager::display_startup_screens(bool first_time) void mame_ui_manager::set_startup_text(const char *text, bool force) { - static osd_ticks_t lastupdatetime = 0; - osd_ticks_t curtime = osd_ticks(); - // copy in the new text messagebox_text.assign(text); - // don't update more than 4 times/second - if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4) - { - lastupdatetime = curtime; + // don't update more than 10 times per second + if (force || (osd_ticks() - m_last_frame_update) > (osd_ticks_per_second() / 10)) machine().video().frame_update(); - } } diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h index f64f43f0df3..cb856f9139c 100644 --- a/src/frontend/mame/ui/ui.h +++ b/src/frontend/mame/ui/ui.h @@ -301,6 +301,7 @@ private: osd_ticks_t m_showfps_end; bool m_show_profiler; osd_ticks_t m_popup_text_end; + osd_ticks_t m_last_frame_update; std::unique_ptr<uint8_t []> m_non_char_keys_down; pointer_options_vector m_pointer_options; |
