trunk/src/mess/machine/sms.c
| r19499 | r19500 | |
| 884 | 884 | |
| 885 | 885 | WRITE8_MEMBER(sms_state::sms_sscope_w) |
| 886 | 886 | { |
| 887 | screen_device *screen = machine().first_screen(); |
| 888 | |
| 887 | 889 | 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; |
| 888 | 898 | } |
| 889 | 899 | |
| 890 | 900 | |
| r19499 | r19500 | |
| 2035 | 2045 | m_lphaser_2_latch = 0; |
| 2036 | 2046 | |
| 2037 | 2047 | m_sscope_state = 0; |
| 2048 | m_frame_sscope_state = 0; |
| 2038 | 2049 | } |
| 2039 | 2050 | |
| 2040 | 2051 | READ8_MEMBER(sms_state::sms_store_cart_select_r) |
| r19499 | r19500 | |
| 2177 | 2188 | save_item(NAME(m_prevright_bitmap)); |
| 2178 | 2189 | } |
| 2179 | 2190 | |
| 2191 | |
| 2192 | void 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 | |
| 2180 | 2208 | UINT32 sms_state::screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 2181 | 2209 | { |
| 2182 | 2210 | UINT8 sscope = 0; |
| r19499 | r19500 | |
| 2188 | 2216 | sscope = machine().root_device().ioport("SEGASCOPE")->read_safe(0x00); |
| 2189 | 2217 | if (!sscope) |
| 2190 | 2218 | { |
| 2219 | // without SegaScope, both LCDs for glasses go black |
| 2191 | 2220 | occluded_view = 1; |
| 2192 | 2221 | } |
| 2193 | 2222 | else if (&screen == m_left_lcd) |
| 2194 | 2223 | { |
| 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)) |
| 2197 | 2226 | occluded_view = 1; |
| 2198 | 2227 | } |
| 2199 | 2228 | else // it's right LCD |
| 2200 | 2229 | { |
| 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) |
| 2203 | 2232 | occluded_view = 1; |
| 2204 | 2233 | } |
| 2205 | 2234 | } |
| r19499 | r19500 | |
| 2273 | 2302 | |
| 2274 | 2303 | UINT32 sms_state::screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 2275 | 2304 | { |
| 2276 | | int width = screen.width(); |
| 2277 | | int height = screen.height(); |
| 2278 | 2305 | int x, y; |
| 2279 | | |
| 2280 | 2306 | bitmap_rgb32 &vdp_bitmap = m_vdp->get_bitmap(); |
| 2281 | 2307 | |
| 2282 | 2308 | // HACK: fake LCD persistence effect |
| 2283 | 2309 | // (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++) |
| 2285 | 2311 | { |
| 2286 | 2312 | UINT32 *linedst = &bitmap.pix32(y); |
| 2287 | 2313 | UINT32 *line0 = &vdp_bitmap.pix32(y); |
| 2288 | 2314 | 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++) |
| 2290 | 2316 | { |
| 2291 | 2317 | UINT32 color0 = line0[x]; |
| 2292 | 2318 | UINT32 color1 = line1[x]; |
trunk/src/mess/includes/sms.h
| r19499 | r19500 | |
| 104 | 104 | |
| 105 | 105 | /* Data needed for SegaScope (3D glasses) */ |
| 106 | 106 | UINT8 m_sscope_state; |
| 107 | UINT8 m_frame_sscope_state; |
| 107 | 108 | |
| 108 | 109 | /* Cartridge slot info */ |
| 109 | 110 | UINT8 m_current_cartridge; |
| r19499 | r19500 | |
| 184 | 185 | UINT32 screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 185 | 186 | UINT32 screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 186 | 187 | UINT32 screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 188 | void screen_vblank_sms1(screen_device &screen, bool state); |
| 187 | 189 | DECLARE_INPUT_CHANGED_MEMBER(lgun1_changed); |
| 188 | 190 | DECLARE_INPUT_CHANGED_MEMBER(lgun2_changed); |
| 189 | 191 | TIMER_CALLBACK_MEMBER(rapid_fire_callback); |
trunk/src/mess/drivers/sms.c
| r19499 | r19500 | |
| 427 | 427 | 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) |
| 428 | 428 | MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) |
| 429 | 429 | |
| 430 | MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1) |
| 431 | |
| 430 | 432 | MCFG_DEFAULT_LAYOUT(layout_sms1) |
| 431 | 433 | |
| 432 | 434 | MCFG_PALETTE_LENGTH(SEGA315_5124_PALETTE_SIZE) |
| r19499 | r19500 | |
| 539 | 541 | 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) |
| 540 | 542 | MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) |
| 541 | 543 | |
| 544 | MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1) |
| 545 | |
| 546 | MCFG_DEFAULT_LAYOUT(layout_sms1) |
| 547 | |
| 542 | 548 | MCFG_PALETTE_LENGTH(SEGA315_5124_PALETTE_SIZE) |
| 543 | 549 | MCFG_PALETTE_INIT(sega315_5124) |
| 544 | 550 | |
| 545 | | MCFG_DEFAULT_LAYOUT(layout_sms1) |
| 546 | | |
| 547 | 551 | MCFG_VIDEO_START_OVERRIDE(sms_state,sms1) |
| 548 | 552 | |
| 549 | 553 | MCFG_SEGA315_5124_ADD("sms_vdp", _315_5124_pal_intf) |