mirror of
https://github.com/holub/mame
synced 2025-07-06 18:39:28 +03:00
sms: Replace VDP bitmap access with screen().pixel() for lightgun emulation (#4664)
This commit is contained in:
parent
cd9b9d0bcd
commit
06176a02a5
@ -59,8 +59,7 @@ gg_ext_port_device::gg_ext_port_device(const machine_config &mconfig, const char
|
|||||||
device_t(mconfig, GG_EXT_PORT, tag, owner, clock),
|
device_t(mconfig, GG_EXT_PORT, tag, owner, clock),
|
||||||
device_slot_interface(mconfig, *this),
|
device_slot_interface(mconfig, *this),
|
||||||
m_device(nullptr),
|
m_device(nullptr),
|
||||||
m_th_pin_handler(*this),
|
m_th_pin_handler(*this)
|
||||||
m_pixel_handler(*this)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +82,6 @@ void gg_ext_port_device::device_start()
|
|||||||
m_device = dynamic_cast<device_gg_ext_port_interface *>(get_card_device());
|
m_device = dynamic_cast<device_gg_ext_port_interface *>(get_card_device());
|
||||||
|
|
||||||
m_th_pin_handler.resolve_safe();
|
m_th_pin_handler.resolve_safe();
|
||||||
m_pixel_handler.resolve_safe(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -107,11 +105,6 @@ void gg_ext_port_device::th_pin_w(int state)
|
|||||||
m_th_pin_handler(state);
|
m_th_pin_handler(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t gg_ext_port_device::pixel_r()
|
|
||||||
{
|
|
||||||
return m_pixel_handler();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// SLOT_INTERFACE( gg_ext_port_devices )
|
// SLOT_INTERFACE( gg_ext_port_devices )
|
||||||
|
@ -44,8 +44,6 @@ public:
|
|||||||
// static configuration helpers
|
// static configuration helpers
|
||||||
auto th_input_handler() { return m_th_pin_handler.bind(); }
|
auto th_input_handler() { return m_th_pin_handler.bind(); }
|
||||||
|
|
||||||
auto pixel_handler() { return m_pixel_handler.bind(); }
|
|
||||||
|
|
||||||
// Currently, only the support for SMS Controller Adaptor is emulated,
|
// Currently, only the support for SMS Controller Adaptor is emulated,
|
||||||
// for when SMS Compatibility mode is enabled. In that mode, the 10 pins
|
// for when SMS Compatibility mode is enabled. In that mode, the 10 pins
|
||||||
// of the EXT port follows the same numbering of a SMS Control port.
|
// of the EXT port follows the same numbering of a SMS Control port.
|
||||||
@ -66,7 +64,6 @@ public:
|
|||||||
void port_w( uint8_t data );
|
void port_w( uint8_t data );
|
||||||
|
|
||||||
void th_pin_w(int state);
|
void th_pin_w(int state);
|
||||||
uint32_t pixel_r();
|
|
||||||
|
|
||||||
//protected:
|
//protected:
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
@ -76,7 +73,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
devcb_write_line m_th_pin_handler;
|
devcb_write_line m_th_pin_handler;
|
||||||
devcb_read32 m_pixel_handler;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,12 +70,6 @@ WRITE_LINE_MEMBER( sms_ctrl_adaptor_device::th_pin_w )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
READ32_MEMBER( sms_ctrl_adaptor_device::pixel_r )
|
|
||||||
{
|
|
||||||
return m_port->pixel_r();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// device_add_mconfig - add device configuration
|
// device_add_mconfig - add device configuration
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -84,6 +78,5 @@ void sms_ctrl_adaptor_device::device_add_mconfig(machine_config &config)
|
|||||||
{
|
{
|
||||||
SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad");
|
SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad");
|
||||||
m_subctrl_port->th_input_handler().set(FUNC(sms_ctrl_adaptor_device::th_pin_w));
|
m_subctrl_port->th_input_handler().set(FUNC(sms_ctrl_adaptor_device::th_pin_w));
|
||||||
m_subctrl_port->pixel_handler().set(FUNC(sms_ctrl_adaptor_device::pixel_r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_WRITE_LINE_MEMBER(th_pin_w);
|
DECLARE_WRITE_LINE_MEMBER(th_pin_w);
|
||||||
DECLARE_READ32_MEMBER(pixel_r);
|
|
||||||
|
|
||||||
required_device<sms_control_port_device> m_subctrl_port;
|
required_device<sms_control_port_device> m_subctrl_port;
|
||||||
};
|
};
|
||||||
|
@ -231,7 +231,7 @@ int sms_light_phaser_device::bright_aim_area( emu_timer *timer, int lgun_x, int
|
|||||||
/* brightness of the lightgray color in the frame drawn by Light Phaser games */
|
/* brightness of the lightgray color in the frame drawn by Light Phaser games */
|
||||||
const uint8_t sensor_min_brightness = 0x7f;
|
const uint8_t sensor_min_brightness = 0x7f;
|
||||||
|
|
||||||
color = m_port->pixel_r();
|
color = screen().pixel(beam_x, beam_y);
|
||||||
|
|
||||||
/* reference: http://www.w3.org/TR/AERT#color-contrast */
|
/* reference: http://www.w3.org/TR/AERT#color-contrast */
|
||||||
brightness = (color.r() * 0.299) + (color.g() * 0.587) + (color.b() * 0.114);
|
brightness = (color.r() * 0.299) + (color.g() * 0.587) + (color.b() * 0.114);
|
||||||
|
@ -123,22 +123,12 @@ void sms_multitap_device::peripheral_w(uint8_t data)
|
|||||||
// device_add_mconfig - add device configuration
|
// device_add_mconfig - add device configuration
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
READ32_MEMBER( sms_multitap_device::pixel_r )
|
|
||||||
{
|
|
||||||
return m_port->pixel_r();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void sms_multitap_device::device_add_mconfig(machine_config &config)
|
void sms_multitap_device::device_add_mconfig(machine_config &config)
|
||||||
{
|
{
|
||||||
// Controller subports setup, without the TH callback declaration,
|
// Controller subports setup, without the TH callback declaration,
|
||||||
// because the circuit scheme shows TH of subports without connection.
|
// because the circuit scheme shows TH of subports without connection.
|
||||||
SMS_CONTROL_PORT(config, m_subctrl1_port, sms_control_port_devices, "joypad");
|
SMS_CONTROL_PORT(config, m_subctrl1_port, sms_control_port_devices, "joypad");
|
||||||
m_subctrl1_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r));
|
|
||||||
SMS_CONTROL_PORT(config, m_subctrl2_port, sms_control_port_devices, "joypad");
|
SMS_CONTROL_PORT(config, m_subctrl2_port, sms_control_port_devices, "joypad");
|
||||||
m_subctrl2_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r));
|
|
||||||
SMS_CONTROL_PORT(config, m_subctrl3_port, sms_control_port_devices, "joypad");
|
SMS_CONTROL_PORT(config, m_subctrl3_port, sms_control_port_devices, "joypad");
|
||||||
m_subctrl3_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r));
|
|
||||||
SMS_CONTROL_PORT(config, m_subctrl4_port, sms_control_port_devices, "joypad");
|
SMS_CONTROL_PORT(config, m_subctrl4_port, sms_control_port_devices, "joypad");
|
||||||
m_subctrl4_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r));
|
|
||||||
}
|
}
|
||||||
|
@ -132,15 +132,8 @@ WRITE_LINE_MEMBER( sms_rapid_fire_device::th_pin_w )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
READ32_MEMBER( sms_rapid_fire_device::pixel_r )
|
|
||||||
{
|
|
||||||
return m_port->pixel_r();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void sms_rapid_fire_device::device_add_mconfig(machine_config &config)
|
void sms_rapid_fire_device::device_add_mconfig(machine_config &config)
|
||||||
{
|
{
|
||||||
SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad");
|
SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad");
|
||||||
m_subctrl_port->th_input_handler().set(FUNC(sms_rapid_fire_device::th_pin_w));
|
m_subctrl_port->th_input_handler().set(FUNC(sms_rapid_fire_device::th_pin_w));
|
||||||
m_subctrl_port->pixel_handler().set(FUNC(sms_rapid_fire_device::pixel_r));
|
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_WRITE_LINE_MEMBER(th_pin_w);
|
DECLARE_WRITE_LINE_MEMBER(th_pin_w);
|
||||||
DECLARE_READ32_MEMBER(pixel_r);
|
|
||||||
|
|
||||||
required_ioport m_rfire_sw;
|
required_ioport m_rfire_sw;
|
||||||
required_device<sms_control_port_device> m_subctrl_port;
|
required_device<sms_control_port_device> m_subctrl_port;
|
||||||
|
@ -66,8 +66,7 @@ sms_control_port_device::sms_control_port_device(const machine_config &mconfig,
|
|||||||
device_t(mconfig, SMS_CONTROL_PORT, tag, owner, clock),
|
device_t(mconfig, SMS_CONTROL_PORT, tag, owner, clock),
|
||||||
device_slot_interface(mconfig, *this),
|
device_slot_interface(mconfig, *this),
|
||||||
m_device(nullptr),
|
m_device(nullptr),
|
||||||
m_th_pin_handler(*this),
|
m_th_pin_handler(*this)
|
||||||
m_pixel_handler(*this)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +89,6 @@ void sms_control_port_device::device_start()
|
|||||||
m_device = dynamic_cast<device_sms_control_port_interface *>(get_card_device());
|
m_device = dynamic_cast<device_sms_control_port_interface *>(get_card_device());
|
||||||
|
|
||||||
m_th_pin_handler.resolve_safe();
|
m_th_pin_handler.resolve_safe();
|
||||||
m_pixel_handler.resolve_safe(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,11 +112,6 @@ void sms_control_port_device::th_pin_w(int state)
|
|||||||
m_th_pin_handler(state);
|
m_th_pin_handler(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t sms_control_port_device::pixel_r()
|
|
||||||
{
|
|
||||||
return m_pixel_handler();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// SLOT_INTERFACE( sms_control_port_devices )
|
// SLOT_INTERFACE( sms_control_port_devices )
|
||||||
|
@ -44,8 +44,6 @@ public:
|
|||||||
// static configuration helpers
|
// static configuration helpers
|
||||||
auto th_input_handler() { return m_th_pin_handler.bind(); }
|
auto th_input_handler() { return m_th_pin_handler.bind(); }
|
||||||
|
|
||||||
auto pixel_handler() { return m_pixel_handler.bind(); }
|
|
||||||
|
|
||||||
// Physical DE-9 connector interface
|
// Physical DE-9 connector interface
|
||||||
|
|
||||||
// Data returned by the port_r methods:
|
// Data returned by the port_r methods:
|
||||||
@ -63,7 +61,6 @@ public:
|
|||||||
void port_w( uint8_t data );
|
void port_w( uint8_t data );
|
||||||
|
|
||||||
void th_pin_w(int state);
|
void th_pin_w(int state);
|
||||||
uint32_t pixel_r();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
@ -73,7 +70,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
devcb_write_line m_th_pin_handler;
|
devcb_write_line m_th_pin_handler;
|
||||||
devcb_read32 m_pixel_handler;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -504,11 +504,9 @@ void sms_state::sms_base(machine_config &config)
|
|||||||
|
|
||||||
SMS_CONTROL_PORT(config, m_port_ctrl1, sms_control_port_devices, "joypad");
|
SMS_CONTROL_PORT(config, m_port_ctrl1, sms_control_port_devices, "joypad");
|
||||||
m_port_ctrl1->th_input_handler().set(FUNC(sms_state::sms_ctrl1_th_input));
|
m_port_ctrl1->th_input_handler().set(FUNC(sms_state::sms_ctrl1_th_input));
|
||||||
m_port_ctrl1->pixel_handler().set(FUNC(sms_state::sms_pixel_color));
|
|
||||||
|
|
||||||
SMS_CONTROL_PORT(config, m_port_ctrl2, sms_control_port_devices, "joypad");
|
SMS_CONTROL_PORT(config, m_port_ctrl2, sms_control_port_devices, "joypad");
|
||||||
m_port_ctrl2->th_input_handler().set(FUNC(sms_state::sms_ctrl2_th_input));
|
m_port_ctrl2->th_input_handler().set(FUNC(sms_state::sms_ctrl2_th_input));
|
||||||
m_port_ctrl2->pixel_handler().set(FUNC(sms_state::sms_pixel_color));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sms_state::sms_ntsc_base(machine_config &config)
|
void sms_state::sms_ntsc_base(machine_config &config)
|
||||||
@ -977,8 +975,6 @@ MACHINE_CONFIG_START(sms_state::gamegear)
|
|||||||
|
|
||||||
GG_EXT_PORT(config, m_port_gg_ext, gg_ext_port_devices, nullptr);
|
GG_EXT_PORT(config, m_port_gg_ext, gg_ext_port_devices, nullptr);
|
||||||
m_port_gg_ext->th_input_handler().set(FUNC(sms_state::gg_ext_th_input));
|
m_port_gg_ext->th_input_handler().set(FUNC(sms_state::gg_ext_th_input));
|
||||||
// only for GG-TV mod (may be simulated with a driver modified with SMS screen settings)
|
|
||||||
//m_port_gg_ext->pixel_handler().set(FUNC(sms_state::sms_pixel_color));
|
|
||||||
|
|
||||||
m_is_gamegear = true;
|
m_is_gamegear = true;
|
||||||
m_has_bios_0400 = true;
|
m_has_bios_0400 = true;
|
||||||
|
@ -128,7 +128,6 @@ protected:
|
|||||||
DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input);
|
DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input);
|
||||||
DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input);
|
DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input);
|
||||||
DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input);
|
DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input);
|
||||||
DECLARE_READ32_MEMBER(sms_pixel_color);
|
|
||||||
|
|
||||||
DECLARE_VIDEO_START(gamegear);
|
DECLARE_VIDEO_START(gamegear);
|
||||||
DECLARE_VIDEO_RESET(gamegear);
|
DECLARE_VIDEO_RESET(gamegear);
|
||||||
|
@ -1260,16 +1260,6 @@ VIDEO_RESET_MEMBER(sms_state,sms1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
READ32_MEMBER(sms_state::sms_pixel_color)
|
|
||||||
{
|
|
||||||
bitmap_rgb32 &vdp_bitmap = m_vdp->get_bitmap();
|
|
||||||
int beam_x = m_main_scr->hpos();
|
|
||||||
int beam_y = m_main_scr->vpos();
|
|
||||||
|
|
||||||
return vdp_bitmap.pix32(beam_y, beam_x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WRITE_LINE_MEMBER(sms_state::screen_vblank_sms1)
|
WRITE_LINE_MEMBER(sms_state::screen_vblank_sms1)
|
||||||
{
|
{
|
||||||
// on falling edge
|
// on falling edge
|
||||||
|
Loading…
Reference in New Issue
Block a user