From 14aeb37220b33ddb8c46dacbeacad7ecc7b301fb Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Thu, 20 Aug 2009 19:53:05 +0000 Subject: [PATCH] [SNES]: added OBJ interlace support --- src/mame/includes/snes.h | 3 ++- src/mame/machine/snes.c | 2 ++ src/mame/video/snes.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h index bbbccede8e0..062d52da8a1 100644 --- a/src/mame/includes/snes.h +++ b/src/mame/includes/snes.h @@ -493,7 +493,7 @@ struct SNES_PPU_STRUCT /* once all the regs are saved in this structure, it woul UINT8 bg3_priority_bit; UINT8 direct_color; UINT8 ppu_last_scroll; /* as per Anomie's doc and Theme Park, all scroll regs shares (but mode 7 ones) the same - 'previous' scroll value */ + 'previous' scroll value */ UINT8 mode7_last_scroll; /* as per Anomie's doc mode 7 scroll regs use a different value, shared with mode 7 matrix! */ UINT8 main_bg_enabled[5]; // these would probably better fit the layer struct, but it would make worse the code in snes_update_mode_X() @@ -508,6 +508,7 @@ struct SNES_PPU_STRUCT /* once all the regs are saved in this structure, it woul UINT8 update_offsets; UINT8 mode; UINT8 interlace; //doubles the visible resolution + UINT8 obj_interlace; }; struct snes_cart_info diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index a5c3074699a..a4611987e2d 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -1162,6 +1162,7 @@ WRITE8_HANDLER( snes_w_io ) case SETINI: /* Screen mode/video select */ /* FIXME: We only support line count and interlace here */ snes_ppu.interlace = (data & 1) ? 2 : 1; + snes_ppu.obj_interlace = (data & 2) ? 2 : 1; snes_ppu.beam.last_visible_line = (data & 0x4) ? 240 : 225; snes_dynamic_res_change(space->machine); #ifdef SNES_DBG_REG_W @@ -1892,6 +1893,7 @@ MACHINE_RESET( snes ) snes_htmult = 1; snes_ppu.interlace = 1; + snes_ppu.obj_interlace = 1; } diff --git a/src/mame/video/snes.c b/src/mame/video/snes.c index c1e416d3c87..e36804b6ead 100644 --- a/src/mame/video/snes.c +++ b/src/mame/video/snes.c @@ -768,6 +768,7 @@ static void snes_update_objects( UINT8 screen, UINT8 priority_tbl, UINT16 curlin widemode = 1; curline/=snes_ppu.interlace; + curline*=snes_ppu.obj_interlace; oam = 0x1ff; oam_extra = oam + 0x20; @@ -789,6 +790,7 @@ static void snes_update_objects( UINT8 screen, UINT8 priority_tbl, UINT16 curlin extra <<= 1; x |= ((extra & 0x80) << 1); extra <<= 1; + y*=snes_ppu.obj_interlace; /* Adjust if past maximum position */ if( y >= snes_ppu.beam.last_visible_line*snes_ppu.interlace )