From ddc0eabd2816c49a5914e1c80a515e072274129e Mon Sep 17 00:00:00 2001 From: "Alex W. Jackson" Date: Mon, 3 Feb 2014 00:33:19 +0000 Subject: [PATCH] Magic numbers, just say no (nw) --- src/emu/video.c | 5 +++-- src/emu/video.h | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/emu/video.c b/src/emu/video.c index 229752bea66..89365643672 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -85,7 +85,8 @@ video_manager::video_manager(running_machine &machine) m_overall_real_ticks(0), m_overall_emutime(attotime::zero), m_overall_valid_counter(0), - m_throttle_rate(machine.options().throttle() ? 1.0f : 0.0f), + m_throttled(machine.options().throttle()), + m_throttle_rate(1.0f), m_fastforward(false), m_seconds_to_run(machine.options().seconds_to_run()), m_auto_frameskip(machine.options().auto_frameskip()), @@ -1283,7 +1284,7 @@ bool video_assert_out_of_range_pixels(running_machine &machine, bitmap_ind16 &bi void video_manager::toggle_throttle() { - set_throttle_rate(throttled() ? 0.0f : 1.0f); + set_throttled(!throttled()); } diff --git a/src/emu/video.h b/src/emu/video.h index c216ca7ee79..abd2a8f27a6 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -61,13 +61,14 @@ public: bool skip_this_frame() const { return m_skipping_this_frame; } int speed_factor() const { return m_speed; } int frameskip() const { return m_auto_frameskip ? -1 : m_frameskip_level; } - bool throttled() const { return throttle_rate() != 0; } + bool throttled() const { return m_throttled; } float throttle_rate() const { return m_throttle_rate; } bool fastforward() const { return m_fastforward; } bool is_recording() const { return (m_mngfile != NULL || m_avifile != NULL); } // setters void set_frameskip(int frameskip); + void set_throttled(bool throttled = true) { m_throttled = throttled; } void set_throttle_rate(float throttle_rate) { m_throttle_rate = throttle_rate; } void set_fastforward(bool ffwd = true) { m_fastforward = ffwd; } void set_output_changed() { m_output_changed = true; } @@ -142,7 +143,8 @@ private: UINT32 m_overall_valid_counter; // number of consecutive valid time periods // configuration - float m_throttle_rate; // target rate for throttling (0 = no throttle) + bool m_throttled; // flag: TRUE if we're currently throttled + float m_throttle_rate; // target rate for throttling bool m_fastforward; // flag: TRUE if we're currently fast-forwarding UINT32 m_seconds_to_run; // number of seconds to run before quitting bool m_auto_frameskip; // flag: TRUE if we're automatically frameskipping