snk/hng64_v.cpp: Implemented some missing Hyper NeoGeo 64 video features. (#10905)

* Enabled additive blending in certain situations where it improves the visuals.
* Prevent background colour flickering in sams64/sams64_2 due to using wrong register bit.
* Added mosaic effect for tilemaps.
* Cleaned up code.
This commit is contained in:
David Haywood 2023-02-18 15:41:24 +00:00 committed by GitHub
parent 391c33ec57
commit d3eaa5b62e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 503 additions and 710 deletions

View File

@ -139,6 +139,7 @@ public:
driver_device(mconfig, type, tag),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_vblank(*this, "VBLANK"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_iomcu(*this, "iomcu"),
@ -184,6 +185,7 @@ public:
uint8_t *m_texturerom = nullptr;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_ioport m_vblank;
private:
static constexpr int HNG64_MASTER_CLOCK = 50'000'000;
@ -199,24 +201,6 @@ private:
static constexpr int VBEND = 0;
static constexpr int VBSTART = 224*2;
enum hng64trans_t
{
HNG64_TILEMAP_NORMAL = 1,
HNG64_TILEMAP_ADDITIVE,
HNG64_TILEMAP_ALPHA
};
struct blit_parameters
{
bitmap_rgb32 * bitmap = nullptr;
rectangle cliprect;
uint32_t tilemap_priority_code = 0;
uint8_t mask = 0;
uint8_t value = 0;
uint8_t alpha = 0;
hng64trans_t drawformat;
};
required_device<mips3_device> m_maincpu;
required_device<v53a_device> m_audiocpu;
required_device<tmp87ph40an_device> m_iomcu;
@ -299,8 +283,6 @@ private:
hng64_tilemap m_tilemap[4]{};
uint8_t m_additive_tilemap_debug = 0U;
uint32_t m_old_animmask = 0U;
uint32_t m_old_animbits = 0U;
uint16_t m_old_tileflags[4]{};
@ -429,22 +411,16 @@ private:
void hng64_mark_all_tiles_dirty(int tilemap);
void hng64_mark_tile_dirty(int tilemap, int tile_index);
void hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int tm);
void hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t *tmap, const blit_parameters *blit,
uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, int wraparound);
uint16_t get_tileregs(int tm);
uint16_t get_scrollbase(int tm);
void hng64_tilemap_draw_roz(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, tilemap_t *tmap,
uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy,
int wraparound, uint32_t flags, uint8_t priority, hng64trans_t drawformat);
void hng64_tilemap_draw_roz_primask(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, tilemap_t *tmap,
uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy,
int wraparound, uint32_t flags, uint8_t priority, uint8_t priority_mask, hng64trans_t drawformat);
static void hng64_configure_blit_parameters(blit_parameters *blit, tilemap_t *tmap, bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t flags, uint8_t priority, uint8_t priority_mask, hng64trans_t drawformat);
int get_blend_mode(int tm);
void hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int tm, int flags, int line);
void hng64_tilemap_draw_roz_core_line(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, tilemap_t *tmap,
int wraparound, uint8_t drawformat, uint8_t alpha, uint8_t mosaic, uint8_t tm);
std::unique_ptr<hng64_poly_renderer> m_poly_renderer;

View File

@ -64,7 +64,7 @@ void hng64_state::dl_unk_w(offs_t offset, uint32_t data, uint32_t mem_mask)
void hng64_state::dl_upload_w(uint32_t data)
{
//m_paletteState3d = 0; // no, breaks fatfurwa characters
// Data is:
// 00000b50 for the sams64 games
// 00000f00 for everything else
@ -569,7 +569,7 @@ void hng64_state::recoverPolygonBlock(const uint16_t* packet, int& numPolys)
// on the select screen, where this bit is not enabled.
// (to see the cars on the select screen disable sprite rendering, as there are
// currently priority issues)
//
//
// however for sams64 this is enabled on the 2nd character, but not the 1st character
// and the additional palette offset definitely only applies to the 2nd
//
@ -663,7 +663,7 @@ void hng64_state::recoverPolygonBlock(const uint16_t* packet, int& numPolys)
// chunkOffset[6 + (6*m)] is almost always 0080, but it's 0070 for the translucent globe in fatfurwa player select
currentPoly.vert[m].texCoords[0] = uToF(chunkOffset[7 + (6*m)]);
currentPoly.vert[m].texCoords[1] = uToF(chunkOffset[8 + (6*m)]);
if (currentPoly.flatShade)
currentPoly.vert[m].colorIndex = chunkOffset[7 + (6*m)] >> 5;

File diff suppressed because it is too large Load Diff