bus/nes_ctrl: Added support for Exciting Boxing air bag controller. (#8817)

Software list items promoted to working (nes.xml)
---------------------------------------
Exciting Boxing (Japan)
This commit is contained in:
0kmg 2021-11-19 05:27:39 -09:00 committed by GitHub
parent eac8c16a58
commit 2b3337f90b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 146 additions and 2 deletions

View File

@ -11312,8 +11312,7 @@ license:CC0
</part>
</software>
<!-- This game uses an unemulated punching bag controller -->
<software name="exboxing" supported="no">
<software name="exboxing" supported="partial">
<description>Exciting Boxing (Japan)</description>
<year>1987</year>
<publisher>Konami</publisher>
@ -11323,6 +11322,7 @@ license:CC0
<part name="cart" interface="nes_cart">
<feature name="slot" value="vrc1" />
<feature name="pcb" value="KONAMI-VRC-1" />
<feature name="peripheral" value="konami_airbag" />
<dataarea name="prg" size="131072">
<rom name="rc250j0p" size="131072" crc="786148b6" sha1="20cba7316cb907d7a6245c598640ce7aca56f30a" offset="00000" />
</dataarea>

View File

@ -2998,6 +2998,8 @@ if (BUSES["NES_CTRL"]~=null) then
MAME_DIR .. "src/devices/bus/nes_ctrl/fcmat.h",
MAME_DIR .. "src/devices/bus/nes_ctrl/hori.cpp",
MAME_DIR .. "src/devices/bus/nes_ctrl/hori.h",
MAME_DIR .. "src/devices/bus/nes_ctrl/konamibag.cpp",
MAME_DIR .. "src/devices/bus/nes_ctrl/konamibag.h",
MAME_DIR .. "src/devices/bus/nes_ctrl/konamihs.cpp",
MAME_DIR .. "src/devices/bus/nes_ctrl/konamihs.h",
MAME_DIR .. "src/devices/bus/nes_ctrl/miracle.cpp",

View File

@ -51,6 +51,7 @@
#include "fcmat.h"
#include "hori.h"
#include "joypad.h"
#include "konamibag.h"
#include "konamihs.h"
#include "miracle.h"
#include "mjpanel.h"
@ -205,6 +206,7 @@ void fc_expansion_devices(device_slot_interface &device)
device.option_add("bandaihs", NES_BANDAIHS);
device.option_add("vaus", NES_ARKPADDLE_FC);
device.option_add("family_trainer", NES_FTRAINER);
device.option_add("konamibag", NES_KONAMIBAG);
device.option_add("konamihs", NES_KONAMIHS);
device.option_add("konami_piano", NES_DOREPIANO);
device.option_add("mj_panel", NES_MJPANEL);

View File

@ -0,0 +1,88 @@
// license:BSD-3-Clause
// copyright-holders:kmg, Fabio Priuli
/**********************************************************************
Nintendo Family Computer - Konami Exciting Boxing Air Bag
**********************************************************************/
#include "emu.h"
#include "konamibag.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(NES_KONAMIBAG, nes_konamibag_device, "nes_konamibag", "Konami Exciting Boxing Air Bag")
static INPUT_PORTS_START( nes_konamibag )
PORT_START("BAG.0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Left Hook")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // opponent dodges right, unclear how this is triggered
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // opponent dodges left, unclear how this is triggered
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Right Hook")
PORT_START("BAG.1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Left Jab")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Body")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Right Jab")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Straight")
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor nes_konamibag_device::device_input_ports() const
{
return INPUT_PORTS_NAME( nes_konamibag );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// nes_konamibag_device - constructor
//-------------------------------------------------
nes_konamibag_device::nes_konamibag_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, NES_KONAMIBAG, tag, owner, clock)
, device_nes_control_port_interface(mconfig, *this)
, m_sensor(*this, "BAG.%u", 0)
, m_cur_sensor(0)
{
}
//-------------------------------------------------
// device_start
//-------------------------------------------------
void nes_konamibag_device::device_start()
{
save_item(NAME(m_cur_sensor));
}
//-------------------------------------------------
// read
//-------------------------------------------------
u8 nes_konamibag_device::read_exp(offs_t offset)
{
return (offset == 1) ? m_sensor[m_cur_sensor]->read() << 1 : 0;
}
//-------------------------------------------------
// write
//-------------------------------------------------
void nes_konamibag_device::write(u8 data)
{
m_cur_sensor = BIT(data, 1);
}

View File

@ -0,0 +1,52 @@
// license:BSD-3-Clause
// copyright-holders:kmg, Fabio Priuli
/**********************************************************************
Nintendo Family Computer - Konami Exciting Boxing Air Bag
**********************************************************************/
#ifndef MAME_BUS_NES_CTRL_KONAMIBAG_H
#define MAME_BUS_NES_CTRL_KONAMIBAG_H
#pragma once
#include "ctrl.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> nes_konamibag_device
class nes_konamibag_device :
public device_t,
public device_nes_control_port_interface
{
public:
static constexpr feature_type imperfect_features() { return feature::CONTROLS; }
// construction/destruction
nes_konamibag_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual ioport_constructor device_input_ports() const override;
protected:
// device-level overrides
virtual void device_start() override;
virtual u8 read_exp(offs_t offset) override;
virtual void write(u8 data) override;
private:
required_ioport_array<2> m_sensor;
u8 m_cur_sensor;
};
// device type definition
DECLARE_DEVICE_TYPE(NES_KONAMIBAG, nes_konamibag_device)
#endif // MAME_BUS_NES_CTRL_KONAMIBAG_H