konamigx.cpp: fix sprite DMA transfers for type 3/4 right monitor, and fixed right screen protection in Rushing Heroes and Run & Gun 2. This makes dual monitor 4 players play possible (and enabled by default) [Angelo Salese]

This commit is contained in:
angelosa 2020-04-13 21:45:44 +02:00
parent 5b6013caea
commit b22f214025
3 changed files with 75 additions and 27 deletions

View File

@ -869,6 +869,8 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w)
}
else
{
if ((data & 0xff00) == 0)
m_last_prot_param = data & 0xffff;
data >>= 16;
clk = data & 0x200;
@ -908,11 +910,23 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w)
}
else if(m_last_prot_op == 0xd97) // rushhero
{
int src = 0xc09ff0;
int dst = 0xd20000;
int spr;
for (spr = 0; spr < 256; spr++)
u32 src = 0xc09ff0;
u32 dst = 0xd20000;
//u32 input_src = 0xc01cc0;
//u32 input_dst = 0xc00507;
// screen 1
// if (m_last_prot_param == 0x004a)
// screen 2
if (m_last_prot_param == 0x0062)
{
src = 0xc19ff0;
dst = 0xd21000;
//input_src += 0x10000;
//input_dst += 0x40;
}
for (int spr = 0; spr < 256; spr++)
{
for (i = 0; i <= 0x10; i += 4)
{
@ -924,10 +938,15 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w)
}
/* Input buffer copiers, only this command is executed so it's safe to assume that's polled here */
space.write_byte(0xc01cc0, ~space.read_byte(0xc00507));
space.write_byte(0xc01cc1, ~space.read_byte(0xc00527));
space.write_byte(0xc01cc4, ~space.read_byte(0xc00547));
space.write_byte(0xc01cc5, ~space.read_byte(0xc00567));
space.write_byte(0xc01cc0 + 0, ~space.read_byte(0xc00507 + 0x00));
space.write_byte(0xc01cc0 + 1, ~space.read_byte(0xc00507 + 0x20));
space.write_byte(0xc01cc0 + 4, ~space.read_byte(0xc00507 + 0x40));
space.write_byte(0xc01cc0 + 5, ~space.read_byte(0xc00507 + 0x60));
space.write_byte(0xc11cc0 + 0, ~space.read_byte(0xc00507 + 0x00));
space.write_byte(0xc11cc0 + 1, ~space.read_byte(0xc00507 + 0x20));
space.write_byte(0xc11cc0 + 4, ~space.read_byte(0xc00507 + 0x40));
space.write_byte(0xc11cc0 + 5, ~space.read_byte(0xc00507 + 0x60));
}
else if(m_last_prot_op == 0xb16) // slamdnk2
{
@ -944,6 +963,20 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w)
//maybe here there's a [$d8001f] <- 0x31 write too?
}
// TODO: it actually calls 0x1b54-335e-125c-3a56-1b55-3357-1255-3a4f on odd frames
// should first move a block to a work RAM buffer then send it to the actual sprite entries
else if (m_last_prot_op == 0x3a4f) // slamdnk2 right screen
{
u32 src = 0xc18400;
u32 dst = 0xd21000;
for (int spr = 0; spr < 0x400; spr++)
{
space.write_word(dst, space.read_word(src));
src += 4;
dst += 2;
}
}
else if(m_last_prot_op == 0x515) // vsnetscr screen 1
{
int adr;
@ -1046,11 +1079,12 @@ void konamigx_state::gx_type2_map(address_map &map)
void konamigx_state::gx_type3_map(address_map &map)
{
gx_base_memmap(map);
map(0xd20000, 0xd21fff).rw(m_k055673, FUNC(k055673_device::k053247_word_r), FUNC(k055673_device::k053247_word_w));
map(0xd90000, 0xd97fff).ram();
//map(0xcc0000, 0xcc0007).w(FUNC(konamigx_state::type4_prot_w));
map(0xe00000, 0xe0001f).ram().share("k053936_0_ctrl");
//map(0xe20000, 0xe20003).nopw();
map(0xe40000, 0xe40003).w(FUNC(konamigx_state::konamigx_type3_psac2_bank_w)).share("psac2_bank");
map(0xe40000, 0xe40003).w(FUNC(konamigx_state::type3_bank_w)).umask32(0xffffffff);
map(0xe60000, 0xe60fff).ram().share("k053936_0_line");
map(0xe80000, 0xe83fff).ram().share("paletteram"); // main monitor palette
map(0xea0000, 0xea3fff).ram().share("subpaletteram");
@ -1062,10 +1096,11 @@ void konamigx_state::gx_type4_map(address_map &map)
{
gx_base_memmap(map);
map(0xcc0000, 0xcc0007).w(FUNC(konamigx_state::type4_prot_w));
map(0xd20000, 0xd21fff).rw(m_k055673, FUNC(k055673_device::k053247_word_r), FUNC(k055673_device::k053247_word_w));
map(0xd90000, 0xd97fff).ram();
map(0xe00000, 0xe0001f).ram().share("k053936_0_ctrl");
map(0xe20000, 0xe20003).nopw();
map(0xe40000, 0xe40003).nopw();
map(0xe40000, 0xe40003).w(FUNC(konamigx_state::type3_bank_w)).umask32(0xffffffff);
map(0xe60000, 0xe60fff).ram().share("k053936_0_line"); // 29C & 29G (PSAC2 line control)
map(0xe80000, 0xe87fff).ram().share("paletteram"); // 11G/13G/15G (main screen palette RAM)
map(0xea0000, 0xea7fff).ram().share("subpaletteram"); // 5G/7G/9G (sub screen palette RAM)
@ -1507,7 +1542,7 @@ static INPUT_PORTS_START( type3 )
PORT_DIPNAME( 0x04000000, 0x04000000, "Right Monitor Flip Screen" ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x04000000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00000000, DEF_STR( On ) )
PORT_DIPNAME( 0x08000000, 0x08000000, "Number of Screens" ) PORT_DIPLOCATION("SW1:4")
PORT_DIPNAME( 0x08000000, 0x00000000, "Number of Screens" ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x08000000, "1" )
PORT_DIPSETTING( 0x00000000, "2" )
INPUT_PORTS_END

View File

@ -49,7 +49,6 @@ public:
, m_k053936_0_linectrl(*this, "k053936_0_line", 32)
, m_k053936_0_ctrl_16(*this, "k053936_0_ct16", 16)
, m_k053936_0_linectrl_16(*this, "k053936_0_li16", 16)
, m_konamigx_type3_psac2_bank(*this, "psac2_bank")
, m_generic_paletteram_32(*this, "paletteram")
, m_an0(*this, "AN0")
, m_an1(*this, "AN1")
@ -78,7 +77,7 @@ public:
DECLARE_WRITE16_MEMBER(K055550_word_w);
DECLARE_WRITE16_MEMBER(K053990_martchmp_word_w);
DECLARE_WRITE32_MEMBER(fantjour_dma_w);
DECLARE_WRITE32_MEMBER(konamigx_type3_psac2_bank_w);
DECLARE_WRITE8_MEMBER(type3_bank_w);
DECLARE_WRITE32_MEMBER(konamigx_tilebank_w);
DECLARE_WRITE32_MEMBER(konamigx_t1_psacmap_w);
DECLARE_WRITE32_MEMBER(konamigx_t4_psacmap_w);
@ -216,7 +215,6 @@ protected:
optional_shared_ptr<uint16_t> m_k053936_0_linectrl;
optional_shared_ptr<uint16_t> m_k053936_0_ctrl_16;
optional_shared_ptr<uint16_t> m_k053936_0_linectrl_16;
optional_shared_ptr<uint32_t> m_konamigx_type3_psac2_bank;
optional_shared_ptr<uint32_t> m_generic_paletteram_32;
optional_ioport m_an0, m_an1, m_light0_x, m_light0_y, m_light1_x, m_light1_y, m_eepromout;
@ -232,6 +230,7 @@ protected:
int m_gx_cfgport;
int m_suspension_active, m_resume_trigger;
int m_last_prot_op, m_last_prot_clk;
u16 m_last_prot_param;
uint8_t m_prev_pixel_clock;
uint8_t m_esc_program[4096];
@ -291,7 +290,8 @@ protected:
std::unique_ptr<bitmap_ind16> m_gxtype1_roz_dstbitmap2;
rectangle m_gxtype1_roz_dstbitmapclip;
int m_konamigx_type3_psac2_actual_bank;
u8 m_type3_psac2_bank;
u8 m_type3_spriteram_bank;
//int m_konamigx_type3_psac2_actual_last_bank = 0;
int m_use_68020_post_clock_hack;
output_finder<> m_lamp;

View File

@ -273,7 +273,7 @@ void konamigx_state::wipezbuf(int noshadow)
* shadow enables transparent shadows. Note that it applies to the last sprite pen ONLY.
* The rest of the sprite remains normal.
*/
#define GX_MAX_SPRITES 512
#define GX_MAX_SPRITES 512*2
#define GX_MAX_LAYERS 6
#define GX_MAX_OBJECTS (GX_MAX_SPRITES + GX_MAX_LAYERS)
@ -292,7 +292,7 @@ void konamigx_state::konamigx_mixer_init(screen_device &screen, int objdma)
if (objdma)
{
m_gx_spriteram = auto_alloc_array(machine(), uint16_t, 0x1000/2);
m_gx_spriteram = auto_alloc_array(machine(), uint16_t, 0x2000/2);
m_gx_objdma = 1;
}
else
@ -489,7 +489,11 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap,
// i = j = 0xff;
int l = 0;
for (int offs=0; offs<0x800; offs+=8)
u32 start_addr = m_type3_spriteram_bank ? 0x800 : 0;
u32 end_addr = start_addr + 0x800;
for (int offs=start_addr; offs<end_addr; offs+=8)
{
int pri = 0;
@ -920,12 +924,21 @@ TILE_GET_INFO_MEMBER(konamigx_state::get_gx_psac_tile_info)
}
WRITE32_MEMBER(konamigx_state::konamigx_type3_psac2_bank_w)
WRITE8_MEMBER(konamigx_state::type3_bank_w)
{
// other bits are used for something...
COMBINE_DATA(&m_konamigx_type3_psac2_bank[offset]);
m_konamigx_type3_psac2_actual_bank = (m_konamigx_type3_psac2_bank[0] & 0x10000000) >> 28;
if (offset == 0)
{
m_type3_psac2_bank = (data & 0x10) >> 4;
// swap sprite display bank for left/right screens
// bit 6 works for soccerss, doesn't for type4 (where they never enable it)
// so the best candidate is bit 0
//m_type3_spriteram_bank = (data & 0x40) >> 6;
m_type3_spriteram_bank = (data & 0x01);
}
else
logerror("Write to type3 bank %02x address %02x\n",offset, data);
/* handle this by creating 2 roz tilemaps instead, otherwise performance dies completely on dual screen mode
if (m_konamigx_type3_psac2_actual_bank!=m_konamigx_type3_psac2_actual_last_bank)
@ -940,7 +953,7 @@ WRITE32_MEMBER(konamigx_state::konamigx_type3_psac2_bank_w)
/* Soccer Superstars (tile and flip bits now TRUSTED) */
TILE_GET_INFO_MEMBER(konamigx_state::get_gx_psac3_tile_info)
{
{
int tileno, colour, flip;
uint8_t *tmap = memregion("gfx4")->base();
@ -958,10 +971,10 @@ TILE_GET_INFO_MEMBER(konamigx_state::get_gx_psac3_tile_info)
if (tmap[(base_index*2)+1] & 0x10) flip |= TILE_FLIPX;
tileinfo.set(0, tileno, colour, flip);
}
}
TILE_GET_INFO_MEMBER(konamigx_state::get_gx_psac3_alt_tile_info)
{
{
int tileno, colour, flip;
uint8_t *tmap = memregion("gfx4")->base()+0x20000;
@ -979,7 +992,7 @@ TILE_GET_INFO_MEMBER(konamigx_state::get_gx_psac3_alt_tile_info)
if (tmap[(base_index*2)+1] & 0x10) flip |= TILE_FLIPX;
tileinfo.set(0, tileno, colour, flip);
}
}
/* PSAC4 */
@ -1433,7 +1446,7 @@ uint32_t konamigx_state::screen_update_konamigx(screen_device &screen, bitmap_rg
temprect = cliprect;
temprect.max_x = cliprect.min_x+320;
if (m_konamigx_type3_psac2_actual_bank == 1) K053936_0_zoom_draw(screen, *m_type3_roz_temp_bitmap, temprect,m_gx_psac_tilemap_alt, 0,0,0); // soccerss playfield
if (m_type3_psac2_bank == 1) K053936_0_zoom_draw(screen, *m_type3_roz_temp_bitmap, temprect,m_gx_psac_tilemap_alt, 0,0,0); // soccerss playfield
else K053936_0_zoom_draw(screen, *m_type3_roz_temp_bitmap, temprect,m_gx_psac_tilemap, 0,0,0); // soccerss playfield