diff options
author | hap <happppp@users.noreply.github.com> | 2019-07-05 19:48:19 +0200 |
---|---|---|
committer | hap <happppp@users.noreply.github.com> | 2019-07-05 19:48:34 +0200 |
commit | 10f0425b9ec63c23c34518d2449d99cfd9ec0789 (patch) | |
tree | 5c8be6848394ccb66f6251be0d426db2a937d855 | |
parent | abb0842eca6a9285a1038a7aef8f405d8199fd9e (diff) |
pwm: fix savestate problem (nw)
-rw-r--r-- | src/devices/video/pwm.cpp | 28 | ||||
-rw-r--r-- | src/devices/video/pwm.h | 6 |
2 files changed, 30 insertions, 4 deletions
diff --git a/src/devices/video/pwm.cpp b/src/devices/video/pwm.cpp index 651a992a67e..50b608759ef 100644 --- a/src/devices/video/pwm.cpp +++ b/src/devices/video/pwm.cpp @@ -68,8 +68,6 @@ pwm_display_device::pwm_display_device(const machine_config &mconfig, const char // device_start/reset //------------------------------------------------- -ALLOW_SAVE_TYPE(attotime); // m_acc - void pwm_display_device::device_start() { // resolve handlers @@ -113,8 +111,9 @@ void pwm_display_device::device_start() save_item(NAME(m_rowdata_prev)); save_item(NAME(m_bri)); - save_item(NAME(m_acc)); save_item(NAME(m_update_time)); + save_item(NAME(m_acc_attos)); + save_item(NAME(m_acc_secs)); } void pwm_display_device::device_reset() @@ -129,6 +128,29 @@ void pwm_display_device::device_reset() //------------------------------------------------- +// custom savestate handling (MAME doesn't save array of attotime) +//------------------------------------------------- + +void pwm_display_device::device_pre_save() +{ + for (int y = 0; y < ARRAY_LENGTH(m_acc); y++) + for (int x = 0; x < ARRAY_LENGTH(m_acc[0]); x++) + { + m_acc_attos[y][x] = m_acc[y][x].attoseconds(); + m_acc_secs[y][x] = m_acc[y][x].seconds(); + } +} + +void pwm_display_device::device_post_load() +{ + for (int y = 0; y < ARRAY_LENGTH(m_acc); y++) + for (int x = 0; x < ARRAY_LENGTH(m_acc[0]); x++) + m_acc[y][x] = attotime(m_acc_secs[y][x], m_acc_attos[y][x]); +} + + + +//------------------------------------------------- // public handlers (most of the interface is in the .h file) //------------------------------------------------- diff --git a/src/devices/video/pwm.h b/src/devices/video/pwm.h index dca3d76a29a..4fba10e00d4 100644 --- a/src/devices/video/pwm.h +++ b/src/devices/video/pwm.h @@ -59,6 +59,8 @@ protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; + virtual void device_pre_save() override; + virtual void device_post_load() override; private: output_finder<0x40, 0x40> m_out_x; @@ -86,8 +88,10 @@ private: u64 m_rowdata_prev[0x40]; double m_bri[0x40][0x41]; - attotime m_acc[0x40][0x41]; attotime m_update_time; + attotime m_acc[0x40][0x41]; + attoseconds_t m_acc_attos[0x40][0x41]; + seconds_t m_acc_secs[0x40][0x41]; emu_timer *m_frame_timer; TIMER_CALLBACK_MEMBER(frame_tick); |