From 8f04178a415e1d1d29b6314f19c4a69ea007ad8c Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 7 Dec 2015 16:26:03 +0000 Subject: [PATCH] ok, understand how the spinners work now, just need to hook them up properly (nw) --- src/mame/drivers/cps2.cpp | 48 +++++++++++++++++++++++++++++++++------ src/mame/includes/cps1.h | 13 +++++++++-- 2 files changed, 52 insertions(+), 9 deletions(-) diff --git a/src/mame/drivers/cps2.cpp b/src/mame/drivers/cps2.cpp index f1b9ce87274..971f5dfd81e 100644 --- a/src/mame/drivers/cps2.cpp +++ b/src/mame/drivers/cps2.cpp @@ -728,6 +728,10 @@ WRITE16_MEMBER( cps_state::cps2_eeprom_port_w ) /* EEPROM */ ioport("EEPROMOUT")->write(data, 0xffff); + if (m_cps2_dial_type == 2) // ecofghtr + { + m_readpaddle = (data & 0x0100); + } } if (ACCESSING_BITS_0_7) @@ -746,9 +750,7 @@ WRITE16_MEMBER( cps_state::cps2_eeprom_port_w ) m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x0008) ? CLEAR_LINE : ASSERT_LINE); coin_counter_w(machine(), 0, data & 0x0001); - if ((strncmp(machine().system().name, "pzloop2", 7) == 0) || - (strncmp(machine().system().name, "pzloop2j", 8) == 0) || - (strncmp(machine().system().name, "pzloop2jr1", 10) == 0)) + if (m_cps2_dial_type == 1) // pzloop2 { // Puzz Loop 2 uses coin counter 2 input to switch between stick and paddle controls m_readpaddle = data & 0x0002; @@ -846,9 +848,26 @@ READ16_MEMBER( cps_state::kludge_r ) READ16_MEMBER( cps_state::joy_or_paddle_r ) { if (m_readpaddle != 0) + { return (ioport("IN0")->read()); + } else + { return (ioport("PADDLE1")->read() & 0xff) | (ioport("PADDLE2")->read() << 8); + } +} + +READ16_MEMBER(cps_state::joy_or_paddle_ecofghtr_r) +{ + if (m_readpaddle == 0 || (m_io_in1->read() & 0x10) == 0x10) // ignore bit if spinner not enabled + { + return (ioport("IN0")->read()); + } + else + { + // this is actually a magnitude, direction appears in IN0 above (button 2) + return (ioport("PADDLE1")->read() & 0xff) | (ioport("PADDLE2")->read() << 8); + } } @@ -1078,10 +1097,16 @@ static INPUT_PORTS_START( ecofghtr ) PORT_MODIFY("IN1") // If this bit is set then the Test Mode shows 'Rolling' instead of Shot2/3 - this is the 'spinner' mode. - // I think the IN0 port gets multiplexed and reads with 'button2' set become the angle? - // button1 still acts as shoot (as well as part of the angle?) hence thinking it's multiplexed. - // todo: investigate how this works - //PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) + // in this mode the IN0 port is multiplexed with an analog input, what would be Button 2 ends up being 'direction' + PORT_CONFNAME( 0x10, 0x00, "Use Spinners" ) + PORT_CONFSETTING( 0x00, DEF_STR( Yes ) ) + PORT_CONFSETTING( 0x10, DEF_STR( No ) ) + + PORT_START("PADDLE1") + PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(15) PORT_PLAYER(1) + + PORT_START("PADDLE2") + PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(15) PORT_PLAYER(2) INPUT_PORTS_END @@ -9245,6 +9270,7 @@ DRIVER_INIT_MEMBER(cps_state,pzloop2) DRIVER_INIT_CALL(cps2); m_readpaddle = 0; + m_cps2_dial_type = 1; save_item(NAME(m_readpaddle)); @@ -9307,6 +9333,14 @@ DRIVER_INIT_MEMBER(cps_state,gigaman2) DRIVER_INIT_MEMBER(cps_state,ecofghtr) { DRIVER_INIT_CALL(cps2); + + m_readpaddle = 0; + m_cps2_dial_type = 2; + + save_item(NAME(m_readpaddle)); + + m_maincpu->space(AS_PROGRAM).install_read_handler(0x804000, 0x804001, read16_delegate(FUNC(cps_state::joy_or_paddle_ecofghtr_r), this)); + } diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h index 7aa2eb027f2..42c1109550d 100644 --- a/src/mame/includes/cps1.h +++ b/src/mame/includes/cps1.h @@ -108,6 +108,9 @@ public: m_objram1(*this, "objram1"), m_objram2(*this, "objram2"), m_output(*this, "output"), + m_io_in0(*this, "IN0"), + m_io_in1(*this, "IN1"), + m_cps2_dial_type(0), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_oki(*this, "oki"), @@ -117,7 +120,8 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_decrypted_opcodes(*this, "decrypted_opcodes") { } + m_decrypted_opcodes(*this, "decrypted_opcodes") + { } /* memory pointers */ // cps1 @@ -137,11 +141,14 @@ public: optional_shared_ptr m_objram1; optional_shared_ptr m_objram2; optional_shared_ptr m_output; + + optional_ioport m_io_in0; + optional_ioport m_io_in1; UINT16 * m_cps2_buffered_obj; // game-specific UINT16 * m_gigaman2_dummyqsound_ram; UINT16 sf2ceblp_prot; - + /* video-related */ tilemap_t *m_bg_tilemap[3]; int m_scanline1; @@ -172,6 +179,7 @@ public: int m_cps2digitalvolumelevel; int m_cps2disabledigitalvolume; emu_timer *m_digital_volume_timer; + int m_cps2_dial_type; /* fcrash sound hw */ int m_sample_buffer1; @@ -382,6 +390,7 @@ public: DECLARE_READ16_MEMBER(cps2_qsound_volume_r); DECLARE_READ16_MEMBER(kludge_r); DECLARE_READ16_MEMBER(joy_or_paddle_r); + DECLARE_READ16_MEMBER(joy_or_paddle_ecofghtr_r); DECLARE_WRITE_LINE_MEMBER(m5205_int1); DECLARE_WRITE_LINE_MEMBER(m5205_int2); };