Previous 199869 Revisions Next

r19500 Wednesday 12th December, 2012 at 19:44:34 UTC by Wilbert Pol
(MESS) sms.c: Improved support for '3-D' games.  [Enik Land]
[src/mess/drivers]sms.c
[src/mess/includes]sms.h
[src/mess/machine]sms.c

trunk/src/mess/machine/sms.c
r19499r19500
884884
885885WRITE8_MEMBER(sms_state::sms_sscope_w)
886886{
887   screen_device *screen = machine().first_screen();
888   
887889   m_sscope_state = data;
890
891   // There are occurrences when Sega Scope's state changes after VBLANK, or at
892   // active screen. Most cases are solid-color frames of scene transitions, but
893   // one exception is the first frame of Zaxxon 3-D's title screen. In that
894   // case, this method is enough for setting the intended state for the frame.
895   // No information found about a minimum time need for switch open/closed lens.
896   if (screen->vpos() < (screen->height() >> 1))
897      m_frame_sscope_state = m_sscope_state;
888898}
889899
890900
r19499r19500
20352045   m_lphaser_2_latch = 0;
20362046
20372047   m_sscope_state = 0;
2048   m_frame_sscope_state = 0;
20382049}
20392050
20402051READ8_MEMBER(sms_state::sms_store_cart_select_r)
r19499r19500
21772188   save_item(NAME(m_prevright_bitmap));
21782189}
21792190
2191
2192void sms_state::screen_vblank_sms1(screen_device &screen, bool state)
2193{
2194   // on falling edge
2195   if (!state)
2196   {
2197      // Most of the 3-D games usually set Sega Scope's state for next frame
2198      // soon after the active area of current frame was drawn, but before
2199      // it is displayed by the screen update function. That function needs to
2200      // check the state used at the time of frame drawing, to display it on
2201      // the correct side. So here, when the frame is about to be drawn, the
2202      // Sega Scope's state is stored, to be checked by that function.
2203      m_frame_sscope_state = m_sscope_state;
2204   }
2205}
2206
2207
21802208UINT32 sms_state::screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
21812209{
21822210   UINT8 sscope = 0;
r19499r19500
21882216      sscope = machine().root_device().ioport("SEGASCOPE")->read_safe(0x00);
21892217      if (!sscope)
21902218      {
2219         // without SegaScope, both LCDs for glasses go black
21912220         occluded_view = 1;
21922221      }
21932222      else if (&screen == m_left_lcd)
21942223      {
2195         // with SegaScope, sscope_state 0 = left screen OFF, right screen ON
2196         if (!(m_sscope_state & 0x01))
2224         // with SegaScope, state 0 = left screen OFF, right screen ON
2225         if (!(m_frame_sscope_state & 0x01))
21972226            occluded_view = 1;
21982227      }
21992228      else // it's right LCD
22002229      {
2201         // with SegaScope, sscope_state 1 = left screen ON, right screen OFF
2202         if (m_sscope_state & 0x01)
2230         // with SegaScope, state 1 = left screen ON, right screen OFF
2231         if (m_frame_sscope_state & 0x01)
22032232            occluded_view = 1;
22042233      }
22052234   }
r19499r19500
22732302
22742303UINT32 sms_state::screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
22752304{
2276   int width = screen.width();
2277   int height = screen.height();
22782305   int x, y;
2279
22802306   bitmap_rgb32 &vdp_bitmap = m_vdp->get_bitmap();
22812307
22822308   // HACK: fake LCD persistence effect
22832309   // (it would be better to generalize this in the core, to be used for all LCD systems)
2284   for (y = 0; y < height; y++)
2310   for (y = cliprect.min_y; y <= cliprect.max_y; y++)
22852311   {
22862312      UINT32 *linedst = &bitmap.pix32(y);
22872313      UINT32 *line0 = &vdp_bitmap.pix32(y);
22882314      UINT32 *line1 = &m_prev_bitmap.pix32(y);
2289      for (x = 0; x < width; x++)
2315      for (x = cliprect.min_x; x <= cliprect.max_x; x++)
22902316      {
22912317         UINT32 color0 = line0[x];
22922318         UINT32 color1 = line1[x];
trunk/src/mess/includes/sms.h
r19499r19500
104104
105105   /* Data needed for SegaScope (3D glasses) */
106106   UINT8 m_sscope_state;
107   UINT8 m_frame_sscope_state;
107108
108109   /* Cartridge slot info */
109110   UINT8 m_current_cartridge;
r19499r19500
184185   UINT32 screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
185186   UINT32 screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
186187   UINT32 screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
188   void screen_vblank_sms1(screen_device &screen, bool state);
187189   DECLARE_INPUT_CHANGED_MEMBER(lgun1_changed);
188190   DECLARE_INPUT_CHANGED_MEMBER(lgun2_changed);
189191   TIMER_CALLBACK_MEMBER(rapid_fire_callback);
trunk/src/mess/drivers/sms.c
r19499r19500
427427      SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224)
428428   MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
429429
430   MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1)
431
430432   MCFG_DEFAULT_LAYOUT(layout_sms1)
431433
432434   MCFG_PALETTE_LENGTH(SEGA315_5124_PALETTE_SIZE)
r19499r19500
539541      SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240)
540542   MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
541543
544   MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1)
545
546   MCFG_DEFAULT_LAYOUT(layout_sms1)
547
542548   MCFG_PALETTE_LENGTH(SEGA315_5124_PALETTE_SIZE)
543549   MCFG_PALETTE_INIT(sega315_5124)
544550
545   MCFG_DEFAULT_LAYOUT(layout_sms1)
546
547551   MCFG_VIDEO_START_OVERRIDE(sms_state,sms1)
548552
549553   MCFG_SEGA315_5124_ADD("sms_vdp", _315_5124_pal_intf)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team