From 05e00b0baf1c590119bac5599a20c9e0b9888e43 Mon Sep 17 00:00:00 2001 From: David Haywood <28625134+DavidHaywood@users.noreply.github.com> Date: Wed, 13 Dec 2017 22:41:06 +0000 Subject: [PATCH 1/3] pgm2: fix end of sprite list handling (nw) --- src/mame/video/pgm2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/video/pgm2.cpp b/src/mame/video/pgm2.cpp index dcd56aff64f..88fa0c838fc 100644 --- a/src/mame/video/pgm2.cpp +++ b/src/mame/video/pgm2.cpp @@ -138,9 +138,9 @@ void pgm2_state::draw_sprites(screen_device &screen, const rectangle &cliprect, //printf("frame\n"); - for (int i = 0;i < 0x2000 / 4;i++) + for (int i = 0;i < 0x2000 / 4;i+=4) { - if (spriteram[i] == 0x80000000) + if (spriteram[i+2] & 0x80000000) { endoflist = i; break; From 8467dd0764f6ac293e545b806446c24c99f4e6bc Mon Sep 17 00:00:00 2001 From: David Haywood <28625134+DavidHaywood@users.noreply.github.com> Date: Wed, 13 Dec 2017 23:02:25 +0000 Subject: [PATCH 2/3] pgm2: dynamic resolution change (nw) --- src/mame/drivers/pgm2.cpp | 13 ++++++++++--- src/mame/includes/pgm2.h | 2 ++ src/mame/video/pgm2.cpp | 9 +++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/pgm2.cpp b/src/mame/drivers/pgm2.cpp index f7b2cdd139d..311f3dc9897 100644 --- a/src/mame/drivers/pgm2.cpp +++ b/src/mame/drivers/pgm2.cpp @@ -356,6 +356,7 @@ static ADDRESS_MAP_START( pgm2_map, AS_PROGRAM, 32, pgm2_state ) AM_RANGE(0x30120000, 0x30120003) AM_RAM AM_SHARE("bgscroll") // scroll AM_RANGE(0x30120008, 0x3012000b) AM_RAM AM_SHARE("fgscroll") + AM_RANGE(0x3012000c, 0x3012000f) AM_RAM AM_SHARE("vidmode") AM_RANGE(0x30120030, 0x30120033) AM_WRITE16(share_bank_w, 0xffff0000) AM_RANGE(0x30120038, 0x3012003b) AM_WRITE(sprite_encryption_w) // there are other 0x301200xx regs @@ -570,10 +571,16 @@ static MACHINE_CONFIG_START( pgm2 ) MCFG_PGM2_MEMCARD_ADD("memcard_p2") MCFG_PGM2_MEMCARD_ADD("memcard_p3") MCFG_PGM2_MEMCARD_ADD("memcard_p4") - - MACHINE_CONFIG_END +// not strictly needed as the video code supports changing on the fly, but makes recording easier etc. +static MACHINE_CONFIG_DERIVED( pgm2_lores, pgm2 ) + MCFG_SCREEN_MODIFY("screen") + // note, +8 to y position too, could be a sprite reg to move sprites intead + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0+8, 224+8-1) +MACHINE_CONFIG_END + + /* using macros for the video / sound roms because the locations never change between sets, and we're going to have a LOT of clones to cover all the internal rom regions and external rom revision combinations, so it keeps things readable */ @@ -1119,7 +1126,7 @@ GAME( 2011, kov3_102, kov3, pgm2, pgm2, pgm2_state, kov3_102, ROT0, GAME( 2011, kov3_100, kov3, pgm2, pgm2, pgm2_state, kov3_100, ROT0, "IGS", "Knights of Valour 3 (V100, China)", MACHINE_NOT_WORKING ) // King of Fighters '98: Ultimate Match Hero -GAME( 2009, kof98umh, 0, pgm2, pgm2, pgm2_state, kof98umh, ROT0, "IGS / SNK Playmore / NewChannel", "The King of Fighters '98: Ultimate Match HERO (China, V100, 09-08-23)", MACHINE_NOT_WORKING ) +GAME( 2009, kof98umh, 0, pgm2_lores, pgm2, pgm2_state, kof98umh, ROT0, "IGS / SNK Playmore / NewChannel", "The King of Fighters '98: Ultimate Match HERO (China, V100, 09-08-23)", MACHINE_NOT_WORKING ) // Jigsaw World Arena diff --git a/src/mame/includes/pgm2.h b/src/mame/includes/pgm2.h index 6964760ee8c..d3052a22b3f 100644 --- a/src/mame/includes/pgm2.h +++ b/src/mame/includes/pgm2.h @@ -33,6 +33,7 @@ public: m_sp_videoram(*this, "sp_videoram"), m_bgscroll(*this, "bgscroll"), m_fgscroll(*this, "fgscroll"), + m_vidmode(*this, "vidmode"), m_gfxdecode2(*this, "gfxdecode2"), m_gfxdecode3(*this, "gfxdecode3"), m_arm_aic(*this, "arm_aic"), @@ -133,6 +134,7 @@ private: required_shared_ptr m_sp_videoram; required_shared_ptr m_bgscroll; required_shared_ptr m_fgscroll; + required_shared_ptr m_vidmode; required_device m_gfxdecode2; required_device m_gfxdecode3; required_device m_arm_aic; diff --git a/src/mame/video/pgm2.cpp b/src/mame/video/pgm2.cpp index 88fa0c838fc..1e52296232b 100644 --- a/src/mame/video/pgm2.cpp +++ b/src/mame/video/pgm2.cpp @@ -258,6 +258,15 @@ void pgm2_state::copy_sprites_from_bitmap(screen_device &screen, bitmap_rgb32 &b uint32_t pgm2_state::screen_update_pgm2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { + + int mode = m_vidmode[0] & 0x00010000; // other bits not used? + + if (mode) + m_screen->set_visible_area(0, 448 - 1, 0, 224 - 1); + else // note, +8 to y position too, could be a sprite reg to move sprites intead + m_screen->set_visible_area(0, 320 - 1, 8, 224 + 8 - 1); + + m_fg_tilemap->set_scrollx(0, m_fgscroll[0] & 0xffff); m_fg_tilemap->set_scrolly(0, m_fgscroll[0] >> 16); m_bg_tilemap->set_scrolly(0, (m_bgscroll[0x0/4] & 0xffff0000)>>16 ); From 3af3f197475ee8b77e35be93e8b79aeb22514bfb Mon Sep 17 00:00:00 2001 From: David Haywood <28625134+DavidHaywood@users.noreply.github.com> Date: Wed, 13 Dec 2017 23:28:42 +0000 Subject: [PATCH 3/3] pgm2: fix bug in yzoom code causing hang (nw) --- src/mame/video/pgm2.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mame/video/pgm2.cpp b/src/mame/video/pgm2.cpp index 1e52296232b..8f416b469c8 100644 --- a/src/mame/video/pgm2.cpp +++ b/src/mame/video/pgm2.cpp @@ -216,12 +216,15 @@ void pgm2_state::draw_sprites(screen_device &screen, const rectangle &cliprect, draw_sprite_line(cliprect, mask_offset, palette_offset, x, realy, flipx, reverse, sizex, pal, 1, zoomx_bits, growx); realy++; - if (zoomy_bit) + if (zoomy_bit) // draw it again { palette_offset = pre_palette_offset; mask_offset = pre_mask_offset; + draw_sprite_line(cliprect, mask_offset, palette_offset, x, realy, flipx, reverse, sizex, pal, 1, zoomx_bits, growx); + realy++; } - else ydraw++; + + ydraw++; } } }