diff options
author | 2020-06-06 00:21:24 +0100 | |
---|---|---|
committer | 2020-06-05 19:21:24 -0400 | |
commit | 4cd69c41afa44a768e21913d4aa9c80cb656b059 (patch) | |
tree | bb6c3780d86742a85b4df75b1966320ddaaad8c1 /src/devices/machine/spg_renderer.cpp | |
parent | 9e7fb4f85dc9c1e15c56bfbb8e1cb43e6ac858e4 (diff) |
gpl16250 / sunplus rendering - improvements for jak_pf (double height tilemaps etc.) (nw) (#6797)
Diffstat (limited to 'src/devices/machine/spg_renderer.cpp')
-rw-r--r-- | src/devices/machine/spg_renderer.cpp | 59 |
1 files changed, 47 insertions, 12 deletions
diff --git a/src/devices/machine/spg_renderer.cpp b/src/devices/machine/spg_renderer.cpp index c9156585441..19a0cbaff05 100644 --- a/src/devices/machine/spg_renderer.cpp +++ b/src/devices/machine/spg_renderer.cpp @@ -419,24 +419,29 @@ void spg_renderer_device::draw_page(bool read_from_csspace, bool has_extended_ti uint32_t total_width; uint32_t y_mask; uint32_t screenwidth; - uint32_t drawwidthmask; - if (read_from_csspace && ((attr >> 15) & 0x1)) + + if (read_from_csspace && (attr & 0x8000)) // is this only available in high res mode, or always? { // just a guess based on this being set on the higher resolution tilemaps we've seen, could be 100% incorrect register total_width = 1024; - y_mask = 0x1ff; + y_mask = 0x200; screenwidth = 640; - drawwidthmask = 0x400 - 1; } else { total_width = 512; - y_mask = 0xff; + y_mask = 0x100; screenwidth = 320; - drawwidthmask = 0x200 - 1; } + if (has_extended_tilemaps && (attr & 0x4000)) // is this only available in high res mode, or always? + { + y_mask <<= 1; // double height tilemap? + } + + const uint32_t drawwidthmask = total_width - 1; + y_mask--; // turn into actual mask const uint32_t xscroll = scrollregs[0]; const uint32_t yscroll = scrollregs[1]; @@ -471,8 +476,16 @@ void spg_renderer_device::draw_page(bool read_from_csspace, bool has_extended_ti int realxscroll = xscroll; if (row_scroll) { - // Tennis in My Wireless Sports confirms the need to add the scroll value here rather than rowscroll being screen-aligned - realxscroll += (int16_t)scrollram[(logical_scanline + yscroll) & 0xff]; + if (!has_extended_tilemaps) + { + // Tennis in My Wireless Sports confirms the need to add the scroll value here rather than rowscroll being screen-aligned + realxscroll += (int16_t)scrollram[(logical_scanline + yscroll) & 0xff]; + } + else + { + // the logic seems to be different on GPL16250, see Galaxian in paccon and Crazy Moto in myac220, is this mode be selected or did behavior just change? + realxscroll += (int16_t)scrollram[logical_scanline & 0xff]; + } } const int upperscrollbits = (realxscroll >> (tile_width + 3)); @@ -499,7 +512,24 @@ void spg_renderer_device::draw_page(bool read_from_csspace, bool has_extended_ti tile = (ctrl & 0x0004) ? spc.read_word(tilemap_rambase) : spc.read_word(tilemap_rambase + tile_address); if (!tile) - continue; + { + if (!has_extended_tilemaps) + { + // always skip on older SPG types? + continue; + } + else if (m_video_regs_7f & 0x0002) + { + // Galaga in paccon won't render '0' characters in the scoring table if you skip empty tiles, so maybe GPL16250 doesn't skip? - extra tile bits from extended read make no difference + + // probably not based on register m_video_regs_7f, but paccon galaga needs no skip, jak_gtg and jak_hmhsm needs to skip + //49 0100 1001 no skip (paccon galaga) + //4b 0100 1011 skip (paccon pacman) + //53 0101 0011 skip (jak_gtg, jak_hmhsm) + continue; + } + } + uint32_t tileattr = attr; uint32_t tilectrl = ctrl; @@ -537,7 +567,11 @@ void spg_renderer_device::draw_page(bool read_from_csspace, bool has_extended_ti tilectrl |= (exattribute << 2) & 0x0100; // blend } - blend = ((tileattr & 0x4000 || tilectrl & 0x0100)) ? BlendOn : BlendOff; + if (!has_extended_tilemaps) + blend = (tilectrl & 0x0100) ? BlendOn : BlendOff; + else + blend = ((/*tileattr & 0x4000 ||*/ tilectrl & 0x0100)) ? BlendOn : BlendOff; // is this logic even correct or should it just be like above? where is the extra enable needed? + flip_x = (tileattr & 0x0004) ? FlipXOn : FlipXOff; flip_y = (tileattr & 0x0008); @@ -586,6 +620,7 @@ void spg_renderer_device::draw_sprite(bool read_from_csspace, bool has_extended_ // screenheight = 480; screenheight = 512; xmask = 0x3ff; + ymask = 0x3ff; } const uint32_t tile_h = 8 << ((attr & 0x00c0) >> 6); @@ -680,7 +715,7 @@ void spg_renderer_device::draw_sprite(bool read_from_csspace, bool has_extended_ else { // clipped from top - int tempfirstline = firstline - 0x200; + int tempfirstline = firstline - (screenheight<<1); int templastline = lastline; int scanx = scanline - tempfirstline; @@ -690,7 +725,7 @@ void spg_renderer_device::draw_sprite(bool read_from_csspace, bool has_extended_ } // clipped against the bottom tempfirstline = firstline; - templastline = lastline + 0x200; + templastline = lastline + (screenheight<<1); scanx = scanline - tempfirstline; if ((scanx >= 0) && (scanline <= templastline)) |