From 33cfe5e253777eb9d222ec68ac5d9f2093ea4be7 Mon Sep 17 00:00:00 2001 From: holub Date: Thu, 29 Aug 2024 13:36:10 -0400 Subject: [PATCH] sinclair: Reset caches after loading a saved state. (#12700) Updated sinclair/specnext_sprites.cpp, sinclair/sprinter.cpp and sinclair/tsconf.cpp. --- src/mame/sinclair/specnext_sprites.cpp | 5 +++++ src/mame/sinclair/specnext_sprites.h | 1 + src/mame/sinclair/sprinter.cpp | 13 ++++++++++--- src/mame/sinclair/tsconf.cpp | 6 ++++++ src/mame/sinclair/tsconf.h | 1 + 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/mame/sinclair/specnext_sprites.cpp b/src/mame/sinclair/specnext_sprites.cpp index da067ef43fe..d4a0ffef27f 100644 --- a/src/mame/sinclair/specnext_sprites.cpp +++ b/src/mame/sinclair/specnext_sprites.cpp @@ -317,6 +317,11 @@ void specnext_sprites_device::device_reset() update_config(); } +void specnext_sprites_device::device_post_load() +{ + m_sprites_cache.clear(); +} + // device type definition DEFINE_DEVICE_TYPE(SPECNEXT_SPRITES, specnext_sprites_device, "sprites", "Spectrum Next Sprites") diff --git a/src/mame/sinclair/specnext_sprites.h b/src/mame/sinclair/specnext_sprites.h index 2d3ec3eac0b..21c10ee73fd 100644 --- a/src/mame/sinclair/specnext_sprites.h +++ b/src/mame/sinclair/specnext_sprites.h @@ -44,6 +44,7 @@ protected: virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; virtual void device_start() override ATTR_COLD; virtual void device_reset() override ATTR_COLD; + virtual void device_post_load() override ATTR_COLD; memory_share_creator m_sprite_pattern_ram; memory_share_creator m_sprite_attr_ram; diff --git a/src/mame/sinclair/sprinter.cpp b/src/mame/sinclair/sprinter.cpp index e5d747559ba..4c8ce4e3cf7 100644 --- a/src/mame/sinclair/sprinter.cpp +++ b/src/mame/sinclair/sprinter.cpp @@ -108,9 +108,10 @@ public: INPUT_CHANGED_MEMBER(turbo_changed); protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; + virtual void video_start() override ATTR_COLD; + virtual void device_post_load() override ATTR_COLD; void map_io(address_map &map); void map_mem(address_map &map); @@ -1416,6 +1417,12 @@ void sprinter_state::machine_reset() update_memory(); } +void sprinter_state::device_post_load() +{ + spectrum_128_state::device_post_load(); + m_ints.clear(); +} + static const gfx_layout sprinter_charlayout = { 8, 8, // 8 x 8 characters diff --git a/src/mame/sinclair/tsconf.cpp b/src/mame/sinclair/tsconf.cpp index f56ef0cd975..1dc2ddf7538 100644 --- a/src/mame/sinclair/tsconf.cpp +++ b/src/mame/sinclair/tsconf.cpp @@ -237,6 +237,12 @@ void tsconf_state::machine_reset() while (m_keyboard->read() != 0) { /* invalidate buffer */ } } +void tsconf_state::device_post_load() +{ + spectrum_128_state::device_post_load(); + m_sprites_cache.clear(); +} + INPUT_PORTS_START( tsconf ) PORT_INCLUDE( spec_plus ) diff --git a/src/mame/sinclair/tsconf.h b/src/mame/sinclair/tsconf.h index 157a5560a17..596d76b3d7c 100644 --- a/src/mame/sinclair/tsconf.h +++ b/src/mame/sinclair/tsconf.h @@ -54,6 +54,7 @@ protected: virtual void video_start() override ATTR_COLD; virtual void machine_start() override ATTR_COLD; virtual void machine_reset() override ATTR_COLD; + virtual void device_post_load() override ATTR_COLD; virtual TIMER_CALLBACK_MEMBER(irq_off) override; TIMER_CALLBACK_MEMBER(irq_frame);