From c94f3c9519c62aa5c0d2cce216ef4c4fb7688672 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 17 May 2023 19:51:31 -0400 Subject: ebases, demndrgn: Eliminate deprecated use of PORT_RESET for trackball inputs --- src/mame/midway/astrocde.cpp | 27 +++++++++++++++++---------- src/mame/midway/astrocde.h | 23 ++++++++++++++++++----- src/mame/midway/astrocde_v.cpp | 14 ++++++++++++++ 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/src/mame/midway/astrocde.cpp b/src/mame/midway/astrocde.cpp index 2aa3ad1f421..29c1b8b1e0d 100644 --- a/src/mame/midway/astrocde.cpp +++ b/src/mame/midway/astrocde.cpp @@ -250,13 +250,14 @@ WRITE_LINE_MEMBER(astrocde_state::sparkle_w) CUSTOM_INPUT_MEMBER(ebases_state::trackball_r) { - return m_trackball[m_input_select]->read(); + return (m_trackball[m_input_select]->read() - m_trackball_last) & 0xff; } void ebases_state::trackball_select_w(uint8_t data) { m_input_select = data & 3; + m_trackball_last = m_trackball[m_input_select]->read(); } @@ -299,9 +300,14 @@ WRITE_LINE_MEMBER(demndrgn_state::input_select_w) m_input_select = state; } -CUSTOM_INPUT_MEMBER(demndrgn_state::joystick_r) +CUSTOM_INPUT_MEMBER(demndrgn_state::trackball_r) { - return m_joystick[m_input_select]->read(); + return (m_trackball[m_input_select]->read() - m_trackball_last) & 0xff; +} + +void demndrgn_state::trackball_reset_w(uint8_t data) +{ + m_trackball_last = m_trackball[m_input_select]->read(); } @@ -728,16 +734,16 @@ static INPUT_PORTS_START( ebases ) PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(ebases_state, trackball_r) PORT_START("TRACKX1") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_START("TRACKY1") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_START("TRACKX2") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET PORT_PLAYER(2) + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2) PORT_START("TRACKY2") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET PORT_PLAYER(2) + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2) PORT_START("FAKE") /* Cocktail cabinets had a B/W monitor with color overlay (same one as Space Zap!), @@ -1059,7 +1065,7 @@ static INPUT_PORTS_START( demndrgn ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("P2HANDLE") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_CUSTOM_MEMBER(demndrgn_state, joystick_r) + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_CUSTOM_MEMBER(demndrgn_state, trackball_r) PORT_START("P3HANDLE") PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -1075,10 +1081,10 @@ static INPUT_PORTS_START( demndrgn ) PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "S1:8" ) PORT_START("MOVEX") - PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_RESET + PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_START("MOVEY") - PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_RESET + PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_START("FIREX") PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_REVERSE @@ -1493,6 +1499,7 @@ void demndrgn_state::demndrgn(machine_config &config) outlatch.bit_handler<4>().set(FUNC(demndrgn_state::input_select_w)); m_astrocade_sound1->so_cb<4>().set("outlatch", FUNC(output_latch_device::write)); + m_astrocade_sound1->so_cb<4>().append(FUNC(demndrgn_state::trackball_reset_w)); m_astrocade_sound1->pot_cb<0>().set_ioport("FIREX"); m_astrocade_sound1->pot_cb<1>().set_ioport("FIREY"); } diff --git a/src/mame/midway/astrocde.h b/src/mame/midway/astrocde.h index b9f4a0f0875..ba62b4ea682 100644 --- a/src/mame/midway/astrocde.h +++ b/src/mame/midway/astrocde.h @@ -192,14 +192,16 @@ public: { } void seawolf2(machine_config &config); + +protected: + virtual void machine_start() override; + private: void sound_1_w(uint8_t data); void sound_2_w(uint8_t data); void port_map_discrete(address_map &map); - virtual void machine_start() override; - required_device m_samples; uint8_t m_port_1_last = 0U; uint8_t m_port_2_last = 0U; @@ -215,6 +217,10 @@ public: void ebases(machine_config &config); DECLARE_CUSTOM_INPUT_MEMBER(trackball_r); + +protected: + virtual void machine_start() override; + private: void trackball_select_w(uint8_t data); void coin_w(uint8_t data); @@ -223,6 +229,7 @@ private: void port_map_ebases(address_map &map); required_ioport_array<4> m_trackball; + uint8_t m_trackball_last = 0U; }; class demndrgn_state : public astrocde_state @@ -230,18 +237,24 @@ class demndrgn_state : public astrocde_state public: demndrgn_state(const machine_config &mconfig, device_type type, const char *tag) : astrocde_state(mconfig, type, tag) - , m_joystick(*this, {"MOVEX", "MOVEY"}) + , m_trackball(*this, {"MOVEX", "MOVEY"}) { } void demndrgn(machine_config &config); - DECLARE_CUSTOM_INPUT_MEMBER(joystick_r); + DECLARE_CUSTOM_INPUT_MEMBER(trackball_r); + +protected: + virtual void machine_start() override; + private: DECLARE_WRITE_LINE_MEMBER(input_select_w); void sound_w(uint8_t data); + void trackball_reset_w(uint8_t data); void port_map_16col_pattern_demndrgn(address_map &map); - required_ioport_array<2> m_joystick; + required_ioport_array<2> m_trackball; + uint8_t m_trackball_last = 0U; }; class tenpindx_state : public astrocde_state diff --git a/src/mame/midway/astrocde_v.cpp b/src/mame/midway/astrocde_v.cpp index ae538d3edd8..ba9781e889f 100644 --- a/src/mame/midway/astrocde_v.cpp +++ b/src/mame/midway/astrocde_v.cpp @@ -40,6 +40,20 @@ void seawolf2_state::machine_start() m_port_1_last = m_port_2_last = 0xff; } +void ebases_state::machine_start() +{ + astrocde_state::machine_start(); + + save_item(NAME(m_trackball_last)); +} + +void demndrgn_state::machine_start() +{ + astrocde_state::machine_start(); + + save_item(NAME(m_trackball_last)); +} + void tenpindx_state::machine_start() { astrocde_state::machine_start(); -- cgit v1.2.3