From b0c3577b1818fde86fef0a568b22d01f4d3c79ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Banaan=20Ananas?= Date: Sat, 2 Mar 2013 22:34:21 +0000 Subject: [PATCH] workaround for airco22b sprites --- src/mame/drivers/namcos22.c | 7 ++++--- src/mame/video/namcos22.c | 28 +++++++++++++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c index 52d793fda1a..2cac65fae3e 100644 --- a/src/mame/drivers/namcos22.c +++ b/src/mame/drivers/namcos22.c @@ -5257,7 +5257,7 @@ WRITE16_MEMBER(namcos22_state::mcu_speedup_w) COMBINE_DATA(&m_su_82); } -// for MCU BIOS v1.30 +// for MCU BIOS v1.20/v1.30 READ16_MEMBER(namcos22_state::mcu130_speedup_r) { if ((space.device().safe_pc() == 0xc12a) && (!(m_su_82 & 0xff00))) @@ -5289,7 +5289,7 @@ static void install_c74_speedup(running_machine &machine) static void install_130_speedup(running_machine &machine) { namcos22_state *state = machine.driver_data(); - // install speedup cheat for 1.30 MCU BIOS + // install speedup cheat for 1.20/1.30 MCU BIOS if (MCU_SPEEDUP) state->m_mcu->space(AS_PROGRAM).install_readwrite_handler(0x82, 0x83, read16_delegate(FUNC(namcos22_state::mcu130_speedup_r),state), write16_delegate(FUNC(namcos22_state::mcu_speedup_w),state)); } @@ -5363,6 +5363,7 @@ DRIVER_INIT_MEMBER(namcos22_state,airco22) namcos22_init(machine(), NAMCOS22_AIR_COMBAT22); // S22-BIOS ver1.20 namco all rights reserved 94/12/21 + install_130_speedup(machine()); } DRIVER_INIT_MEMBER(namcos22_state,propcycl) @@ -5511,7 +5512,7 @@ GAME( 1996, victlapw, 0, namcos22, victlap, namcos22_state, victlap, /* Super System22 games */ GAME( 1994, alpinerd, 0, namcos22s, alpiner, namcos22_state, alpiner, ROT0, "Namco", "Alpine Racer (Rev. AR2 Ver.D)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) GAME( 1994, alpinerc, alpinerd, namcos22s, alpiner, namcos22_state, alpiner, ROT0, "Namco", "Alpine Racer (Rev. AR2 Ver.C)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) -GAME( 1995, airco22b, 0, namcos22s, airco22, namcos22_state, airco22, ROT0, "Namco", "Air Combat 22 (Rev. ACS1 Ver.B, Japan)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // boots but missing sprite clear DMA? +GAME( 1995, airco22b, 0, namcos22s, airco22, namcos22_state, airco22, ROT0, "Namco", "Air Combat 22 (Rev. ACS1 Ver.B, Japan)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // various problems GAME( 1995, cybrcycc, 0, namcos22s, cybrcycc, namcos22_state, cybrcyc, ROT0, "Namco", "Cyber Cycles (Rev. CB2 Ver.C)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 95/04/04 GAME( 1995, dirtdash, 0, namcos22s, dirtdash, namcos22_state, dirtdash, ROT0, "Namco", "Dirt Dash (Rev. DT2)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 95/12/20 20:01:56 GAME( 1995, timecris, 0, timecris, timecris, namcos22_state, timecris, ROT0, "Namco", "Time Crisis (Rev. TS2 Ver.B)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/04/02 18:48:00 diff --git a/src/mame/video/namcos22.c b/src/mame/video/namcos22.c index eadf0e415c2..82ccd298059 100644 --- a/src/mame/video/namcos22.c +++ b/src/mame/video/namcos22.c @@ -7,8 +7,7 @@ * - texture u/v mapping is often 1 pixel off, resulting in many glitch lines/gaps between textures * - tokyowar tanks are not shootable, same for timecris helicopter, there's still a very small hitbox but almost impossible to hit * (is this related to dsp? or cpu?) - * - find out how/where vics num_sprites is determined exactly, it causes major sprite problems in airco22b - * dirtdash would have this issue too, if not for the current workaround + * - find out how/where vics num_sprites is determined exactly, currently a workaround is needed for airco22b and dirtdash * - improve ss22 fogging: * + scene changes too rapidly sometimes, eg. dirtdash snow level finish (see attract), or aquajet going down the waterfall * + 100% fog if you start dirtdash at the hill level @@ -1622,7 +1621,7 @@ static void DrawSprites( running_machine &machine, bitmap_rgb32 &bitmap, const r } if (machine.input().code_pressed(KEYCODE_S)) popmessage("%s",msg1); - else popmessage("[S] shows spite/vics regs"); + else popmessage("[S] shows sprite/vics regs"); #endif /* 0x980000: 00060000 00010000 02ff0000 000007ff @@ -1647,11 +1646,11 @@ static void DrawSprites( running_machine &machine, bitmap_rgb32 &bitmap, const r */ /* 'enable' bits function: - bit 0: affects spritecount by 1? (alpinr2b) + bit 0: sprites on? bit 1: ??? (always set, except in alpinr2b. it's not x-resolution) bit 2: y-resolution? (always set, except in cybrcycc) all bits set means off (aquajet) */ - int enable = spriteram32[0]>>16&7; + int enable = spriteram32[0]>>16&5; int y_lowres = (enable & 4) ? 0 : 1; @@ -1659,10 +1658,9 @@ static void DrawSprites( running_machine &machine, bitmap_rgb32 &bitmap, const r int deltay = (spriteram32[3]>>16) + (0x2a >> y_lowres); int base = spriteram32[0] & 0xffff; // alpinesa/alpinr2b - int num_sprites = (spriteram32[1]>>16) - base; - num_sprites += (~enable & 1); + int num_sprites = ((spriteram32[1]>>16) - base) + 1; - if( num_sprites > 0 && num_sprites < 0x400 && enable != 7 ) + if( num_sprites > 0 && num_sprites < 0x400 && enable != 5 ) { pSource = &spriteram32[0x04000/4 + base*4]; pPal = &spriteram32[0x20000/4 + base*2]; @@ -1690,7 +1688,8 @@ static void DrawSprites( running_machine &machine, bitmap_rgb32 &bitmap, const r num_sprites = state->m_vics_control[0x40/4] >> 4 & 0x1ff; // no +1 // dirtdash sprite list starts at xxx4, number of sprites is stored in xxx0, it doesn't use set#2 - if (state->m_gametype == NAMCOS22_DIRT_DASH) num_sprites = (state->m_vics_data[(state->m_vics_control[0x48/4]&0x4000)/4] & 0xff) + 1; + if (state->m_gametype == NAMCOS22_DIRT_DASH) + num_sprites = (state->m_vics_data[(state->m_vics_control[0x48/4]&0x4000)/4] & 0xff) + 1; if( num_sprites > 0 ) { @@ -1700,6 +1699,17 @@ static void DrawSprites( running_machine &machine, bitmap_rgb32 &bitmap, const r } num_sprites = state->m_vics_control[0x60/4] >> 4 & 0x1ff; // no +1 + + // airco22b number of sprites for set#2 is stored in set#1 - it does not use set 1, or main set for sprites + if (state->m_gametype == NAMCOS22_AIR_COMBAT22) + { + enable = state->m_vics_data[(state->m_vics_control[0x48/4]&0xffff)/4]>>16&5; + if (enable != 5) + num_sprites = (state->m_vics_data[(state->m_vics_control[0x48/4]&0xffff)/4+1]>>16)+1; + else + num_sprites = 0; + } + if( num_sprites > 0 ) { pSource = &state->m_vics_data[(state->m_vics_control[0x68/4]&0xffff)/4];