summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cam900 <dbtlrchl@naver.com>2020-12-27 12:52:35 +0900
committer GitHub <noreply@github.com>2020-12-27 14:52:35 +1100
commit90152f33d5114828a53f38fc9a1913af71e683d6 (patch)
tree3a97aa1d308402c9076014fd9680a46703e0ab24
parent54e03f47e0480b5e8cf837723b96f2a343a2b968 (diff)
segas32.cpp: Added save state support, and fixed backdrop color fill when screen resolution is changed. (#7583)
-rw-r--r--src/mame/drivers/segas32.cpp6
-rw-r--r--src/mame/includes/segas32.h10
-rw-r--r--src/mame/video/segas32.cpp37
3 files changed, 50 insertions, 3 deletions
diff --git a/src/mame/drivers/segas32.cpp b/src/mame/drivers/segas32.cpp
index 7b7f21d7154..52bd98a5f74 100644
--- a/src/mame/drivers/segas32.cpp
+++ b/src/mame/drivers/segas32.cpp
@@ -654,6 +654,8 @@ void sega_multi32_analog_state::device_start()
{
sega_multi32_state::device_start();
m_analog_bank = 0;
+
+ save_item(NAME(m_analog_bank));
}
void segas32_state::device_reset()
@@ -5715,6 +5717,8 @@ void segas32_state::init_arescue(int m_hasdsp)
elem = 0x00;
m_sw1_output = &segas32_state::arescue_sw1_output;
+
+ save_item(NAME(m_arescue_dsp_io));
}
@@ -5732,6 +5736,8 @@ void segas32_state::init_brival()
m_system32_protram = std::make_unique<uint16_t[]>(0x1000/2);
m_maincpu->space(AS_PROGRAM).install_read_handler(0x20ba00, 0x20ba07, read16s_delegate(*this, FUNC(segas32_state::brival_protection_r)));
m_maincpu->space(AS_PROGRAM).install_write_handler(0xa00000, 0xa00fff, write16sm_delegate(*this, FUNC(segas32_state::brival_protection_w)));
+
+ save_pointer(NAME(m_system32_protram), 0x1000/2);
}
diff --git a/src/mame/includes/segas32.h b/src/mame/includes/segas32.h
index 3907880cf0d..85c342de9a5 100644
--- a/src/mame/includes/segas32.h
+++ b/src/mame/includes/segas32.h
@@ -233,6 +233,7 @@ protected:
const bool m_is_multi32;
+ // internal states
uint8_t m_v60_irq_control[0x10];
timer_device *m_v60_irq_timer[2];
uint8_t m_sound_irq_control[4];
@@ -242,10 +243,14 @@ protected:
sys32_output_callback m_sw1_output;
sys32_output_callback m_sw2_output;
sys32_output_callback m_sw3_output;
+
+ // hardware specific
std::unique_ptr<uint16_t[]> m_system32_protram;
+ uint16_t m_arescue_dsp_io[6];
+
+ // video-related
uint16_t m_system32_displayenable[2];
uint16_t m_system32_tilebank_external;
- uint16_t m_arescue_dsp_io[6];
std::unique_ptr<cache_entry[]> m_tmap_cache;
cache_entry *m_cache_head;
layer_info m_layer_data[11];
@@ -256,6 +261,9 @@ protected:
uint8_t m_sprite_control_latched[8];
uint8_t m_sprite_control[8];
std::unique_ptr<uint32_t[]> m_spriteram_32bit;
+ std::unique_ptr<int32_t[]> m_prev_bgstartx;
+ std::unique_ptr<int32_t[]> m_prev_bgendx;
+ std::unique_ptr<int32_t[]> m_bgcolor_line;
typedef void (segas32_state::*prot_vblank_func)();
prot_vblank_func m_system32_prot_vblank;
int m_print_count;
diff --git a/src/mame/video/segas32.cpp b/src/mame/video/segas32.cpp
index 177a383f851..316b2b05929 100644
--- a/src/mame/video/segas32.cpp
+++ b/src/mame/video/segas32.cpp
@@ -268,15 +268,24 @@ void segas32_state::device_start()
m_layer_data[bmap].bitmap.allocate(416, 224);
m_layer_data[bmap].transparent = make_unique_clear<uint8_t[]>(256);
m_layer_data[bmap].num = bmap;
+
+ save_pointer(NAME(m_layer_data[bmap].transparent), 256, bmap);
}
/* allocate pre-rendered solid lines of 0's and ffff's */
m_solid_0000 = make_unique_clear<uint16_t[]>(512);
m_solid_ffff = make_unique_clear<uint16_t[],0xff>(512);
- memset(m_videoram, 0x00, 0x20000);
+ /* allocate background color per line*/
+ m_prev_bgstartx = std::make_unique<int32_t[]>(512);
+ m_prev_bgendx = std::make_unique<int32_t[]>(512);
+ m_bgcolor_line = std::make_unique<int32_t[]>(512);
+ std::fill_n(&m_prev_bgstartx[0], 512, -1);
+ std::fill_n(&m_prev_bgendx[0], 512, -1);
+ std::fill_n(&m_bgcolor_line[0], 512, -1);
/* initialize videoram */
+ memset(m_videoram, 0x00, 0x20000);
m_videoram[0x1ff00/2] = 0x8000;
memset(m_mixer_control, 0xff, sizeof(m_mixer_control[0][0]) * 0x80 );
@@ -284,6 +293,24 @@ void segas32_state::device_start()
/* needs to be initialized to 0xff, otherwise f1en has bad sound (MT04531) */
if (m_soundram)
std::fill_n(&m_soundram[0], m_soundram.bytes() / sizeof(m_soundram[0]), 0xff);
+
+ /* save states */
+ save_item(NAME(m_v60_irq_control));
+ save_item(NAME(m_sound_irq_control));
+ save_item(NAME(m_sound_irq_input));
+ save_item(NAME(m_sound_dummy_value));
+ save_item(NAME(m_sound_bank));
+
+ save_item(NAME(m_mixer_control));
+ save_item(NAME(m_system32_displayenable));
+ save_item(NAME(m_system32_tilebank_external));
+ save_item(NAME(m_sprite_render_count));
+ save_item(NAME(m_sprite_control_latched));
+ save_item(NAME(m_sprite_control));
+ save_pointer(NAME(m_spriteram_32bit), 0x20000/4);
+ save_pointer(NAME(m_prev_bgstartx), 512);
+ save_pointer(NAME(m_prev_bgendx), 512);
+ save_pointer(NAME(m_bgcolor_line), 512);
}
@@ -1233,9 +1260,15 @@ void segas32_state::update_background(segas32_state::layer_info &layer, const re
color = m_videoram[0x1ff5e/2] & 0x1e00;
/* if the color doesn't match, fill */
- if (dst[cliprect.min_x] != color)
+ if ((m_bgcolor_line[y & 0x1ff] != color) || (m_prev_bgstartx[y & 0x1ff] != cliprect.min_x) || (m_prev_bgendx[y & 0x1ff] != cliprect.max_x))
+ {
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
dst[x] = color;
+
+ m_prev_bgstartx[y & 0x1ff] = cliprect.min_x;
+ m_prev_bgendx[y & 0x1ff] = cliprect.max_x;
+ m_bgcolor_line[y & 0x1ff] = color;
+ }
}
}