From f2e563425fde8189d3d832968982b1107e153b1a Mon Sep 17 00:00:00 2001 From: cam900 Date: Sat, 18 May 2019 20:05:43 +0900 Subject: ms32.cpp, bnstars.cpp, tetrisp2.cpp : Move sprite gfx rearrange function into gfxdecode, Fix notes --- src/mame/drivers/bnstars.cpp | 40 ++++++++++++++++++++++++++++++++++++---- src/mame/drivers/ms32.cpp | 42 ++++++++++++++++++++++++++++++++++++------ src/mame/drivers/tetrisp2.cpp | 35 ++++++++++++++++++++++++++++++++++- src/mame/machine/jalcrpt.cpp | 22 ---------------------- src/mame/machine/jalcrpt.h | 1 - src/mame/video/tetrisp2.cpp | 10 +--------- 6 files changed, 107 insertions(+), 43 deletions(-) diff --git a/src/mame/drivers/bnstars.cpp b/src/mame/drivers/bnstars.cpp index 62be3100cf4..ebf7c33c849 100644 --- a/src/mame/drivers/bnstars.cpp +++ b/src/mame/drivers/bnstars.cpp @@ -8,7 +8,7 @@ Single board version with Dual Screen output (MS32 version also exists) for the time being most of this driver is copied -from ms32.c, with some adjustments for dual screen. +from ms32.cpp, with some adjustments for dual screen. Main PCB @@ -702,7 +702,41 @@ INPUT_PORTS_END /* sprites are contained in 256x256 "tiles" */ -static GFXLAYOUT_RAW( spritelayout, 256, 256, 256*8, 256*256*8 ) +static const uint32_t sprite_xoffset[256] = +{ + STEP8(8*8*8*0, 8), STEP8(8*8*8*1, 8), STEP8(8*8*8*2, 8), STEP8(8*8*8*3, 8), + STEP8(8*8*8*4, 8), STEP8(8*8*8*5, 8), STEP8(8*8*8*6, 8), STEP8(8*8*8*7, 8), + STEP8(8*8*8*8, 8), STEP8(8*8*8*9, 8), STEP8(8*8*8*10, 8), STEP8(8*8*8*11, 8), + STEP8(8*8*8*12, 8), STEP8(8*8*8*13, 8), STEP8(8*8*8*14, 8), STEP8(8*8*8*15, 8), + STEP8(8*8*8*16, 8), STEP8(8*8*8*17, 8), STEP8(8*8*8*18, 8), STEP8(8*8*8*19, 8), + STEP8(8*8*8*20, 8), STEP8(8*8*8*21, 8), STEP8(8*8*8*22, 8), STEP8(8*8*8*23, 8), + STEP8(8*8*8*24, 8), STEP8(8*8*8*25, 8), STEP8(8*8*8*26, 8), STEP8(8*8*8*27, 8), + STEP8(8*8*8*28, 8), STEP8(8*8*8*29, 8), STEP8(8*8*8*30, 8), STEP8(8*8*8*31, 8) +}; +static const uint32_t sprite_yoffset[256] = +{ + STEP8(8*8*8*0, 8*8), STEP8(8*8*8*32, 8*8), STEP8(8*8*8*64, 8*8), STEP8(8*8*8*96, 8*8), + STEP8(8*8*8*128,8*8), STEP8(8*8*8*160,8*8), STEP8(8*8*8*192,8*8), STEP8(8*8*8*224,8*8), + STEP8(8*8*8*256,8*8), STEP8(8*8*8*288,8*8), STEP8(8*8*8*320,8*8), STEP8(8*8*8*352,8*8), + STEP8(8*8*8*384,8*8), STEP8(8*8*8*416,8*8), STEP8(8*8*8*448,8*8), STEP8(8*8*8*480,8*8), + STEP8(8*8*8*512,8*8), STEP8(8*8*8*544,8*8), STEP8(8*8*8*576,8*8), STEP8(8*8*8*608,8*8), + STEP8(8*8*8*640,8*8), STEP8(8*8*8*672,8*8), STEP8(8*8*8*704,8*8), STEP8(8*8*8*736,8*8), + STEP8(8*8*8*768,8*8), STEP8(8*8*8*800,8*8), STEP8(8*8*8*832,8*8), STEP8(8*8*8*864,8*8), + STEP8(8*8*8*896,8*8), STEP8(8*8*8*928,8*8), STEP8(8*8*8*960,8*8), STEP8(8*8*8*992,8*8) +}; +static const gfx_layout spritelayout = +{ + 256, 256, + RGN_FRAC(1,1), + 8, + { STEP8(0,1) }, + EXTENDED_XOFFS, + EXTENDED_YOFFS, + 256*256*8, + sprite_xoffset, + sprite_yoffset +}; + static GFXLAYOUT_RAW( bglayout, 16, 16, 16*8, 16*16*8 ) static GFXLAYOUT_RAW( txlayout, 8, 8, 8*8, 8*8*8 ) @@ -932,8 +966,6 @@ ROM_END /* SS92046_01: bbbxing, f1superb, tetrisp, hayaosi1 */ void bnstars_state::init_bnstars() { - ms32_rearrange_sprites(machine(), "gfx1"); - decrypt_ms32_tx(machine(), 0x00020,0x7e, "gfx5"); decrypt_ms32_bg(machine(), 0x00001,0x9b, "gfx4"); decrypt_ms32_tx(machine(), 0x00020,0x7e, "gfx7"); diff --git a/src/mame/drivers/ms32.cpp b/src/mame/drivers/ms32.cpp index 83b746c473a..8b63feecc73 100644 --- a/src/mame/drivers/ms32.cpp +++ b/src/mame/drivers/ms32.cpp @@ -941,7 +941,7 @@ static INPUT_PORTS_START( ms32_mahjong ) PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1) PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_UNUSED ) /* Start 1 is already mapped in mahjong inputs */ - PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_UNUSED ) /* ms32.c mahjongs don't have P2 inputs -> no Start 2*/ + PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_UNUSED ) /* ms32.cpp mahjongs don't have P2 inputs -> no Start 2*/ PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -1559,7 +1559,41 @@ INPUT_PORTS_END /********** GFX DECODE **********/ /* sprites are contained in 256x256 "tiles" */ -static GFXLAYOUT_RAW( spritelayout, 256, 256, 256*8, 256*256*8 ) +static const uint32_t sprite_xoffset[256] = +{ + STEP8(8*8*8*0, 8), STEP8(8*8*8*1, 8), STEP8(8*8*8*2, 8), STEP8(8*8*8*3, 8), + STEP8(8*8*8*4, 8), STEP8(8*8*8*5, 8), STEP8(8*8*8*6, 8), STEP8(8*8*8*7, 8), + STEP8(8*8*8*8, 8), STEP8(8*8*8*9, 8), STEP8(8*8*8*10, 8), STEP8(8*8*8*11, 8), + STEP8(8*8*8*12, 8), STEP8(8*8*8*13, 8), STEP8(8*8*8*14, 8), STEP8(8*8*8*15, 8), + STEP8(8*8*8*16, 8), STEP8(8*8*8*17, 8), STEP8(8*8*8*18, 8), STEP8(8*8*8*19, 8), + STEP8(8*8*8*20, 8), STEP8(8*8*8*21, 8), STEP8(8*8*8*22, 8), STEP8(8*8*8*23, 8), + STEP8(8*8*8*24, 8), STEP8(8*8*8*25, 8), STEP8(8*8*8*26, 8), STEP8(8*8*8*27, 8), + STEP8(8*8*8*28, 8), STEP8(8*8*8*29, 8), STEP8(8*8*8*30, 8), STEP8(8*8*8*31, 8) +}; +static const uint32_t sprite_yoffset[256] = +{ + STEP8(8*8*8*0, 8*8), STEP8(8*8*8*32, 8*8), STEP8(8*8*8*64, 8*8), STEP8(8*8*8*96, 8*8), + STEP8(8*8*8*128,8*8), STEP8(8*8*8*160,8*8), STEP8(8*8*8*192,8*8), STEP8(8*8*8*224,8*8), + STEP8(8*8*8*256,8*8), STEP8(8*8*8*288,8*8), STEP8(8*8*8*320,8*8), STEP8(8*8*8*352,8*8), + STEP8(8*8*8*384,8*8), STEP8(8*8*8*416,8*8), STEP8(8*8*8*448,8*8), STEP8(8*8*8*480,8*8), + STEP8(8*8*8*512,8*8), STEP8(8*8*8*544,8*8), STEP8(8*8*8*576,8*8), STEP8(8*8*8*608,8*8), + STEP8(8*8*8*640,8*8), STEP8(8*8*8*672,8*8), STEP8(8*8*8*704,8*8), STEP8(8*8*8*736,8*8), + STEP8(8*8*8*768,8*8), STEP8(8*8*8*800,8*8), STEP8(8*8*8*832,8*8), STEP8(8*8*8*864,8*8), + STEP8(8*8*8*896,8*8), STEP8(8*8*8*928,8*8), STEP8(8*8*8*960,8*8), STEP8(8*8*8*992,8*8) +}; +static const gfx_layout spritelayout = +{ + 256, 256, + RGN_FRAC(1,1), + 8, + { STEP8(0,1) }, + EXTENDED_XOFFS, + EXTENDED_YOFFS, + 256*256*8, + sprite_xoffset, + sprite_yoffset +}; + static GFXLAYOUT_RAW( bglayout, 16, 16, 16*8, 16*16*8 ) static GFXLAYOUT_RAW( txlayout, 8, 8, 8*8, 8*8*8 ) @@ -2554,7 +2588,6 @@ void ms32_state::init_ms32_common() void ms32_state::init_ss91022_10() { init_ms32_common(); - ms32_rearrange_sprites(machine(), "gfx1"); decrypt_ms32_tx(machine(), 0x00000,0x35, "gfx4"); decrypt_ms32_bg(machine(), 0x00000,0xa3, "gfx3"); } @@ -2563,7 +2596,6 @@ void ms32_state::init_ss91022_10() void ms32_state::init_ss92046_01() { init_ms32_common(); - ms32_rearrange_sprites(machine(), "gfx1"); decrypt_ms32_tx(machine(), 0x00020,0x7e, "gfx4"); decrypt_ms32_bg(machine(), 0x00001,0x9b, "gfx3"); } @@ -2572,7 +2604,6 @@ void ms32_state::init_ss92046_01() void ms32_state::init_ss92047_01() { init_ms32_common(); - ms32_rearrange_sprites(machine(), "gfx1"); decrypt_ms32_tx(machine(), 0x24000,0x18, "gfx4"); decrypt_ms32_bg(machine(), 0x24000,0x55, "gfx3"); } @@ -2581,7 +2612,6 @@ void ms32_state::init_ss92047_01() void ms32_state::init_ss92048_01() { init_ms32_common(); - ms32_rearrange_sprites(machine(), "gfx1"); decrypt_ms32_tx(machine(), 0x20400,0xd6, "gfx4"); decrypt_ms32_bg(machine(), 0x20400,0xd4, "gfx3"); } diff --git a/src/mame/drivers/tetrisp2.cpp b/src/mame/drivers/tetrisp2.cpp index ba2f9a316c8..b855fe4d0bb 100644 --- a/src/mame/drivers/tetrisp2.cpp +++ b/src/mame/drivers/tetrisp2.cpp @@ -1574,7 +1574,40 @@ static const gfx_layout layout_16x16x8 = /* sprites are contained in 256x256 "tiles" */ -static GFXLAYOUT_RAW( spritelayout, 256, 256, 256*8, 256*256*8 ) +static const uint32_t sprite_xoffset[256] = +{ + STEP8(8*8*8*0, 8), STEP8(8*8*8*1, 8), STEP8(8*8*8*2, 8), STEP8(8*8*8*3, 8), + STEP8(8*8*8*4, 8), STEP8(8*8*8*5, 8), STEP8(8*8*8*6, 8), STEP8(8*8*8*7, 8), + STEP8(8*8*8*8, 8), STEP8(8*8*8*9, 8), STEP8(8*8*8*10, 8), STEP8(8*8*8*11, 8), + STEP8(8*8*8*12, 8), STEP8(8*8*8*13, 8), STEP8(8*8*8*14, 8), STEP8(8*8*8*15, 8), + STEP8(8*8*8*16, 8), STEP8(8*8*8*17, 8), STEP8(8*8*8*18, 8), STEP8(8*8*8*19, 8), + STEP8(8*8*8*20, 8), STEP8(8*8*8*21, 8), STEP8(8*8*8*22, 8), STEP8(8*8*8*23, 8), + STEP8(8*8*8*24, 8), STEP8(8*8*8*25, 8), STEP8(8*8*8*26, 8), STEP8(8*8*8*27, 8), + STEP8(8*8*8*28, 8), STEP8(8*8*8*29, 8), STEP8(8*8*8*30, 8), STEP8(8*8*8*31, 8) +}; +static const uint32_t sprite_yoffset[256] = +{ + STEP8(8*8*8*0, 8*8), STEP8(8*8*8*32, 8*8), STEP8(8*8*8*64, 8*8), STEP8(8*8*8*96, 8*8), + STEP8(8*8*8*128,8*8), STEP8(8*8*8*160,8*8), STEP8(8*8*8*192,8*8), STEP8(8*8*8*224,8*8), + STEP8(8*8*8*256,8*8), STEP8(8*8*8*288,8*8), STEP8(8*8*8*320,8*8), STEP8(8*8*8*352,8*8), + STEP8(8*8*8*384,8*8), STEP8(8*8*8*416,8*8), STEP8(8*8*8*448,8*8), STEP8(8*8*8*480,8*8), + STEP8(8*8*8*512,8*8), STEP8(8*8*8*544,8*8), STEP8(8*8*8*576,8*8), STEP8(8*8*8*608,8*8), + STEP8(8*8*8*640,8*8), STEP8(8*8*8*672,8*8), STEP8(8*8*8*704,8*8), STEP8(8*8*8*736,8*8), + STEP8(8*8*8*768,8*8), STEP8(8*8*8*800,8*8), STEP8(8*8*8*832,8*8), STEP8(8*8*8*864,8*8), + STEP8(8*8*8*896,8*8), STEP8(8*8*8*928,8*8), STEP8(8*8*8*960,8*8), STEP8(8*8*8*992,8*8) +}; +static const gfx_layout spritelayout = +{ + 256, 256, + RGN_FRAC(1,1), + 8, + { STEP8(0,1) }, + EXTENDED_XOFFS, + EXTENDED_YOFFS, + 256*256*8, + sprite_xoffset, + sprite_yoffset +}; static GFXDECODE_START( gfx_tetrisp2 ) diff --git a/src/mame/machine/jalcrpt.cpp b/src/mame/machine/jalcrpt.cpp index 9db6afabee1..26b20155673 100644 --- a/src/mame/machine/jalcrpt.cpp +++ b/src/mame/machine/jalcrpt.cpp @@ -118,28 +118,6 @@ void rodland_rom_decode(running_machine &machine, const char *region) /* SS92048-01: p47aces, 47pie2, 47pie2o */ -void ms32_rearrange_sprites(running_machine &machine, const char *region) -{ - /* sprites are not encrypted, but we need to move the data around to handle them as 256x256 tiles */ - int i; - uint8_t *source_data; - int source_size; - - source_data = machine.root_device().memregion ( region )->base(); - source_size = machine.root_device().memregion( region )->bytes(); - - std::vector result_data(source_size); - - for(i=0; i> 5); - - result_data[i] = source_data[j]; - } - - memcpy (source_data, &result_data[0], source_size); -} - void decrypt_ms32_tx(running_machine &machine, int addr_xor,int data_xor, const char *region) { diff --git a/src/mame/machine/jalcrpt.h b/src/mame/machine/jalcrpt.h index e02d8bbe117..36783f243fb 100644 --- a/src/mame/machine/jalcrpt.h +++ b/src/mame/machine/jalcrpt.h @@ -4,6 +4,5 @@ void astyanax_rom_decode(running_machine &machine, const char *region); void phantasm_rom_decode(running_machine &machine, const char *region); void rodland_rom_decode (running_machine &machine, const char *region); -void ms32_rearrange_sprites(running_machine &machine, const char *region); void decrypt_ms32_tx(running_machine &machine, int addr_xor,int data_xor, const char *region); void decrypt_ms32_bg(running_machine &machine, int addr_xor,int data_xor, const char *region); diff --git a/src/mame/video/tetrisp2.cpp b/src/mame/video/tetrisp2.cpp index 769cba99e62..881099a042b 100644 --- a/src/mame/video/tetrisp2.cpp +++ b/src/mame/video/tetrisp2.cpp @@ -230,7 +230,6 @@ VIDEO_START_MEMBER(tetrisp2_state,tetrisp2) // should be smaller and mirrored like m32 I guess m_priority = std::make_unique(0x40000); - ms32_rearrange_sprites(machine(), "gfx1"); save_item(NAME(m_flipscreen_old)); save_pointer(NAME(m_priority), 0x40000); @@ -256,7 +255,6 @@ VIDEO_START_MEMBER(tetrisp2_state,rockntread) // should be smaller and mirrored like m32 I guess m_priority = std::make_unique(0x40000); - ms32_rearrange_sprites(machine(), "gfx1"); save_item(NAME(m_flipscreen_old)); save_pointer(NAME(m_priority), 0x40000); @@ -274,8 +272,6 @@ VIDEO_START_MEMBER(tetrisp2_state,rocknms) m_tilemap_sub_bg->set_transparent_pen(0); m_tilemap_sub_fg->set_transparent_pen(0); m_tilemap_sub_rot->set_transparent_pen(0); - - ms32_rearrange_sprites(machine(), "gfx5"); } @@ -316,7 +312,7 @@ VIDEO_START_MEMBER(tetrisp2_state,rocknms) ***************************************************************************/ -/* this is also used by ms32.c */ +/* this is also used by ms32.cpp */ /* sprites should be able to create shadows too, how? -- it appears that sprites which should be shadows are often rendered *UNDER* the tilemaps, maybe related? */ @@ -739,10 +735,6 @@ VIDEO_START_MEMBER(stepstag_state,stepstag) // should be smaller and mirrored like m32 I guess m_priority = std::make_unique(0x40000); - - ms32_rearrange_sprites(machine(), "sprites_left"); - ms32_rearrange_sprites(machine(), "sprites_mid"); - ms32_rearrange_sprites(machine(), "sprites_right"); } uint32_t stepstag_state::screen_update_stepstag_left(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -- cgit v1.2.3