diff --git a/src/emu/video.cpp b/src/emu/video.cpp index 051a596ad20..9cbf89f7625 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -218,7 +218,8 @@ void video_manager::frame_update(bool from_debugger) bool const update_screens = (phase == machine_phase::RUNNING) && (!machine().paused() || machine().options().update_in_pause()); bool anything_changed = update_screens && finish_screen_updates(); - // draw the user interface + // update inputs and draw the user interface + machine().osd().input_update(); emulator_info::draw_user_interface(machine()); // let plugins draw over the UI @@ -246,9 +247,6 @@ void video_manager::frame_update(bool from_debugger) if (!from_debugger && !skipped_it && phase > machine_phase::INIT && m_low_latency && effective_throttle()) update_throttle(current_time); - // get most recent input now - machine().osd().input_update(); - emulator_info::periodic_check(); if (!from_debugger) diff --git a/src/osd/mac/osdmac.h b/src/osd/mac/osdmac.h index 3e1dfe9bb4d..ba1adeb69a8 100644 --- a/src/osd/mac/osdmac.h +++ b/src/osd/mac/osdmac.h @@ -58,7 +58,6 @@ public: virtual void window_exit() override; // sdl specific - void poll_inputs(running_machine &machine); void release_keys(); bool should_hide_mouse(); void process_events_buf(); diff --git a/src/osd/mac/video.cpp b/src/osd/mac/video.cpp index 5fc8111f3db..b97a1f06699 100644 --- a/src/osd/mac/video.cpp +++ b/src/osd/mac/video.cpp @@ -23,6 +23,8 @@ #include "modules/lib/osdlib.h" #include "modules/monitor/monitor_module.h" +extern void MacPollInputs(); // in windowcontroller.mm + //============================================================ // CONSTANTS //============================================================ @@ -124,7 +126,8 @@ void mac_osd_interface::input_update() { // poll the joystick values here process_events_buf(); - poll_inputs(machine()); + MacPollInputs(); + poll_input_modules(); check_osd_inputs(machine()); } diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp index 2793452dbe6..220d0c96e3b 100644 --- a/src/osd/modules/debugger/debugwin.cpp +++ b/src/osd/modules/debugger/debugwin.cpp @@ -195,7 +195,7 @@ void debugger_windows::wait_for_debugger(device_t &device, bool firststop) show_all(); // run input polling to ensure that our status is in sync - downcast(machine().osd()).poll_input(*m_machine); + downcast(machine().osd()).poll_input_modules(); // get and process messages MSG message; diff --git a/src/osd/modules/input/input_common.h b/src/osd/modules/input/input_common.h index 46dcf9d486a..8a5e22478f4 100644 --- a/src/osd/modules/input/input_common.h +++ b/src/osd/modules/input/input_common.h @@ -507,24 +507,15 @@ private: template int generic_button_get_state(void *device_internal, void *item_internal) { - device_info *devinfo = static_cast(device_internal); - TItem *itemdata = static_cast(item_internal); - // return the current state - devinfo->module().poll_if_necessary(); - return *itemdata >> 7; + return *reinterpret_cast(item_internal) >> 7; } template int generic_axis_get_state(void *device_internal, void *item_internal) { - device_info *devinfo = static_cast(device_internal); - TItem *axisdata = static_cast(item_internal); - - // return the current state - devinfo->module().poll_if_necessary(); - return *axisdata; + return *reinterpret_cast(item_internal); } diff --git a/src/osd/modules/input/input_dinput.cpp b/src/osd/modules/input/input_dinput.cpp index 8642f693d03..ce19ed88dfe 100644 --- a/src/osd/modules/input/input_dinput.cpp +++ b/src/osd/modules/input/input_dinput.cpp @@ -1168,7 +1168,6 @@ int32_t dinput_joystick_device::pov_get_state(void *device_internal, void *item_ int const povdir = uintptr_t(item_internal) % 4; // get the current state - devinfo->module().poll_if_necessary(); DWORD const pov = devinfo->m_joystick.state.rgdwPOV[povnum]; // if invalid, return 0 diff --git a/src/osd/modules/input/input_mac.cpp b/src/osd/modules/input/input_mac.cpp index d29e7e89a67..90360adaa3f 100644 --- a/src/osd/modules/input/input_mac.cpp +++ b/src/osd/modules/input/input_mac.cpp @@ -31,17 +31,10 @@ #include "../../mac/osdmac.h" #include "input_common.h" -extern void MacPollInputs(); - void mac_osd_interface::customize_input_type_list(std::vector &typelist) { } -void mac_osd_interface::poll_inputs() -{ - MacPollInputs(); -} - void mac_osd_interface::release_keys() { } diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp index 68779a151e4..ff52fbee478 100644 --- a/src/osd/modules/input/input_sdl.cpp +++ b/src/osd/modules/input/input_sdl.cpp @@ -1502,7 +1502,6 @@ public: button_item++, [] (void *device_internal, void *item_internal) -> int { - static_cast(device_internal)->module().poll_if_necessary(); return (*reinterpret_cast(item_internal) <= -16'384) ? 1 : 0; }, &m_controller.axes[axis]); diff --git a/src/osd/modules/input/input_windows.cpp b/src/osd/modules/input/input_windows.cpp index 90101351a95..1db0e3ac02c 100644 --- a/src/osd/modules/input/input_windows.cpp +++ b/src/osd/modules/input/input_windows.cpp @@ -65,14 +65,6 @@ bool windows_osd_interface::handle_input_event(input_event eventid, void *eventd return handled; } -void windows_osd_interface::poll_input(running_machine &machine) const -{ - m_keyboard_input->poll_if_necessary(); - m_mouse_input->poll_if_necessary(); - m_lightgun_input->poll_if_necessary(); - m_joystick_input->poll_if_necessary(); -} - //============================================================ // customize_input_type_list //============================================================ diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 0d69e39b5f4..7b93e1d5a37 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -675,6 +675,14 @@ bool osd_common_t::input_init() return true; } +void osd_common_t::poll_input_modules() +{ + m_keyboard_input->poll_if_necessary(); + m_mouse_input->poll_if_necessary(); + m_lightgun_input->poll_if_necessary(); + m_joystick_input->poll_if_necessary(); +} + void osd_common_t::exit_subsystems() { video_exit(); diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 33013d43025..0860d0d0288 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -279,6 +279,8 @@ protected: virtual void build_slider_list() { } virtual void update_slider_list() { } + void poll_input_modules(); + static std::list > s_window_list; private: diff --git a/src/osd/sdl/osdsdl.cpp b/src/osd/sdl/osdsdl.cpp index 3a6fdda3052..b7b71502fbb 100644 --- a/src/osd/sdl/osdsdl.cpp +++ b/src/osd/sdl/osdsdl.cpp @@ -297,7 +297,7 @@ void sdl_osd_interface::init(running_machine &machine) void sdl_osd_interface::input_update() { process_events_buf(); - poll_inputs(); + poll_input_modules(); check_osd_inputs(); } @@ -421,15 +421,6 @@ void sdl_osd_interface::customize_input_type_list(std::vector } -void sdl_osd_interface::poll_inputs() -{ - m_keyboard_input->poll_if_necessary(); - m_mouse_input->poll_if_necessary(); - m_lightgun_input->poll_if_necessary(); - m_joystick_input->poll_if_necessary(); -} - - void sdl_osd_interface::release_keys() { auto const keybd = dynamic_cast(m_keyboard_input); diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index 80499f96236..e0c939072be 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -158,7 +158,6 @@ public: // SDL-specific virtual bool has_focus() const override { return bool(m_focus_window); } - void poll_inputs(); void release_keys(); bool should_hide_mouse(); void process_events_buf(); diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index d40da254ffe..b12e0a94e06 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -118,7 +118,7 @@ void windows_osd_interface::input_update() { // poll the joystick values here process_events(true, false); - poll_input(machine()); + poll_input_modules(); check_osd_inputs(); } diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index b963cf09309..7f3d6f7964f 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -78,7 +78,6 @@ public: // windows OSD specific bool handle_input_event(input_event eventid, void *eventdata) const; bool should_hide_mouse() const; - void poll_input(running_machine &machine) const; virtual bool has_focus() const override; virtual void process_events() override; @@ -87,6 +86,8 @@ public: int window_count(); + 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;