Previous 15994 Revisions Next

r5445 Sunday 16th August, 2009 at 13:48:30 UTC by Angelo Salese
[SNES]: Made dynamic H resolutions to be called only at vblank start and and fixed gfx mode switching 1/5 and 5/1
[src/mame/video]snes.c

src/mame/video/snes.c
r5444r5445
11511151   int x;
11521152   int fade;
11531153   struct SCANLINE *scanline;
1154   UINT8 halve_x;
11541155
11551156   profiler_mark(PROFILER_VIDEO);
11561157
r5444r5445
12151216      /* Phew! Draw the line to screen */
12161217      fade = (snes_ram[INIDISP] & 0xf) + 1;
12171218
1218      for (x = 0; x < SNES_SCR_WIDTH * snes_htmult; x++)
1219      /* resolution line gets halved if we are inside mode 5/6 and the end resolution is 256 */
1220      if(snes_htmult == 1 && (snes_ppu.mode == 5 || snes_ppu.mode == 6))
1221         halve_x = 2;
1222      else
1223         halve_x = 1;
1224
1225      for (x = 0; x < SNES_SCR_WIDTH * snes_htmult * halve_x; x++)
12191226      {
12201227         int r = ((scanline->buffer[x] & 0x1f) * fade) >> 4;
12211228         int g = (((scanline->buffer[x] & 0x3e0) >> 5) * fade) >> 4;
12221229         int b = (((scanline->buffer[x] & 0x7c00) >> 10) * fade) >> 4;
1223         *BITMAP_ADDR32(bitmap, curline, x) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
1230
1231         if(snes_htmult == 2 && snes_ppu.mode != 5 && snes_ppu.mode != 6)
1232         {
1233            *BITMAP_ADDR32(bitmap, curline, x*2+0) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
1234            *BITMAP_ADDR32(bitmap, curline, x*2+1) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
1235         }
1236         else if(snes_htmult == 1 && (snes_ppu.mode == 5 || snes_ppu.mode == 6))
1237         {
1238            *BITMAP_ADDR32(bitmap, curline, x/2+0) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
1239            *BITMAP_ADDR32(bitmap, curline, x/2+1) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
1240         }
1241         else
1242            *BITMAP_ADDR32(bitmap, curline, x) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
12241243      }
12251244   }
12261245

Previous 15994 Revisions Next


© 1998-2018 The MESS Team