summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mame/drivers/sms.cpp4
-rw-r--r--src/mame/includes/sms.h8
-rw-r--r--src/mame/machine/sms.cpp99
3 files changed, 48 insertions, 63 deletions
diff --git a/src/mame/drivers/sms.cpp b/src/mame/drivers/sms.cpp
index dd7ac77bad9..e99f3defc0d 100644
--- a/src/mame/drivers/sms.cpp
+++ b/src/mame/drivers/sms.cpp
@@ -601,11 +601,11 @@ MACHINE_CONFIG_START(sms_state::sms1_ntsc)
MCFG_SCREEN_ADD("left_lcd", LCD) // This is needed for SegaScope Left LCD
MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(XTAL(10'738'635)/2)
- MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
+ MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1_left)
MCFG_SCREEN_ADD("right_lcd", LCD) // This is needed for SegaScope Right LCD
MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(XTAL(10'738'635)/2)
- MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
+ MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1_right)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sms_state, screen_vblank_sms1))
diff --git a/src/mame/includes/sms.h b/src/mame/includes/sms.h
index 502a8ed554e..30e3ed66d16 100644
--- a/src/mame/includes/sms.h
+++ b/src/mame/includes/sms.h
@@ -58,6 +58,8 @@ public:
m_led_pwr(*this, "led_pwr"),
m_region_maincpu(*this, "maincpu"),
m_mainram(nullptr),
+ m_left_lcd(*this, "left_lcd"),
+ m_right_lcd(*this, "right_lcd"),
m_is_gamegear(false),
m_is_smsj(false),
m_is_mark_iii(false),
@@ -117,6 +119,8 @@ public:
uint32_t screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update_sms1_left(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update_sms1_right(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_sms1);
@@ -187,8 +191,8 @@ protected:
uint8_t *m_BIOS;
// for 3D glass binocular hack
- device_t *m_left_lcd;
- device_t *m_right_lcd;
+ optional_device<screen_device> m_left_lcd;
+ optional_device<screen_device> m_right_lcd;
bitmap_rgb32 m_prevleft_bitmap;
bitmap_rgb32 m_prevright_bitmap;
diff --git a/src/mame/machine/sms.cpp b/src/mame/machine/sms.cpp
index ecbadd784b2..997889a6416 100644
--- a/src/mame/machine/sms.cpp
+++ b/src/mame/machine/sms.cpp
@@ -1259,9 +1259,6 @@ WRITE_LINE_MEMBER(smssdisp_state::sms_store_int_callback)
VIDEO_START_MEMBER(sms_state,sms1)
{
- m_left_lcd = machine().device("left_lcd");
- m_right_lcd = machine().device("right_lcd");
-
m_main_scr->register_screen_bitmap(m_prevleft_bitmap);
m_main_scr->register_screen_bitmap(m_prevright_bitmap);
save_item(NAME(m_prevleft_bitmap));
@@ -1316,81 +1313,65 @@ WRITE_LINE_MEMBER(sms_state::screen_vblank_sms1)
}
}
-
uint32_t sms_state::screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t sscope = 0;
- uint8_t sscope_binocular_hack;
- uint8_t occluded_view = 0;
+ m_vdp->screen_update(screen, bitmap, cliprect);
+ return 0;
+}
- if (&screen != m_main_scr)
+uint32_t sms_state::screen_update_sms1_left(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ uint8_t sscope = m_port_scope->read();
+
+ // without SegaScope, both LCDs for glasses go black
+ // with SegaScope, state 0 = left screen OFF, right screen ON
+ if (sscope && BIT(m_frame_sscope_state, 0))
{
- sscope = m_port_scope->read();
- if (!sscope)
- {
- // without SegaScope, both LCDs for glasses go black
- occluded_view = 1;
- }
- else if (&screen == m_left_lcd)
- {
- // with SegaScope, state 0 = left screen OFF, right screen ON
- if (!(m_frame_sscope_state & 0x01))
- occluded_view = 1;
- }
- else // it's right LCD
+ m_vdp->screen_update(screen, bitmap, cliprect);
+
+ // HACK: fake 3D->2D handling (if enabled, it repeats each frame twice on the selected lens)
+ // save a copy of current bitmap for the binocular hack
+ if (BIT(m_port_scope_binocular->read(), 0))
+ copybitmap(m_prevleft_bitmap, bitmap, 0, 0, 0, 0, cliprect);
+ }
+ else
+ {
+ // HACK: fake 3D->2D handling (if enabled, it repeats each frame twice on the selected lens)
+ // use the copied bitmap for the binocular hack
+ if (sscope && BIT(m_port_scope_binocular->read(), 0))
{
- // with SegaScope, state 1 = left screen ON, right screen OFF
- if (m_frame_sscope_state & 0x01)
- occluded_view = 1;
+ copybitmap(bitmap, m_prevleft_bitmap, 0, 0, 0, 0, cliprect);
+ return 0;
}
+ bitmap.fill(rgb_t::black(), cliprect);
}
- if (!occluded_view)
+ return 0;
+}
+
+uint32_t sms_state::screen_update_sms1_right(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ uint8_t sscope = m_port_scope->read();
+
+ // without SegaScope, both LCDs for glasses go black
+ // with SegaScope, state 1 = left screen ON, right screen OFF
+ if (sscope && !BIT(m_frame_sscope_state, 0))
{
m_vdp->screen_update(screen, bitmap, cliprect);
// HACK: fake 3D->2D handling (if enabled, it repeats each frame twice on the selected lens)
// save a copy of current bitmap for the binocular hack
- if (sscope)
- {
- sscope_binocular_hack = m_port_scope_binocular->read();
-
- if (&screen == m_left_lcd)
- {
- if (sscope_binocular_hack & 0x01)
- copybitmap(m_prevleft_bitmap, bitmap, 0, 0, 0, 0, cliprect);
- }
- else // it's right LCD
- {
- if (sscope_binocular_hack & 0x02)
- copybitmap(m_prevright_bitmap, bitmap, 0, 0, 0, 0, cliprect);
- }
- }
+ if (BIT(m_port_scope_binocular->read(), 1))
+ copybitmap(m_prevright_bitmap, bitmap, 0, 0, 0, 0, cliprect);
}
else
{
// HACK: fake 3D->2D handling (if enabled, it repeats each frame twice on the selected lens)
// use the copied bitmap for the binocular hack
- if (sscope)
+ if (sscope && BIT(m_port_scope_binocular->read(), 1))
{
- sscope_binocular_hack = m_port_scope_binocular->read();
-
- if (&screen == m_left_lcd)
- {
- if (sscope_binocular_hack & 0x01)
- {
- copybitmap(bitmap, m_prevleft_bitmap, 0, 0, 0, 0, cliprect);
- return 0;
- }
- }
- else // it's right LCD
- {
- if (sscope_binocular_hack & 0x02)
- {
- copybitmap(bitmap, m_prevright_bitmap, 0, 0, 0, 0, cliprect);
- return 0;
- }
- }
+ copybitmap(bitmap, m_prevright_bitmap, 0, 0, 0, 0, cliprect);
+ return 0;
}
bitmap.fill(rgb_t::black(), cliprect);
}