mirror of
https://github.com/holub/mame
synced 2025-04-16 21:44:32 +03:00
osd: Don't pump events when reading inputs.
This was a drain on performance. If anything is trying to poll inputs in a loop, it needs to call input_update() to ensure it gets up-to-date state.
This commit is contained in:
parent
cf4310a1e7
commit
a72c02133f
@ -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)
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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<windows_osd_interface&>(machine().osd()).poll_input(*m_machine);
|
||||
downcast<windows_osd_interface&>(machine().osd()).poll_input_modules();
|
||||
|
||||
// get and process messages
|
||||
MSG message;
|
||||
|
@ -507,24 +507,15 @@ private:
|
||||
template <class TItem>
|
||||
int generic_button_get_state(void *device_internal, void *item_internal)
|
||||
{
|
||||
device_info *devinfo = static_cast<device_info *>(device_internal);
|
||||
TItem *itemdata = static_cast<TItem*>(item_internal);
|
||||
|
||||
// return the current state
|
||||
devinfo->module().poll_if_necessary();
|
||||
return *itemdata >> 7;
|
||||
return *reinterpret_cast<TItem const *>(item_internal) >> 7;
|
||||
}
|
||||
|
||||
|
||||
template <class TItem>
|
||||
int generic_axis_get_state(void *device_internal, void *item_internal)
|
||||
{
|
||||
device_info *devinfo = static_cast<device_info *>(device_internal);
|
||||
TItem *axisdata = static_cast<TItem*>(item_internal);
|
||||
|
||||
// return the current state
|
||||
devinfo->module().poll_if_necessary();
|
||||
return *axisdata;
|
||||
return *reinterpret_cast<TItem const *>(item_internal);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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<input_type_entry> &typelist)
|
||||
{
|
||||
}
|
||||
|
||||
void mac_osd_interface::poll_inputs()
|
||||
{
|
||||
MacPollInputs();
|
||||
}
|
||||
|
||||
void mac_osd_interface::release_keys()
|
||||
{
|
||||
}
|
||||
|
@ -1502,7 +1502,6 @@ public:
|
||||
button_item++,
|
||||
[] (void *device_internal, void *item_internal) -> int
|
||||
{
|
||||
static_cast<device_info *>(device_internal)->module().poll_if_necessary();
|
||||
return (*reinterpret_cast<s32 const *>(item_internal) <= -16'384) ? 1 : 0;
|
||||
},
|
||||
&m_controller.axes[axis]);
|
||||
|
@ -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
|
||||
//============================================================
|
||||
|
@ -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();
|
||||
|
@ -279,6 +279,8 @@ protected:
|
||||
virtual void build_slider_list() { }
|
||||
virtual void update_slider_list() { }
|
||||
|
||||
void poll_input_modules();
|
||||
|
||||
static std::list<std::unique_ptr<osd_window> > s_window_list;
|
||||
|
||||
private:
|
||||
|
@ -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<input_type_entry>
|
||||
}
|
||||
|
||||
|
||||
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<input_module_base *>(m_keyboard_input);
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user