From 0dfdb639b5cd6bf0b3dc8b24cb838d4a740f0ab5 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Tue, 16 Mar 2010 08:41:13 +0000 Subject: [PATCH] not worth mention: snes.c: removed unchecked debug options and added a few new ones --- src/mame/drivers/snesb.c | 60 +++++++++++++++++++++------------------- src/mame/video/snes.c | 35 +++++++++++++++++++---- 2 files changed, 61 insertions(+), 34 deletions(-) diff --git a/src/mame/drivers/snesb.c b/src/mame/drivers/snesb.c index ecca4c8ec8e..13714a15f73 100644 --- a/src/mame/drivers/snesb.c +++ b/src/mame/drivers/snesb.c @@ -331,37 +331,41 @@ static INPUT_PORTS_START( snes_common ) PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) #ifdef SNES_LAYER_DEBUG - PORT_START("INTERNAL") /* IN 8 : Internal switches */ - PORT_CONFNAME( 0x1, 0x1, "Enforce 32 sprites/line" ) - PORT_CONFSETTING( 0x0, DEF_STR( No ) ) - PORT_CONFSETTING( 0x1, DEF_STR( Yes ) ) + PORT_START("DEBUG1") + PORT_CONFNAME( 0x70, 0x00, "Select OAM" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x10, "OAM1 only" ) + PORT_CONFSETTING( 0x20, "OAM2 only" ) + PORT_CONFSETTING( 0x30, "OAM3 only" ) + PORT_CONFSETTING( 0x40, "OAM4 only" ) + PORT_CONFNAME( 0x80, 0x00, "Draw sprite in reverse order" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x80, DEF_STR( On ) ) - PORT_START("DEBUG1") /* IN 9 : debug switches */ - PORT_CONFNAME( 0x3, 0x0, "Browse tiles" ) - PORT_CONFSETTING( 0x0, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x1, "2bpl" ) - PORT_CONFSETTING( 0x2, "4bpl" ) - PORT_CONFSETTING( 0x3, "8bpl" ) - PORT_CONFNAME( 0xc, 0x0, "Browse maps" ) - PORT_CONFSETTING( 0x0, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x4, "2bpl" ) - PORT_CONFSETTING( 0x8, "4bpl" ) - PORT_CONFSETTING( 0xc, "8bpl" ) + PORT_START("DEBUG2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Objects") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Main/Sub") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Back col") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Windows") PORT_CODE(KEYCODE_8_PAD) - PORT_START("DEBUG2") /* IN 10 : debug switches */ - PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle BG 1") PORT_PLAYER(2) - PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Toggle BG 2") PORT_PLAYER(2) - PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Toggle BG 3") PORT_PLAYER(2) - PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Toggle BG 4") PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle Objects") PORT_PLAYER(3) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Toggle Main/Sub") PORT_PLAYER(3) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Toggle Back col") PORT_PLAYER(3) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Toggle Windows") PORT_PLAYER(3) + PORT_START("DEBUG3") + PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Pal prev") PORT_CODE(KEYCODE_B) + PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Pal next") PORT_CODE(KEYCODE_N) + PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Transparency") PORT_CODE(KEYCODE_9_PAD) - PORT_START("DEBUG3") /* IN 11 : debug input */ - PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Pal prev") - PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Pal next") - PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle Transparency") PORT_PLAYER(4) + PORT_START("DEBUG4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 0 draw") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 1 draw") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 2 draw") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 3 draw") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 4 draw") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 5 draw") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 6 draw") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 7 draw") #endif INPUT_PORTS_END diff --git a/src/mame/video/snes.c b/src/mame/video/snes.c index 9822a85507a..c185941d0e9 100644 --- a/src/mame/video/snes.c +++ b/src/mame/video/snes.c @@ -90,6 +90,8 @@ struct DEBUGOPTS UINT8 draw_subscreen; UINT8 windows_disabled; UINT8 transparency_disabled; + UINT8 sprite_reversed; + UINT8 select_oam; }; static struct DEBUGOPTS debug_options; /* red green blue purple yellow cyan grey white */ @@ -1102,8 +1104,9 @@ static void snes_oam_list_build( void ) static UINT8 oam_itemlist[32]; struct TILELIST { - UINT16 x, priority, pal, tileaddr; - int hflip; + INT16 x; + UINT16 priority, pal, tileaddr; + int hflip; }; struct TILELIST oam_tilelist[34]; @@ -1265,11 +1268,27 @@ static void snes_update_objects( UINT8 priority_tbl ) /* finally draw the tiles from the tilelist */ for (i = 0; i < 34; i++) { - if (oam_tilelist[i].tileaddr == 0xffff) + int tile = i; +#ifdef SNES_LAYER_DEBUG + if (debug_options.sprite_reversed) + tile = 33 - i; +#endif /* SNES_LAYER_DEBUG */ + + if (oam_tilelist[tile].tileaddr == 0xffff) continue; - priority = table_obj_priority[priority_tbl][oam_tilelist[i].priority]; - snes_draw_tile_object(charaddr + oam_tilelist[i].tileaddr, oam_tilelist[i].x, priority, oam_tilelist[i].hflip, oam_tilelist[i].pal); + priority = table_obj_priority[priority_tbl][oam_tilelist[tile].priority]; + +#ifdef SNES_LAYER_DEBUG + if (debug_options.select_oam) + { + int oam_draw = debug_options.select_oam - 1; + if (oam_draw != oam_tilelist[tile].priority) + priority = 0; + } +#endif /* SNES_LAYER_DEBUG */ + + snes_draw_tile_object(charaddr + oam_tilelist[tile].tileaddr, oam_tilelist[tile].x, priority, oam_tilelist[tile].hflip, oam_tilelist[tile].pal); } } @@ -1675,7 +1694,11 @@ static UINT8 snes_dbg_video( running_machine *machine, bitmap_t *bitmap, UINT16 if (!debug_options.input_count--) { - UINT8 toggles = input_port_read_safe(machine, "DEBUG2", 0); + UINT8 toggles = input_port_read_safe(machine, "DEBUG1", 0); + debug_options.sprite_reversed = BIT(toggles, 7); + debug_options.select_oam = (toggles & 0x70) >> 4; + + toggles = input_port_read_safe(machine, "DEBUG2", 0); if (BIT(toggles, 0)) debug_options.bg_disabled[0] = !debug_options.bg_disabled[0]; if (BIT(toggles, 1))