Previous 15994 Revisions Next

r7541 Tuesday 9th March, 2010 at 15:18:20 UTC by Fabio Priuli
[SNES] minor renaming of some snes_ppu struct elements
[src/mame/includes]snes.h
[src/mame/machine]snes.c
[src/mame/video]snes.c

src/mame/machine/snes.c
r7540r7541
11331133         }
11341134         break;
11351135      case TM:      /* Main screen designation */
1136         snes_ppu.main_bg_enabled[0] = BIT(data, 0);
1137         snes_ppu.main_bg_enabled[1] = BIT(data, 1);
1138         snes_ppu.main_bg_enabled[2] = BIT(data, 2);
1139         snes_ppu.main_bg_enabled[3] = BIT(data, 3);
1140         snes_ppu.main_bg_enabled[4] = BIT(data, 4);
1136         snes_ppu.layer[SNES_BG1].main_bg_enabled = BIT(data, 0);
1137         snes_ppu.layer[SNES_BG2].main_bg_enabled = BIT(data, 1);
1138         snes_ppu.layer[SNES_BG3].main_bg_enabled = BIT(data, 2);
1139         snes_ppu.layer[SNES_BG4].main_bg_enabled = BIT(data, 3);
1140         snes_ppu.layer[SNES_OAM].main_bg_enabled = BIT(data, 4);
11411141         break;
11421142      case TS:      /* Subscreen designation */
1143         snes_ppu.sub_bg_enabled[0] = BIT(data, 0);
1144         snes_ppu.sub_bg_enabled[1] = BIT(data, 1);
1145         snes_ppu.sub_bg_enabled[2] = BIT(data, 2);
1146         snes_ppu.sub_bg_enabled[3] = BIT(data, 3);
1147         snes_ppu.sub_bg_enabled[4] = BIT(data, 4);
1143         snes_ppu.layer[SNES_BG1].sub_bg_enabled = BIT(data, 0);
1144         snes_ppu.layer[SNES_BG2].sub_bg_enabled = BIT(data, 1);
1145         snes_ppu.layer[SNES_BG3].sub_bg_enabled = BIT(data, 2);
1146         snes_ppu.layer[SNES_BG4].sub_bg_enabled = BIT(data, 3);
1147         snes_ppu.layer[SNES_OAM].sub_bg_enabled = BIT(data, 4);
11481148         break;
11491149      case TMW:      /* Window mask for main screen designation */
11501150         snes_ppu.layer[SNES_BG1].main_window_enabled = BIT(data, 0);
r7540r7541
11621162         break;
11631163      case CGWSEL:   /* Initial settings for Fixed colour addition or screen addition */
11641164         /* FIXME: We don't support direct select for modes 3 & 4 or subscreen window stuff */
1165         snes_ppu.main_color_mask = (data >> 6) & 0x03;
1166         snes_ppu.sub_color_mask = (data >> 4) & 0x03;
1165         snes_ppu.clip_to_black = (data >> 6) & 0x03;
1166         snes_ppu.prevent_color_math = (data >> 4) & 0x03;
11671167         snes_ppu.sub_add_mode = BIT(data, 1);
11681168         snes_ppu.direct_color = BIT(data, 0);
11691169#ifdef SNES_DBG_REG_W
src/mame/includes/snes.h
r7540r7541
510510
511511      UINT8 tile_size;
512512      UINT8 mosaic_enabled;   // actually used only for layers 0->3!
513
513514      UINT8 main_window_enabled;
514515      UINT8 sub_window_enabled;
516      UINT8 main_bg_enabled;
517      UINT8 sub_bg_enabled;
515518
516519      UINT16 hoffs;
517520      UINT16 voffs;
r7540r7541
568571   } mode7;
569572
570573   UINT8 mosaic_size;
571   UINT8 main_color_mask;
572   UINT8 sub_color_mask;
574   UINT8 clip_to_black;
575   UINT8 prevent_color_math;
573576   UINT8 sub_add_mode;
574577   UINT8 bg3_priority_bit;
575578   UINT8 direct_color;
r7540r7541
577580                                    'previous' scroll value */
578581   UINT8 mode7_last_scroll;   /* as per Anomie's doc mode 7 scroll regs use a different value, shared with mode 7 matrix! */
579582
580   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()
581   UINT8 sub_bg_enabled[5];
582583   UINT8 ppu1_open_bus, ppu2_open_bus;
583584   UINT8 ppu1_version, ppu2_version;
584585   UINT8 window1_left, window1_right, window2_left, window2_right;
src/mame/video/snes.c
r7540r7541
7676
7777#define SNES_MAINSCREEN    0
7878#define SNES_SUBSCREEN     1
79#define SNES_CLIP_ALL      0
79#define SNES_CLIP_NEVER    0
8080#define SNES_CLIP_IN       1
8181#define SNES_CLIP_OUT      2
82#define SNES_CLIP_ALL2     3
82#define SNES_CLIP_ALWAYS   3
8383
8484#ifdef SNES_LAYER_DEBUG
8585struct DEBUGOPTS
r7540r7541
136136 * between the main and sub screens.
137137 *****************************************/
138138
139INLINE void snes_draw_blend( UINT16 offset, UINT16 *colour, UINT8 clip, UINT8 black_pen_clip, int switch_screens )
139INLINE void snes_draw_blend( UINT16 offset, UINT16 *colour, UINT8 prevent_color_math, UINT8 black_pen_clip, int switch_screens )
140140{
141141   /* when color math is applied to subscreen pixels, the blending depends on the blending used by the previous mainscreen
142142   pixel, except for subscreen pixel 0 which has no previous mainscreen pixel, see comments in snes_refresh_scanline */
143143   if (switch_screens && offset > 0)
144144      offset -= 1;
145145
146   if ((black_pen_clip == SNES_CLIP_ALL2) ||
146   if ((black_pen_clip == SNES_CLIP_ALWAYS) ||
147147      (black_pen_clip == SNES_CLIP_IN && snes_ppu.clipmasks[SNES_COLOR][offset]) ||
148148      (black_pen_clip == SNES_CLIP_OUT && !snes_ppu.clipmasks[SNES_COLOR][offset]))
149149      *colour = 0; //clip to black before color math
150150
151   if (clip == SNES_CLIP_ALL2) // blending mode 3 == always OFF
151   if (prevent_color_math == SNES_CLIP_ALWAYS) // blending mode 3 == always OFF
152152      return;
153153
154154#ifdef SNES_LAYER_DEBUG
155155   if (!debug_options.transparency_disabled)
156156#endif /* SNES_LAYER_DEBUG */
157   if ((clip == SNES_CLIP_ALL) ||
158      (clip == SNES_CLIP_IN  && !snes_ppu.clipmasks[SNES_COLOR][offset]) ||
159      (clip == SNES_CLIP_OUT && snes_ppu.clipmasks[SNES_COLOR][offset]))
157   if ((prevent_color_math == SNES_CLIP_NEVER) ||
158      (prevent_color_math == SNES_CLIP_IN  && !snes_ppu.clipmasks[SNES_COLOR][offset]) ||
159      (prevent_color_math == SNES_CLIP_OUT && snes_ppu.clipmasks[SNES_COLOR][offset]))
160160   {
161161      UINT16 r, g, b;
162162      struct SCANLINE *subscreen;
r7540r7541
655655      return;
656656#endif /* SNES_LAYER_DEBUG */
657657
658   scanlines[SNES_MAINSCREEN].enable = snes_ppu.main_bg_enabled[layer];
659   scanlines[SNES_SUBSCREEN].enable = snes_ppu.sub_bg_enabled[layer];
658   scanlines[SNES_MAINSCREEN].enable = snes_ppu.layer[layer].main_bg_enabled;
659   scanlines[SNES_SUBSCREEN].enable = snes_ppu.layer[layer].sub_bg_enabled;
660660   scanlines[SNES_MAINSCREEN].clip = snes_ppu.layer[layer].main_window_enabled;
661661   scanlines[SNES_SUBSCREEN].clip = snes_ppu.layer[layer].sub_window_enabled;
662662
r7540r7541
828828      return;
829829#endif /* SNES_LAYER_DEBUG */
830830
831   scanlines[SNES_MAINSCREEN].enable = snes_ppu.main_bg_enabled[layer];
832   scanlines[SNES_SUBSCREEN].enable = snes_ppu.sub_bg_enabled[layer];
831   scanlines[SNES_MAINSCREEN].enable = snes_ppu.layer[layer].main_bg_enabled;
832   scanlines[SNES_SUBSCREEN].enable = snes_ppu.layer[layer].sub_bg_enabled;
833833   scanlines[SNES_MAINSCREEN].clip = snes_ppu.layer[layer].main_window_enabled;
834834   scanlines[SNES_SUBSCREEN].clip = snes_ppu.layer[layer].sub_window_enabled;
835835
r7540r7541
11201120      return;
11211121#endif /* SNES_LAYER_DEBUG */
11221122
1123   scanlines[SNES_MAINSCREEN].enable = snes_ppu.main_bg_enabled[SNES_OAM];
1124   scanlines[SNES_SUBSCREEN].enable = snes_ppu.sub_bg_enabled[SNES_OAM];
1123   scanlines[SNES_MAINSCREEN].enable = snes_ppu.layer[SNES_OAM].main_bg_enabled;
1124   scanlines[SNES_SUBSCREEN].enable = snes_ppu.layer[SNES_OAM].sub_bg_enabled;
11251125   scanlines[SNES_MAINSCREEN].clip = snes_ppu.layer[SNES_OAM].main_window_enabled;
11261126   scanlines[SNES_SUBSCREEN].clip = snes_ppu.layer[SNES_OAM].sub_window_enabled;
11271127
r7540r7541
15311531
15321532         /* perform color math if the layer wants it (except if it's an object > 192) */
15331533         if (!scanline1->blend_exception[x] && snes_ppu.layer[scanline1->layer[x]].color_math)
1534            snes_draw_blend(x, &c, snes_ppu.sub_color_mask, snes_ppu.main_color_mask, 0);
1534            snes_draw_blend(x, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 0);
15351535
15361536         r = ((c & 0x1f) * fade) >> 4;
15371537         g = (((c & 0x3e0) >> 5) * fade) >> 4;
r7540r7541
15521552            the same color math as the *next* mainscreen pixel (i.e. mainscreen pixel 0) */
15531553
15541554            if (x == 0 && !scanline1->blend_exception[0] && snes_ppu.layer[scanline1->layer[0]].color_math)
1555               snes_draw_blend(0, &c, snes_ppu.sub_color_mask, snes_ppu.main_color_mask, 1);
1555               snes_draw_blend(0, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 1);
15561556            else if (x > 0  && !scanline1->blend_exception[x - 1] && snes_ppu.layer[scanline1->layer[x - 1]].color_math)
1557               snes_draw_blend(x, &c, snes_ppu.sub_color_mask, snes_ppu.main_color_mask, 1);
1557               snes_draw_blend(x, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 1);
15581558
15591559
15601560            r = ((c & 0x1f) * fade) >> 4;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team