mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
Not worth mentioning: some more snes minor refactorization.
I'm splitting these changes into several commits so that I can hopefully track down any regression more easily
This commit is contained in:
parent
6e2b703fb3
commit
3ab90739a3
@ -471,10 +471,6 @@ struct SNES_PPU_STRUCT /* once all the regs are saved in this structure, it woul
|
||||
{
|
||||
UINT16 horizontal;
|
||||
UINT16 vertical;
|
||||
UINT16 tile_horz;
|
||||
UINT8 shift_horz;
|
||||
UINT16 tile_vert;
|
||||
UINT16 shift_vert;
|
||||
} offset;
|
||||
} layer[6]; // this is for the BG1 - BG2 - BG3 - BG4 - OBJ - color layers
|
||||
|
||||
|
@ -423,11 +423,11 @@ INLINE void snes_update_line( UINT8 screen, UINT8 color_depth, UINT8 hires, UINT
|
||||
{
|
||||
UINT32 tmap, tile;
|
||||
UINT16 ii, vflip, hflip, pal;
|
||||
INT8 line, tile_line;
|
||||
INT8 tile_line;
|
||||
UINT8 priority;
|
||||
/* scrolling */
|
||||
UINT32 basevmap, charaddr;
|
||||
UINT16 vscroll, hscroll, vtilescroll;
|
||||
UINT16 vscroll, hscroll;
|
||||
// UINT16 offset_per_tile_valid;
|
||||
// UINT8 offset_per_tile_mode;
|
||||
UINT8 vshift, hshift, tile_size;
|
||||
@ -454,36 +454,34 @@ INLINE void snes_update_line( UINT8 screen, UINT8 color_depth, UINT8 hires, UINT
|
||||
|
||||
/* Find the size of the tiles (8x8 or 16x16) */
|
||||
tile_size = snes_ppu.layer[layer].tile_size;
|
||||
/* Find scroll info */
|
||||
vscroll = snes_ppu.layer[layer].offset.tile_vert;
|
||||
vshift = snes_ppu.layer[layer].offset.shift_vert;
|
||||
hscroll = snes_ppu.layer[layer].offset.tile_horz;
|
||||
hshift = snes_ppu.layer[layer].offset.shift_horz;
|
||||
|
||||
/* Find vertical scroll amount */
|
||||
vtilescroll = vscroll + (curline >> (3 + tile_size));
|
||||
/* Find scroll info */
|
||||
hscroll = (snes_ppu.layer[layer].offset.horizontal & 0x3ff) >> (3 + tile_size);
|
||||
hshift = snes_ppu.layer[layer].offset.horizontal & ((8 << tile_size) - 1);
|
||||
vscroll = ((snes_ppu.layer[layer].offset.vertical & 0x3ff) + curline) >> (3 + tile_size);
|
||||
vshift = ((snes_ppu.layer[layer].offset.vertical & 0x3ff) + curline) & ((8 << tile_size) - 1);
|
||||
|
||||
/* figure out which line to draw */
|
||||
line = (curline % (8 << tile_size)) + vshift;
|
||||
if (line > ((8 << tile_size) - 1)) /* scrolled into the next tile */
|
||||
if (vshift > ((8 << tile_size) - 1)) /* scrolled into the next tile */
|
||||
{
|
||||
vtilescroll++; /* pretend we scrolled by 1 tile line */
|
||||
line -= (8 << tile_size);
|
||||
vscroll++; /* pretend we scrolled by 1 tile line */
|
||||
vshift -= (8 << tile_size);
|
||||
}
|
||||
if (vtilescroll >= 128)
|
||||
vtilescroll -= 128;
|
||||
if (vscroll >= 128)
|
||||
vscroll -= 128;
|
||||
|
||||
/* Jump to base map address */
|
||||
tmap = snes_ppu.layer[layer].tilemap << 9;
|
||||
charaddr = snes_ppu.layer[layer].charmap << 13;
|
||||
|
||||
/* Offset vertically */
|
||||
tmap += table_vscroll[snes_ppu.layer[layer].tilemap_size & 3][(vtilescroll >> 5) & 3];
|
||||
tmap += (snes_ppu.layer[layer].tilemap_size & 2) ? ((vscroll & 0x20) << ((snes_ppu.layer[layer].tilemap_size & 1) ? 7 : 6)) : 0;
|
||||
/* Scroll vertically */
|
||||
tmap += (vtilescroll & 0x1f) << 6;
|
||||
tmap += (vscroll & 0x1f) << 6;
|
||||
/* Remember this position */
|
||||
basevmap = tmap;
|
||||
/* Offset horizontally */
|
||||
tmap += table_hscroll[snes_ppu.layer[layer].tilemap_size & 3][(hscroll >> 5) & 3];
|
||||
tmap += (snes_ppu.layer[layer].tilemap_size & 1) ? ((hscroll & 0x20) << 6) : 0;
|
||||
/* Scroll horizontally */
|
||||
tmap += (hscroll & 0x1f) << 1;
|
||||
|
||||
@ -543,12 +541,12 @@ INLINE void snes_update_line( UINT8 screen, UINT8 color_depth, UINT8 hires, UINT
|
||||
pal += (layer << 5);
|
||||
}
|
||||
|
||||
tile_line = line;
|
||||
tile_line = vshift;
|
||||
if (vflip)
|
||||
{
|
||||
if (tile_size)
|
||||
{
|
||||
if (line > 7)
|
||||
if (tile_line > 7)
|
||||
{
|
||||
tile_line -= 8;
|
||||
}
|
||||
@ -561,7 +559,7 @@ INLINE void snes_update_line( UINT8 screen, UINT8 color_depth, UINT8 hires, UINT
|
||||
}
|
||||
else
|
||||
{
|
||||
if (line > 7)
|
||||
if (tile_line > 7)
|
||||
{
|
||||
tile += 32 / tile_divider;
|
||||
tile_line -= 8;
|
||||
@ -572,26 +570,7 @@ INLINE void snes_update_line( UINT8 screen, UINT8 color_depth, UINT8 hires, UINT
|
||||
/* below, only color_planes depends on color_depth */
|
||||
if (tile_size)
|
||||
{
|
||||
#if 0
|
||||
/* Bishoujo Janshi SuchiiPai and Desert Fighter sets this in hires, no noticeable difference apart that x must be doubled somehow... */
|
||||
if (hires) /* Hi-Res: 2bpp & 4bpp */
|
||||
{
|
||||
if (hflip)
|
||||
{
|
||||
snes_draw_tile_x2(screen, color_planes, layer, charaddr + (tile * 8 * color_planes) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1) + 16, priority, hflip, pal);
|
||||
snes_draw_tile_x2(screen, color_planes, layer, charaddr + ((tile + 2) * 8 * color_planes) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal);
|
||||
}
|
||||
else
|
||||
{
|
||||
snes_draw_tile_x2(screen, color_planes, layer, charaddr + (tile * 8 * color_planes) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1), priority, hflip, pal);
|
||||
snes_draw_tile_x2(screen, color_planes, layer, charaddr + ((tile + 2) * 8 * color_planes) + tile_line, ((ii >> 1) * (8 << (tile_size + 1))) - (hshift << 1) + 16, priority, hflip, pal);
|
||||
}
|
||||
}
|
||||
else /* No Hi-Res: 2bpp, 4bpp & 8bpp */
|
||||
#endif
|
||||
{
|
||||
snes_draw_tile_x2(screen, color_planes, layer, charaddr + (tile * 8 * color_planes) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip, pal, direct_colors);
|
||||
}
|
||||
snes_draw_tile_x2(screen, color_planes, layer, charaddr + (tile * 8 * color_planes) + tile_line, ((ii >> 1) * (8 << tile_size)) - hshift, priority, hflip, pal, direct_colors);
|
||||
}
|
||||
else /* tile_size = 0 */
|
||||
{
|
||||
@ -1099,23 +1078,7 @@ static void snes_update_offsets(void)
|
||||
int ii;
|
||||
for (ii = 0; ii < 4; ii++)
|
||||
{
|
||||
snes_ppu.layer[ii].offset.tile_horz = (snes_ppu.layer[ii].offset.horizontal & 0x3ff) >> (3 + snes_ppu.layer[ii].tile_size);
|
||||
snes_ppu.layer[ii].offset.shift_horz = snes_ppu.layer[ii].offset.horizontal & ((8 << snes_ppu.layer[ii].tile_size) - 1);
|
||||
snes_ppu.layer[ii].offset.tile_vert = (snes_ppu.layer[ii].offset.vertical & 0x3ff) >> (3 + snes_ppu.layer[ii].tile_size);
|
||||
snes_ppu.layer[ii].offset.shift_vert = snes_ppu.layer[ii].offset.vertical & ((8 << snes_ppu.layer[ii].tile_size) - 1);
|
||||
}
|
||||
#if 0
|
||||
popmessage("%04x %04x|%04x %04x|%04x %04x|%04x %04x",
|
||||
snes_ppu.layer[SNES_BG1].offset.tile_horz,
|
||||
snes_ppu.layer[SNES_BG1].offset.tile_vert,
|
||||
snes_ppu.layer[SNES_BG2].offset.tile_horz,
|
||||
snes_ppu.layer[SNES_BG2].offset.tile_vert,
|
||||
snes_ppu.layer[SNES_BG3].offset.tile_horz,
|
||||
snes_ppu.layer[SNES_BG3].offset.tile_vert,
|
||||
snes_ppu.layer[SNES_BG4].offset.tile_horz,
|
||||
snes_ppu.layer[SNES_BG4].offset.tile_vert
|
||||
);
|
||||
#endif
|
||||
snes_ppu.update_offsets = 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user