diff options
author | Fabio Priuli <etabeta78@users.noreply.github.com> | 2010-03-21 11:23:58 +0000 |
---|---|---|
committer | Fabio Priuli <etabeta78@users.noreply.github.com> | 2010-03-21 11:23:58 +0000 |
commit | 48cff9ff48380b2675cb31aac89c6628f6576d4c (patch) | |
tree | 8bbacbb654630280f0a53d32bead73071b71a93a | |
parent | cefbc30eb8233b1baf9a18d5662db2a1182402e5 (diff) |
not worth mention: snes.c: a last bunch of video debug features
-rw-r--r-- | src/mame/drivers/nss.c | 34 | ||||
-rw-r--r-- | src/mame/drivers/snesb.c | 34 | ||||
-rw-r--r-- | src/mame/video/snes.c | 106 |
3 files changed, 121 insertions, 53 deletions
diff --git a/src/mame/drivers/nss.c b/src/mame/drivers/nss.c index 61d7d37d14e..016efb483ee 100644 --- a/src/mame/drivers/nss.c +++ b/src/mame/drivers/nss.c @@ -392,15 +392,22 @@ static INPUT_PORTS_START( snes ) #ifdef SNES_LAYER_DEBUG PORT_START("DEBUG1") - PORT_CONFNAME( 0x70, 0x00, "Select OAM" ) - PORT_CONFSETTING( 0x00, "All" ) - PORT_CONFSETTING( 0x10, "OAM0 only" ) - PORT_CONFSETTING( 0x20, "OAM1 only" ) - PORT_CONFSETTING( 0x30, "OAM2 only" ) - PORT_CONFSETTING( 0x40, "OAM3 only" ) - PORT_CONFNAME( 0x80, 0x00, "Draw sprite in reverse order" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x80, DEF_STR( On ) ) + PORT_CONFNAME( 0x03, 0x00, "Select BG1 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x01, "BG1B (lower) only" ) + PORT_CONFSETTING( 0x02, "BG1A (higher) only" ) + PORT_CONFNAME( 0x0c, 0x00, "Select BG2 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x04, "BG2B (lower) only" ) + PORT_CONFSETTING( 0x08, "BG2A (higher) only" ) + PORT_CONFNAME( 0x30, 0x00, "Select BG3 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x10, "BG3B (lower) only" ) + PORT_CONFSETTING( 0x20, "BG3A (higher) only" ) + PORT_CONFNAME( 0xc0, 0x00, "Select BG4 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x40, "BG4B (lower) only" ) + PORT_CONFSETTING( 0x80, "BG4A (higher) only" ) PORT_START("DEBUG2") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 1") PORT_CODE(KEYCODE_1_PAD) @@ -414,6 +421,15 @@ static INPUT_PORTS_START( snes ) PORT_START("DEBUG3") PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mosaic") PORT_CODE(KEYCODE_9_PAD) + PORT_CONFNAME( 0x70, 0x00, "Select OAM priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x10, "OAM0 only" ) + PORT_CONFSETTING( 0x20, "OAM1 only" ) + PORT_CONFSETTING( 0x30, "OAM2 only" ) + PORT_CONFSETTING( 0x40, "OAM3 only" ) + PORT_CONFNAME( 0x80, 0x00, "Draw sprite in reverse order" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x80, DEF_STR( On ) ) PORT_START("DEBUG4") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 0 draw") diff --git a/src/mame/drivers/snesb.c b/src/mame/drivers/snesb.c index 5820e749034..bddac2c9430 100644 --- a/src/mame/drivers/snesb.c +++ b/src/mame/drivers/snesb.c @@ -333,15 +333,22 @@ static INPUT_PORTS_START( snes_common ) #ifdef SNES_LAYER_DEBUG PORT_START("DEBUG1") - PORT_CONFNAME( 0x70, 0x00, "Select OAM" ) - PORT_CONFSETTING( 0x00, "All" ) - PORT_CONFSETTING( 0x10, "OAM0 only" ) - PORT_CONFSETTING( 0x20, "OAM1 only" ) - PORT_CONFSETTING( 0x30, "OAM2 only" ) - PORT_CONFSETTING( 0x40, "OAM3 only" ) - PORT_CONFNAME( 0x80, 0x00, "Draw sprite in reverse order" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x80, DEF_STR( On ) ) + PORT_CONFNAME( 0x03, 0x00, "Select BG1 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x01, "BG1B (lower) only" ) + PORT_CONFSETTING( 0x02, "BG1A (higher) only" ) + PORT_CONFNAME( 0x0c, 0x00, "Select BG2 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x04, "BG2B (lower) only" ) + PORT_CONFSETTING( 0x08, "BG2A (higher) only" ) + PORT_CONFNAME( 0x30, 0x00, "Select BG3 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x10, "BG3B (lower) only" ) + PORT_CONFSETTING( 0x20, "BG3A (higher) only" ) + PORT_CONFNAME( 0xc0, 0x00, "Select BG4 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x40, "BG4B (lower) only" ) + PORT_CONFSETTING( 0x80, "BG4A (higher) only" ) PORT_START("DEBUG2") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 1") PORT_CODE(KEYCODE_1_PAD) @@ -355,6 +362,15 @@ static INPUT_PORTS_START( snes_common ) PORT_START("DEBUG3") PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mosaic") PORT_CODE(KEYCODE_9_PAD) + PORT_CONFNAME( 0x70, 0x00, "Select OAM priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x10, "OAM0 only" ) + PORT_CONFSETTING( 0x20, "OAM1 only" ) + PORT_CONFSETTING( 0x30, "OAM2 only" ) + PORT_CONFSETTING( 0x40, "OAM3 only" ) + PORT_CONFNAME( 0x80, 0x00, "Draw sprite in reverse order" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x80, DEF_STR( On ) ) PORT_START("DEBUG4") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 0 draw") diff --git a/src/mame/video/snes.c b/src/mame/video/snes.c index e899d746b3a..6b9f9a3932e 100644 --- a/src/mame/video/snes.c +++ b/src/mame/video/snes.c @@ -85,14 +85,14 @@ struct DEBUGOPTS { UINT8 input_count; - UINT8 bg_disabled[6]; + UINT8 bg_disabled[5]; UINT8 mode_disabled[8]; UINT8 draw_subscreen; UINT8 windows_disabled; UINT8 mosaic_disabled; UINT8 colormath_disabled; UINT8 sprite_reversed; - UINT8 select_oam; + UINT8 select_pri[5]; }; static struct DEBUGOPTS debug_options; /* red green blue purple yellow cyan grey white */ @@ -791,6 +791,20 @@ INLINE void snes_update_line( UINT16 curline, UINT8 layer, UINT8 priority_b, UIN pal += (layer << 5); } +#ifdef SNES_LAYER_DEBUG + /* if we want to draw only one of the priorities of this layer */ + if (((debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) || + ((debug_options.select_pri[layer] & 0x02) && (priority == priority_b))) + { + if (!hires && tile_size) + ii += 16; + else + ii += 8; + continue; + } +#endif /* SNES_LAYER_DEBUG */ + + /* figure out which line to draw */ yscroll = ypos & ((8 << tile_size) - 1); @@ -976,6 +990,13 @@ static void snes_update_line_mode7( UINT16 curline, UINT8 layer, UINT8 priority_ { priority = ((colour & 0x80) >> 7) ? priority_a : priority_b; colour &= 0x7f; + +#ifdef SNES_LAYER_DEBUG + /* if we want to draw only one of the priorities of this layer */ + if (((debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) || + ((debug_options.select_pri[layer] & 0x02) && (priority == priority_b))) + continue; +#endif /* SNES_LAYER_DEBUG */ } if (scanlines[SNES_MAINSCREEN].enable) @@ -1328,9 +1349,9 @@ static void snes_update_objects( UINT8 priority_oam0, UINT8 priority_oam1, UINT8 pri = priority[oam_tilelist[tile].priority]; #ifdef SNES_LAYER_DEBUG - if (debug_options.select_oam) + if (debug_options.select_pri[SNES_OAM]) { - int oam_draw = debug_options.select_oam - 1; + int oam_draw = debug_options.select_pri[SNES_OAM] - 1; if (oam_draw != oam_tilelist[tile].priority) continue; } @@ -1737,55 +1758,70 @@ static UINT8 snes_dbg_video( running_machine *machine, bitmap_t *bitmap, UINT16 /* Check if the user has enabled or disabled stuff */ if (curline == 1) { - //UINT16 y = 1; - static const char WINLOGIC[4] = { '|', '&', '^', '!' }; - if (!debug_options.input_count--) { + int i; UINT8 toggles = input_port_read_safe(machine, "DEBUG1", 0); - debug_options.sprite_reversed = BIT(toggles, 7); - debug_options.select_oam = (toggles & 0x70) >> 4; + debug_options.select_pri[SNES_BG1] = (toggles & 0x03); + debug_options.select_pri[SNES_BG2] = (toggles & 0x0c) >> 2; + debug_options.select_pri[SNES_BG3] = (toggles & 0x30) >> 4; + debug_options.select_pri[SNES_BG4] = (toggles & 0xc0) >> 6; 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)) - debug_options.bg_disabled[1] = !debug_options.bg_disabled[1]; - if (BIT(toggles, 2)) - debug_options.bg_disabled[2] = !debug_options.bg_disabled[2]; - if (BIT(toggles, 3)) - debug_options.bg_disabled[3] = !debug_options.bg_disabled[3]; + for (i = 0; i < 4; i++) + { + if (BIT(toggles, i)) + { + debug_options.bg_disabled[i] = !debug_options.bg_disabled[i]; + popmessage("Debug: %s BG%d.\n", debug_options.bg_disabled[i] ? "Disabled" : "Enabled", i + 1); + } + } if (BIT(toggles, 4)) - debug_options.bg_disabled[4] = !debug_options.bg_disabled[4]; + { + debug_options.bg_disabled[SNES_OAM] = !debug_options.bg_disabled[SNES_OAM]; + popmessage("Debug: %s OAM.\n", debug_options.bg_disabled[SNES_OAM] ? "Disabled" : "Enabled"); + } if (BIT(toggles, 5)) + { debug_options.draw_subscreen = !debug_options.draw_subscreen; + popmessage("Debug: Switched screens.\n"); + } if (BIT(toggles, 6)) + { debug_options.colormath_disabled = !debug_options.colormath_disabled; + popmessage("Debug: %s Color Math.\n", debug_options.colormath_disabled ? "Disabled" : "Enabled"); + } if (BIT(toggles, 7)) + { debug_options.windows_disabled = !debug_options.windows_disabled; + popmessage("Debug: %s Window Masks.\n", debug_options.windows_disabled ? "Disabled" : "Enabled"); + } + toggles = input_port_read_safe(machine, "DEBUG4", 0); - if (BIT(toggles, 0)) - debug_options.mode_disabled[0] = !debug_options.mode_disabled[0]; - if (BIT(toggles, 1)) - debug_options.mode_disabled[1] = !debug_options.mode_disabled[1]; - if (BIT(toggles, 2)) - debug_options.mode_disabled[2] = !debug_options.mode_disabled[2]; - if (BIT(toggles, 3)) - debug_options.mode_disabled[3] = !debug_options.mode_disabled[3]; - if (BIT(toggles, 4)) - debug_options.mode_disabled[4] = !debug_options.mode_disabled[4]; - if (BIT(toggles, 5)) - debug_options.mode_disabled[5] = !debug_options.mode_disabled[5]; - if (BIT(toggles, 6)) - debug_options.mode_disabled[6] = !debug_options.mode_disabled[6]; - if (BIT(toggles, 7)) - debug_options.mode_disabled[7] = !debug_options.mode_disabled[7]; + for (i = 0; i < 8; i++) + { + if (BIT(toggles, i)) + { + debug_options.mode_disabled[i] = !debug_options.mode_disabled[i]; + popmessage("Debug: %s Mode %d drawing.\n", debug_options.mode_disabled[i] ? "Disabled" : "Enabled", i); + } + } + toggles = input_port_read_safe(machine, "DEBUG3", 0); if (toggles & 0x4) + { debug_options.mosaic_disabled = !debug_options.mosaic_disabled; + popmessage("Debug: %s Mosaic.\n", debug_options.mosaic_disabled ? "Disabled" : "Enabled"); + } + debug_options.sprite_reversed = BIT(toggles, 7); + debug_options.select_pri[SNES_OAM] = (toggles & 0x70) >> 4; + debug_options.input_count = 5; } +#ifdef MAME_DEBUG + static const char WINLOGIC[4] = { '|', '&', '^', '!' }; + logerror("%s", debug_options.windows_disabled?" ":"W"); logerror("%s1 %s%s%s%s%s%c%s%s%d%s %d %4X %4X", debug_options.bg_disabled[0]?" ":"*", @@ -1872,9 +1908,9 @@ static UINT8 snes_dbg_video( running_machine *machine, bitmap_t *bitmap, UINT16 logerror("Mode7: A %5d B %5d", snes_ppu.mode7.matrix_a, snes_ppu.mode7.matrix_b ); logerror(" %s%s%s C %5d D %5d", (snes_ram[M7SEL] & 0xc0)?((snes_ram[M7SEL] & 0x40)?"0":"C"):"R", (snes_ram[M7SEL] & 0x1)?"H":" ", (snes_ram[M7SEL] & 0x2)?"V":" ", snes_ppu.mode7.matrix_c, snes_ppu.mode7.matrix_d ); logerror(" X %5d Y %5d", snes_ppu.mode7.origin_x, snes_ppu.mode7.origin_y ); +#endif } return 0; } - #endif /* SNES_LAYER_DEBUG */ |