Previous 15994 Revisions Next

r5282 Monday 20th July, 2009 at 06:50:24 UTC by Fabio Priuli
SNES graphics improvements, see messnew.txt [Angelo Salese]

These will be in MAME 0.133 anyway, but it's better to proper credit the changes in messnew.txt as well
[docs]messnew.txt
[src/mame/video]snes.c

src/mame/video/snes.c
r5281r5282
162162 *****************************************/
163163INLINE void snes_draw_blend(UINT16 offset, UINT16 *colour, UINT8 mode, UINT8 clip )
164164{
165   if( clip == SNES_CLIP_ALL2) // blending mode 3 == always OFF
166      return;
167
165168#ifdef SNES_DBG_video
166169   if( !debug_options.transparency_disabled )
167170#endif /* SNES_DBG_video */
168   if( (clip == SNES_CLIP_ALL || clip == SNES_CLIP_ALL2) ||
171   if( (clip == SNES_CLIP_ALL) ||
169172      (clip == SNES_CLIP_IN  && snes_ppu.clipmasks[5][offset]) ||
170173      (clip == SNES_CLIP_OUT && !snes_ppu.clipmasks[5][offset]) )
171174   {
r5281r5282
259262
260263   for( ii = x; ii < (x + 8); ii++ )
261264   {
262      register UINT8 colour;
265      UINT8 colour;
263266      if( flip )
264267      {
265268         colour = (plane[0] & mask ? 1 : 0) | (plane[1] & mask ? 2 : 0);
r5281r5282
286289            c = snes_cgram[pal + colour];
287290            if( screen == MAINSCREEN )   /* Only blend main screens */
288291               snes_draw_blend(ii, &c, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4 );
289            scanlines[screen].buffer[ii] = c;
290            scanlines[screen].zbuf[ii] = priority;
292            if( snes_ram[MOSAIC] & (1 << layer) ) // handle horizontal mosaic
293            {
294               int x_mos;
295
296               //TODO: 512 modes has the h values doubled.
297               for(x_mos = 0;x_mos < (((snes_ram[MOSAIC] & 0xf0)>>4)+1) ; x_mos++)
298               {
299                  scanlines[screen].buffer[ii + x_mos] = c;
300                  scanlines[screen].zbuf[ii + x_mos] = priority;
301               }
302               ii += x_mos - 1;
303            }
304            else
305            {
306               scanlines[screen].buffer[ii] = c;
307               scanlines[screen].zbuf[ii] = priority;
308            }
291309         }
292310      }
293311   }
r5281r5282
335353
336354   for( ii = x; ii < (x + 8); ii++ )
337355   {
338      register UINT8 colour;
356      UINT8 colour;
339357      if( flip )
340358      {
341359         colour = (plane[0] & mask ? 1 : 0) | (plane[1] & mask ? 2 : 0) |
r5281r5282
364382            c = snes_cgram[pal + colour];
365383            if( screen == MAINSCREEN )   /* Only blend main screens */
366384               snes_draw_blend(ii, &c, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4 );
367            scanlines[screen].buffer[ii] = c;
368            scanlines[screen].zbuf[ii] = priority;
385            if( snes_ram[MOSAIC] & (1 << layer) ) // handle horizontal mosaic
386            {
387               int x_mos;
388
389               //TODO: 512 modes has the h values doubled.
390               for(x_mos = 0;x_mos < (((snes_ram[MOSAIC] & 0xf0)>>4)+1) ; x_mos++)
391               {
392                  scanlines[screen].buffer[ii + x_mos] = c;
393                  scanlines[screen].zbuf[ii + x_mos] = priority;
394               }
395               ii += x_mos - 1;
396            }
397            else
398            {
399               scanlines[screen].buffer[ii] = c;
400               scanlines[screen].zbuf[ii] = priority;
401            }
369402         }
370403      }
371404   }
r5281r5282
417450
418451   for( ii = x; ii < (x + 8); ii++ )
419452   {
420      register UINT8 colour;
453      UINT8 colour;
421454      if( flip )
422455      {
423456         colour = (plane[0] & mask ? 1 : 0)  | (plane[1] & mask ? 2 : 0)  |
r5281r5282
450483            c = snes_cgram[colour];
451484            if( screen == MAINSCREEN )   /* Only blend main screens */
452485               snes_draw_blend(ii, &c, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4 );
453            scanlines[screen].buffer[ii] = c;
454            scanlines[screen].zbuf[ii] = priority;
486            if( snes_ram[MOSAIC] & (1 << layer) ) // handle horizontal mosaic
487            {
488               int x_mos;
489
490               //TODO: 512 modes has the h values doubled.
491               for(x_mos = 0;x_mos < (((snes_ram[MOSAIC] & 0xf0)>>4)+1) ; x_mos++)
492               {
493                  scanlines[screen].buffer[ii + x_mos] = c;
494                  scanlines[screen].zbuf[ii + x_mos] = priority;
495               }
496               ii += x_mos - 1;
497            }
498            else
499            {
500               scanlines[screen].buffer[ii] = c;
501               scanlines[screen].zbuf[ii] = priority;
502            }
455503         }
456504      }
457505   }
r5281r5282
501549
502550   for( ii = x; ii < (x + 8); ii++ )
503551   {
504      register UINT8 colour;
552      UINT8 colour;
505553      if( flip )
506554      {
507555         colour = (plane[0] & mask ? 1 : 0) | (plane[1] & mask ? 2 : 0) |
r5281r5282
565613   x <<= 1;
566614   for( ii = x; ii < (x + 16); ii += 2 )
567615   {
568      register UINT8 colour;
616      UINT8 colour;
569617      if( flip )
570618      {
571619         colour = (plane[0] & mask ? 1 : 0) | (plane[1] & mask ? 2 : 0) |
r5281r5282
657705   /* Jump to base map address */
658706   tmap = snes_ppu.layer[layer].map;
659707   /* Offset vertically */
660   tmap += table_vscroll[snes_ppu.layer[layer].map_size][vtilescroll >> 5];
708   tmap += table_vscroll[snes_ppu.layer[layer].map_size & 3][(vtilescroll >> 5) & 3];
661709   /* Scroll vertically */
662710   tmap += (vtilescroll & 0x1f) << 6;
663711   /* Remember this position */
r5281r5282
682730      priority = table_bgd_pty[snes_ppu.mode > 1][layer][(snes_vram[tmap + ii + 1] & 0x20) >> 5];
683731      pal = (snes_vram[tmap + ii + 1] & 0x1c);      /* 8 palettes of 4 colours */
684732      tile = (snes_vram[tmap + ii + 1] & 0x3) << 8;
685      tile |= snes_vram[tmap + ii];
733      tile |= (snes_vram[tmap + ii] & 0xff);
686734
687735      /* Mode 0 palettes are layer specific */
688736      if( snes_ppu.mode == 0 )
r5281r5282
701749            }
702750            else
703751            {
704               tile += 32;
752               tile += 16;
705753            }
706754         }
707755         tile_line = -tile_line + 7;
r5281r5282
710758      {
711759         if( line > 7 )
712760         {
713            tile += 32;
761            tile += 16;
714762            tile_line -= 8;
715763         }
716764      }
r5281r5282
829877            }
830878            else
831879            {
832               tile += 32;
880               tile += 16;
833881            }
834882         }
835883         tile_line = -tile_line + 7;
r5281r5282
838886      {
839887         if( line > 7 )
840888         {
841            tile += 32;
889            tile += 16;
842890            tile_line -= 8;
843891         }
844892      }
r5281r5282
12281276   INT16 ma, mb, mc, md;
12291277   INT16 xc, yc, tx, ty, sx, sy, hs, vs, xpos, xdir;
12301278   UINT8 priority = 0;
1231   register UINT8 colour = 0;
1279   UINT8 colour = 0;
12321280
12331281#ifdef SNES_DBG_video
12341282   if( debug_options.bg_disabled[0] )
docs/messnew.txt
r5281r5282
9090- [SEGA CD] Rearranged sets and added new and better dumps. [Justin Kerk, TmEE,
9191  segaloco]
9292
93- [SNES] Fixed a blending flag bug (see Micro Machines bg colors), added basic
94  Horizontal Mosaic effect, fixed 16x16 tiles in 2bpp mode (see e.g. Super
95  Adventure Island, but also many others). [Angelo Salese]
96
9397- [SPECTRUM] Added logging support for Text/Message/Archive/Hardware/Custom
9498  Blocks in TZX files. Info are not (and won't be) used directly by the
9599  emulator, but can be of use to improve bug reports. Also, updated TZX

Previous 15994 Revisions Next


© 1998-2018 The MESS Team