From 23955bb72158005e36664c80e68021e42e86bb41 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Thu, 26 May 2011 13:32:45 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20Sega=20Saturn=20/=20ST-V=20start-up=20c?= =?UTF-8?q?rash=20that=20was=20happening=20on=20some=20ends=20[Oliver=20St?= =?UTF-8?q?=C3=B6neberg]=20Fixed=20a=20use-after-free=20bug=20in=20build/v?= =?UTF-8?q?erinfo.c=20[Oliver=20St=C3=B6neberg]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/build/verinfo.c | 2 +- src/mame/drivers/saturn.c | 4 ++-- src/mame/video/stvvdp2.c | 35 ++++++++--------------------------- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/src/build/verinfo.c b/src/build/verinfo.c index d95df33dc86..473ac7dc6d2 100644 --- a/src/build/verinfo.c +++ b/src/build/verinfo.c @@ -251,8 +251,8 @@ int main(int argc, char *argv[]) // parse out version string if (parse_version(buffer, &v.version_major, &v.version_minor, &v.version_build, &v.version_string)) { - free(buffer); fprintf(stderr, "Error parsing version from '%s'\n", buffer); + free(buffer); return 1; } diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c index 8fe1e08650e..a07d622ae5c 100644 --- a/src/mame/drivers/saturn.c +++ b/src/mame/drivers/saturn.c @@ -2628,7 +2628,7 @@ static MACHINE_RESET( stv ) -static MACHINE_CONFIG_START( saturn, driver_device ) +static MACHINE_CONFIG_START( saturn, saturn_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz @@ -2673,7 +2673,7 @@ static MACHINE_CONFIG_START( saturn, driver_device ) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( stv, driver_device ) +static MACHINE_CONFIG_START( stv, saturn_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c index 5ce3c243b64..ec6f2fb9dc9 100644 --- a/src/mame/video/stvvdp2.c +++ b/src/mame/video/stvvdp2.c @@ -3965,7 +3965,7 @@ static void stv_vdp2_check_tilemap_with_linescroll(running_machine &machine, bit { prev_scroll_values[i] &= 0x0007ff00; if ( prev_scroll_values[i] & 0x00040000 ) prev_scroll_values[i] |= 0xfff80000; - stv2_current_tilemap.incx = prev_scroll_values[i]; + incx = prev_scroll_values[i]; i++; } @@ -4051,31 +4051,12 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_t *bitmap, UINT32 address; UINT16 *line; UINT16 pix; - UINT32 coeff_line_color_screen_data; + //UINT32 coeff_line_color_screen_data; INT32 clipxmask = 0, clipymask = 0; - if((STV_VDP2_LSMD & 3) == 3) - { - vcnt_shift = 1; - } - else - { - vcnt_shift = 0; - } - - switch( STV_VDP2_HRES & 7 ) - { - case 2: /*640*/ - case 3: /*704*/ - case 6: - case 7: - hcnt_shift = 1; - break; - default: - hcnt_shift = 0; - break; - } + vcnt_shift = ((STV_VDP2_LSMD & 3) == 3); + hcnt_shift = ((STV_VDP2_HRES & 2) == 2); planesizex--; planesizey--; @@ -4215,7 +4196,7 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_t *bitmap, case 0: address = coeff_table_offset + ((RP.kast + RP.dkast*(vcnt>>vcnt_shift)) >> 16) * 4; coeff_table_val = coeff_table_base[ address / 4 ]; - coeff_line_color_screen_data = (coeff_table_val & 0x7f000000) >> 24; + //coeff_line_color_screen_data = (coeff_table_val & 0x7f000000) >> 24; coeff_msb = (coeff_table_val & 0x80000000) > 0; if ( coeff_table_val & 0x00800000 ) { @@ -4234,7 +4215,7 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_t *bitmap, coeff_table_val >>= 16; } coeff_table_val &= 0xffff; - coeff_line_color_screen_data = 0; + //coeff_line_color_screen_data = 0; coeff_msb = (coeff_table_val & 0x8000) > 0; if ( coeff_table_val & 0x4000 ) { @@ -4312,7 +4293,7 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_t *bitmap, case 0: address = coeff_table_offset + ((RP.kast + RP.dkast*(vcnt>>vcnt_shift) + RP.dkax*hcnt) >> 16) * 4; coeff_table_val = coeff_table_base[ address / 4 ]; - coeff_line_color_screen_data = (coeff_table_val & 0x7f000000) >> 24; + //coeff_line_color_screen_data = (coeff_table_val & 0x7f000000) >> 24; coeff_msb = (coeff_table_val & 0x80000000) > 0; if ( coeff_table_val & 0x00800000 ) { @@ -4331,7 +4312,7 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_t *bitmap, coeff_table_val >>= 16; } coeff_table_val &= 0xffff; - coeff_line_color_screen_data = 0; + //coeff_line_color_screen_data = 0; coeff_msb = (coeff_table_val & 0x8000) > 0; if ( coeff_table_val & 0x4000 ) {