From 96e24489fda8f7b75e982f3f1b699d5f4aa10859 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Mon, 9 Nov 2009 16:15:56 +0000 Subject: [PATCH] Improved ROZ layer in Soccer Superstars [David Haywood] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed sprite transfers, sprite layout and added preliminary frame bit toggle, game is now somewhat playable without the pitch [Angelo Salese] ---------- Forwarded message ---------- From: David Haywood Date: Mon, Nov 9, 2009 at 7:41 AM Subject: Soccer Superstars pitch To: Philip Bennett , Angelo Salese some mods to allow the Soccer Superstars pitch to be rendered with a debug key.  The layout / bank select for it should now be correct. There is a lot of unknown data in the 'PSAC2 data rom' tho, which is probably for something else? (or it's bad?) Hold down W to show the ROZ output.   I need to work out how the mixer works, because everything just crashes horribly if you attempt to use it right now due to unsafe code and cliprects ;-) --- src/mame/drivers/konamigx.c | 96 +++++++++++++++++++++---------------- src/mame/video/konamigx.c | 83 ++++++++++++++++++++++++-------- 2 files changed, 120 insertions(+), 59 deletions(-) diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c index e59c78e473d..deb36e4bab7 100644 --- a/src/mame/drivers/konamigx.c +++ b/src/mame/drivers/konamigx.c @@ -963,13 +963,14 @@ static READ32_HANDLER( type1_roz_r2 ) return ROM[offset]; } -static int sync_frame = 0; +//static int sync_frame = 0; static READ32_HANDLER( type3_sync_r ) { - sync_frame ^= 0xffffffff; - - return sync_frame; + if(video_screen_get_frame_number(space->machine->primary_screen) & 1) + return 0xfffffffe | 1; + else + return 0xfffffffe | 0; } static int last_prot_op, last_prot_clk; @@ -1196,17 +1197,20 @@ static ADDRESS_MAP_START( gx_type2_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_IMPORT_FROM(gx_base_memmap) ADDRESS_MAP_END +extern WRITE32_HANDLER( konamigx_type3_psac2_bank_w ); +extern UINT32* konamigx_type3_psac2_bank; + static ADDRESS_MAP_START( gx_type3_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0xd90000, 0xd97fff) AM_RAM - AM_RANGE(0xcc0000, 0xcc0007) AM_WRITE(type4_prot_w) - AM_RANGE(0xe00000, 0xe0001f) AM_RAM AM_BASE((UINT32**)&K053936_1_ctrl) - AM_RANGE(0xe20000, 0xe20003) AM_WRITENOP - AM_RANGE(0xe40000, 0xe40003) AM_WRITENOP - AM_RANGE(0xe60000, 0xe60fff) AM_RAM AM_BASE((UINT32**)&K053936_1_linectrl) + //AM_RANGE(0xcc0000, 0xcc0007) AM_WRITE(type4_prot_w) + AM_RANGE(0xe00000, 0xe0001f) AM_RAM AM_BASE((UINT32**)&K053936_0_ctrl) + //AM_RANGE(0xe20000, 0xe20003) AM_WRITENOP + AM_RANGE(0xe40000, 0xe40003) AM_WRITE(konamigx_type3_psac2_bank_w) AM_BASE(&konamigx_type3_psac2_bank) + AM_RANGE(0xe60000, 0xe60fff) AM_RAM AM_BASE((UINT32**)&K053936_0_linectrl) AM_RANGE(0xe80000, 0xe87fff) AM_RAM_WRITE(konamigx_555_palette_w) AM_BASE(&paletteram32) // main monitor palette (twice as large as reality) AM_RANGE(0xea0000, 0xea3fff) AM_RAM_WRITE(konamigx_555_palette2_w) AM_BASE(&gx_subpaletteram32) // sub monitor palette AM_RANGE(0xec0000, 0xec0003) AM_READ(type3_sync_r) - AM_RANGE(0xf00000, 0xf07fff) AM_RAM + //AM_RANGE(0xf00000, 0xf07fff) AM_RAM AM_IMPORT_FROM(gx_base_memmap) ADDRESS_MAP_END @@ -1324,9 +1328,9 @@ static const gfx_layout bglayout_8bpp = RGN_FRAC(1,1), 8, { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 }, - 16*128 + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 16*128 }; // for scanrows on tilemap @@ -1394,7 +1398,7 @@ GFXDECODE_END /* type 3 & 4 games use a simple 8bpp decode for the 53936 */ static GFXDECODE_START( type34 ) - GFXDECODE_ENTRY( "gfx3", 0, bglayout_8bpp, 0x0000, 8 ) + GFXDECODE_ENTRY( "gfx3", 0, bglayout_8bpp, 0x1000, 8 ) GFXDECODE_END static MACHINE_DRIVER_START( konamigx ) @@ -1508,7 +1512,7 @@ static MACHINE_DRIVER_START( gxtype3 ) MDRV_VIDEO_START(konamigx_type3) MDRV_PALETTE_LENGTH(16384) MDRV_SCREEN_MODIFY("screen") - MDRV_SCREEN_SIZE(64*8, 32*8) + MDRV_SCREEN_SIZE(128*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1) MDRV_GFXDECODE(type34) MACHINE_DRIVER_END @@ -2543,20 +2547,32 @@ ROM_START( soccerss ) /* sprites */ ROM_REGION( 0xc00000, "gfx2", ROMREGION_ERASE00 ) - ROM_LOAD32_WORD( "427a08.140", 0x000000, 2*1024*1024, CRC(221250af) SHA1(fd24e7f0e3024df5aa08506523953c5e35d2267b) ) - ROM_LOAD32_WORD( "427a09.137", 0x000002, 2*1024*1024, CRC(56bdd480) SHA1(01d164aedc77f71f6310cfd739c00b33289a2e7e) ) - ROM_LOAD32_WORD( "427a10.25r", 0x400000, 2*1024*1024, CRC(6b3ccb41) SHA1(b246ef350a430e60f0afd1b80ff48139c325e926) ) - ROM_LOAD32_WORD( "427a11.23r", 0x400002, 2*1024*1024, CRC(c1ca74c1) SHA1(b7286df8e59f8f1939ebf17aaf9345a857b0b100) ) - ROM_LOAD32_WORD( "427a12.21r", 0x800000, 2*1024*1024, CRC(97d6fd38) SHA1(8d2895850cafdea95db08c84e7eeea90a1921515) ) - ROM_LOAD32_WORD( "427a13.18r", 0x800002, 2*1024*1024, CRC(815a9b87) SHA1(7d9d5932fff7dd7aa4cbccf0c8d3784dc8042e70) ) + _48_WORD_ROM_LOAD( "427a13.18r", 0x000000, 2*1024*1024, CRC(815a9b87) SHA1(7d9d5932fff7dd7aa4cbccf0c8d3784dc8042e70) ) + _48_WORD_ROM_LOAD( "427a11.23r", 0x000002, 2*1024*1024, CRC(c1ca74c1) SHA1(b7286df8e59f8f1939ebf17aaf9345a857b0b100) ) + _48_WORD_ROM_LOAD( "427a09.137", 0x000004, 2*1024*1024, CRC(56bdd480) SHA1(01d164aedc77f71f6310cfd739c00b33289a2e7e) ) + _48_WORD_ROM_LOAD( "427a12.21r", 0x600000, 2*1024*1024, CRC(97d6fd38) SHA1(8d2895850cafdea95db08c84e7eeea90a1921515) ) + _48_WORD_ROM_LOAD( "427a10.25r", 0x600002, 2*1024*1024, CRC(6b3ccb41) SHA1(b246ef350a430e60f0afd1b80ff48139c325e926) ) + _48_WORD_ROM_LOAD( "427a08.140", 0x600004, 2*1024*1024, CRC(221250af) SHA1(fd24e7f0e3024df5aa08506523953c5e35d2267b) ) /* PSAC2 tiles */ ROM_REGION( 0x100000, "gfx3", ROMREGION_ERASE00 ) ROM_LOAD( "427a18.145", 0x000000, 0x100000, CRC(bb6e6ec6) SHA1(aa1365a4318866d9e7e74461a6e6c113f83b6771) ) /* PSAC2 map data */ - ROM_REGION( 0x080000, "gfx4", ROMREGION_ERASE00 ) - ROM_LOAD( "427a17.24c", 0x000000, 0x080000, CRC(fb6eb01f) SHA1(28cdb30ff70ee5fc7624e18fe048dd85dfa49ace) ) + ROM_REGION( 0x080000, "gfx4", ROMREGION_ERASE00 ) + // 4 banks of 0x20000? (only the first 2 seem valid tho) + // maybe this is CPU addressable and the 'garbage' is sprite related? + ROM_LOAD( "427a17.24c", 0x000000, 0x080000, CRC(fb6eb01f) SHA1(28cdb30ff70ee5fc7624e18fe048dd85dfa49ace) ) + /* 0x00000-0x1ffff pitch+crowd */ + + /* 0x20000-0x2ffff attract screens */ + /* 0x30000-0x3ffff garbage? */ + + /* 0x40000-0x4ffff blank */ + /* 0x50000-0x5ffff garbage? */ + + /* 0x60000-0x6ffff blank */ + /* 0x70000-0x7ffff garbage? */ /* sound data */ ROM_REGION( 0x400000, "shared", 0 ) @@ -2587,12 +2603,12 @@ ROM_START( soccerssj ) /* sprites */ ROM_REGION( 0xc00000, "gfx2", ROMREGION_ERASE00 ) - ROM_LOAD32_WORD( "427a08.140", 0x000000, 2*1024*1024, CRC(221250af) SHA1(fd24e7f0e3024df5aa08506523953c5e35d2267b) ) - ROM_LOAD32_WORD( "427a09.137", 0x000002, 2*1024*1024, CRC(56bdd480) SHA1(01d164aedc77f71f6310cfd739c00b33289a2e7e) ) - ROM_LOAD32_WORD( "427a10.25r", 0x400000, 2*1024*1024, CRC(6b3ccb41) SHA1(b246ef350a430e60f0afd1b80ff48139c325e926) ) - ROM_LOAD32_WORD( "427a11.23r", 0x400002, 2*1024*1024, CRC(c1ca74c1) SHA1(b7286df8e59f8f1939ebf17aaf9345a857b0b100) ) - ROM_LOAD32_WORD( "427a12.21r", 0x800000, 2*1024*1024, CRC(97d6fd38) SHA1(8d2895850cafdea95db08c84e7eeea90a1921515) ) - ROM_LOAD32_WORD( "427a13.18r", 0x800002, 2*1024*1024, CRC(815a9b87) SHA1(7d9d5932fff7dd7aa4cbccf0c8d3784dc8042e70) ) + _48_WORD_ROM_LOAD( "427a13.18r", 0x000000, 2*1024*1024, CRC(815a9b87) SHA1(7d9d5932fff7dd7aa4cbccf0c8d3784dc8042e70) ) + _48_WORD_ROM_LOAD( "427a11.23r", 0x000002, 2*1024*1024, CRC(c1ca74c1) SHA1(b7286df8e59f8f1939ebf17aaf9345a857b0b100) ) + _48_WORD_ROM_LOAD( "427a09.137", 0x000004, 2*1024*1024, CRC(56bdd480) SHA1(01d164aedc77f71f6310cfd739c00b33289a2e7e) ) + _48_WORD_ROM_LOAD( "427a12.21r", 0x600000, 2*1024*1024, CRC(97d6fd38) SHA1(8d2895850cafdea95db08c84e7eeea90a1921515) ) + _48_WORD_ROM_LOAD( "427a10.25r", 0x600002, 2*1024*1024, CRC(6b3ccb41) SHA1(b246ef350a430e60f0afd1b80ff48139c325e926) ) + _48_WORD_ROM_LOAD( "427a08.140", 0x600004, 2*1024*1024, CRC(221250af) SHA1(fd24e7f0e3024df5aa08506523953c5e35d2267b) ) /* PSAC2 tiles */ ROM_REGION( 0x100000, "gfx3", ROMREGION_ERASE00 ) @@ -2631,12 +2647,12 @@ ROM_START( soccerssja ) /* sprites */ ROM_REGION( 0xc00000, "gfx2", ROMREGION_ERASE00 ) - ROM_LOAD32_WORD( "427a08.140", 0x000000, 2*1024*1024, CRC(221250af) SHA1(fd24e7f0e3024df5aa08506523953c5e35d2267b) ) - ROM_LOAD32_WORD( "427a09.137", 0x000002, 2*1024*1024, CRC(56bdd480) SHA1(01d164aedc77f71f6310cfd739c00b33289a2e7e) ) - ROM_LOAD32_WORD( "427a10.25r", 0x400000, 2*1024*1024, CRC(6b3ccb41) SHA1(b246ef350a430e60f0afd1b80ff48139c325e926) ) - ROM_LOAD32_WORD( "427a11.23r", 0x400002, 2*1024*1024, CRC(c1ca74c1) SHA1(b7286df8e59f8f1939ebf17aaf9345a857b0b100) ) - ROM_LOAD32_WORD( "427a12.21r", 0x800000, 2*1024*1024, CRC(97d6fd38) SHA1(8d2895850cafdea95db08c84e7eeea90a1921515) ) - ROM_LOAD32_WORD( "427a13.18r", 0x800002, 2*1024*1024, CRC(815a9b87) SHA1(7d9d5932fff7dd7aa4cbccf0c8d3784dc8042e70) ) + _48_WORD_ROM_LOAD( "427a13.18r", 0x000000, 2*1024*1024, CRC(815a9b87) SHA1(7d9d5932fff7dd7aa4cbccf0c8d3784dc8042e70) ) + _48_WORD_ROM_LOAD( "427a11.23r", 0x000002, 2*1024*1024, CRC(c1ca74c1) SHA1(b7286df8e59f8f1939ebf17aaf9345a857b0b100) ) + _48_WORD_ROM_LOAD( "427a09.137", 0x000004, 2*1024*1024, CRC(56bdd480) SHA1(01d164aedc77f71f6310cfd739c00b33289a2e7e) ) + _48_WORD_ROM_LOAD( "427a12.21r", 0x600000, 2*1024*1024, CRC(97d6fd38) SHA1(8d2895850cafdea95db08c84e7eeea90a1921515) ) + _48_WORD_ROM_LOAD( "427a10.25r", 0x600002, 2*1024*1024, CRC(6b3ccb41) SHA1(b246ef350a430e60f0afd1b80ff48139c325e926) ) + _48_WORD_ROM_LOAD( "427a08.140", 0x600004, 2*1024*1024, CRC(221250af) SHA1(fd24e7f0e3024df5aa08506523953c5e35d2267b) ) /* PSAC2 tiles */ ROM_REGION( 0x100000, "gfx3", ROMREGION_ERASE00 ) @@ -2675,12 +2691,12 @@ ROM_START( soccerssa ) /* sprites */ ROM_REGION( 0xc00000, "gfx2", ROMREGION_ERASE00 ) - ROM_LOAD32_WORD( "427a08.140", 0x000000, 2*1024*1024, CRC(221250af) SHA1(fd24e7f0e3024df5aa08506523953c5e35d2267b) ) - ROM_LOAD32_WORD( "427a09.137", 0x000002, 2*1024*1024, CRC(56bdd480) SHA1(01d164aedc77f71f6310cfd739c00b33289a2e7e) ) - ROM_LOAD32_WORD( "427a10.25r", 0x400000, 2*1024*1024, CRC(6b3ccb41) SHA1(b246ef350a430e60f0afd1b80ff48139c325e926) ) - ROM_LOAD32_WORD( "427a11.23r", 0x400002, 2*1024*1024, CRC(c1ca74c1) SHA1(b7286df8e59f8f1939ebf17aaf9345a857b0b100) ) - ROM_LOAD32_WORD( "427a12.21r", 0x800000, 2*1024*1024, CRC(97d6fd38) SHA1(8d2895850cafdea95db08c84e7eeea90a1921515) ) - ROM_LOAD32_WORD( "427a13.18r", 0x800002, 2*1024*1024, CRC(815a9b87) SHA1(7d9d5932fff7dd7aa4cbccf0c8d3784dc8042e70) ) + _48_WORD_ROM_LOAD( "427a13.18r", 0x000000, 2*1024*1024, CRC(815a9b87) SHA1(7d9d5932fff7dd7aa4cbccf0c8d3784dc8042e70) ) + _48_WORD_ROM_LOAD( "427a11.23r", 0x000002, 2*1024*1024, CRC(c1ca74c1) SHA1(b7286df8e59f8f1939ebf17aaf9345a857b0b100) ) + _48_WORD_ROM_LOAD( "427a09.137", 0x000004, 2*1024*1024, CRC(56bdd480) SHA1(01d164aedc77f71f6310cfd739c00b33289a2e7e) ) + _48_WORD_ROM_LOAD( "427a12.21r", 0x600000, 2*1024*1024, CRC(97d6fd38) SHA1(8d2895850cafdea95db08c84e7eeea90a1921515) ) + _48_WORD_ROM_LOAD( "427a10.25r", 0x600002, 2*1024*1024, CRC(6b3ccb41) SHA1(b246ef350a430e60f0afd1b80ff48139c325e926) ) + _48_WORD_ROM_LOAD( "427a08.140", 0x600004, 2*1024*1024, CRC(221250af) SHA1(fd24e7f0e3024df5aa08506523953c5e35d2267b) ) /* PSAC2 tiles */ ROM_REGION( 0x100000, "gfx3", ROMREGION_ERASE00 ) diff --git a/src/mame/video/konamigx.c b/src/mame/video/konamigx.c index c2abda48ab8..79e8c80bfe4 100644 --- a/src/mame/video/konamigx.c +++ b/src/mame/video/konamigx.c @@ -52,22 +52,49 @@ static TILE_GET_INFO( get_gx_psac_tile_info ) SET_TILE_INFO(0, tileno, colour, TILE_FLIPYX(flipx)); } -/* Soccer Superstars (tile and flip bits now TRUSTED) */ -static TILE_GET_INFO( get_gx_psac3_tile_info ) +UINT32* konamigx_type3_psac2_bank; +int konamigx_type3_psac2_actual_bank; +int konamigx_type3_psac2_actual_last_bank = 0; + +WRITE32_HANDLER( konamigx_type3_psac2_bank_w ) { - int tileno, colour, flip; - UINT8 *tmap = memory_region(machine, "gfx4"); + // other bits are used for something... - tileno = tmap[tile_index*2] | ((tmap[(tile_index*2)+1] & 0x0f)<<8); - colour = (psac_colorbase << 8); + COMBINE_DATA(&konamigx_type3_psac2_bank[offset]); + konamigx_type3_psac2_actual_bank = (konamigx_type3_psac2_bank[0] & 0x10000000) >> 28; - flip = 0; - if (tmap[(tile_index*2)+1] & 0x20) flip |= TILE_FLIPX; - if (tmap[(tile_index*2)+1] & 0x10) flip |= TILE_FLIPY; + if (konamigx_type3_psac2_actual_bank!=konamigx_type3_psac2_actual_last_bank) + { + tilemap_mark_all_tiles_dirty (gx_psac_tilemap); + konamigx_type3_psac2_actual_last_bank = konamigx_type3_psac2_actual_bank; + } - SET_TILE_INFO(0, tileno, colour, flip); } + + +/* Soccer Superstars (tile and flip bits now TRUSTED) */ + static TILE_GET_INFO( get_gx_psac3_tile_info ) + { + int tileno, colour, flip; + UINT8 *tmap = memory_region(machine, "gfx4"); + + int base_index = tile_index; + + if (konamigx_type3_psac2_actual_bank) + base_index+=0x20000/2; + + + tileno = tmap[base_index*2] | ((tmap[(base_index*2)+1] & 0x0f)<<8); + colour = (tmap[(base_index*2)+1]&0xc0)>>6; + + flip = 0; + if (tmap[(base_index*2)+1] & 0x20) flip |= TILE_FLIPY; + if (tmap[(base_index*2)+1] & 0x10) flip |= TILE_FLIPX; + + SET_TILE_INFO(0, tileno, colour, flip); + } + /* PSAC4 */ /* these tilemaps are weird in both format and content, one of them doesn't really look like it should be displayed? - it's height data */ @@ -302,11 +329,16 @@ VIDEO_START(konamigx_6bpp) VIDEO_START(konamigx_type3) { K056832_vh_start(machine, "gfx1", K056832_BPP_6, 0, NULL, konamigx_type2_tile_callback, 0); + K055673_vh_start(machine, "gfx2", K055673_LAYOUT_GX6, -53, -23, konamigx_type2_sprite_callback); - _gxcommoninit(machine); + _gxcommoninitnosprites(machine); - gx_psac_tilemap = tilemap_create(machine, get_gx_psac3_tile_info, tilemap_scan_rows, 16, 16, 256, 1024); - gx_rozenable = 1; + gx_psac_tilemap = tilemap_create(machine, get_gx_psac3_tile_info, tilemap_scan_cols, 16, 16, 256, 256); + gx_rozenable = 0; + gx_specialrozenable = 2; + + + //tilemap_set_flip(gx_psac_tilemap, TILEMAP_FLIPX| TILEMAP_FLIPY); K053936_wraparound_enable(0, 1); K053936GP_set_offset(0, 0, 0); @@ -477,19 +509,32 @@ VIDEO_UPDATE(konamigx) if (dirty) K056832_MarkAllTilemapsDirty(); // Type-1 - if (gx_specialrozenable) + if (gx_specialrozenable == 1) { K053936_0_zoom_draw(gxtype1_roz_dstbitmap, &gxtype1_roz_dstbitmapclip,gx_psac_tilemap, 0,0,0); // height data K053936_0_zoom_draw(gxtype1_roz_dstbitmap2,&gxtype1_roz_dstbitmapclip,gx_psac_tilemap2,0,0,0); // colour data (+ some voxel height data?) } - if (gx_rozenable) - konamigx_mixer(screen->machine, bitmap, cliprect, 0, 0, gx_psac_tilemap, GXSUB_8BPP, 0); - else - konamigx_mixer(screen->machine, bitmap, cliprect, 0, 0, 0, 0, 0); + + +// if (gx_rozenable) +// konamigx_mixer(screen->machine, bitmap, cliprect, 0, 0, gx_psac_tilemap, GXSUB_8BPP, 0); +// else + konamigx_mixer(screen->machine, bitmap, cliprect, 0, 0, 0, 0, 0); + + // hack, draw the roz tilemap if W is held + // todo: fix so that it works with the mixer without crashing(!) + if (gx_specialrozenable == 2) + { + if ( input_code_pressed(screen->machine, KEYCODE_W) ) + { + K053936_0_zoom_draw(bitmap, cliprect,gx_psac_tilemap, 0,0,0); // soccerss playfield + } + } + /* Hack! draw type-1 roz layer here for testing purposes only */ - if (gx_specialrozenable) + if (gx_specialrozenable == 1) { const pen_t *paldata = screen->machine->pens;