mirror of
https://github.com/holub/mame
synced 2025-07-04 09:28:51 +03:00
bus/nes_ctrl: Added a SNES controller port adapter. (#9027)
This commit is contained in:
parent
a1984ce710
commit
0e66408732
@ -3030,6 +3030,8 @@ if (BUSES["NES_CTRL"]~=null) then
|
|||||||
MAME_DIR .. "src/devices/bus/nes_ctrl/partytap.h",
|
MAME_DIR .. "src/devices/bus/nes_ctrl/partytap.h",
|
||||||
MAME_DIR .. "src/devices/bus/nes_ctrl/powerpad.cpp",
|
MAME_DIR .. "src/devices/bus/nes_ctrl/powerpad.cpp",
|
||||||
MAME_DIR .. "src/devices/bus/nes_ctrl/powerpad.h",
|
MAME_DIR .. "src/devices/bus/nes_ctrl/powerpad.h",
|
||||||
|
MAME_DIR .. "src/devices/bus/nes_ctrl/snesadapter.cpp",
|
||||||
|
MAME_DIR .. "src/devices/bus/nes_ctrl/snesadapter.h",
|
||||||
MAME_DIR .. "src/devices/bus/nes_ctrl/suborkey.cpp",
|
MAME_DIR .. "src/devices/bus/nes_ctrl/suborkey.cpp",
|
||||||
MAME_DIR .. "src/devices/bus/nes_ctrl/suborkey.h",
|
MAME_DIR .. "src/devices/bus/nes_ctrl/suborkey.h",
|
||||||
MAME_DIR .. "src/devices/bus/nes_ctrl/zapper.cpp",
|
MAME_DIR .. "src/devices/bus/nes_ctrl/zapper.cpp",
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
#include "pachinko.h"
|
#include "pachinko.h"
|
||||||
#include "partytap.h"
|
#include "partytap.h"
|
||||||
#include "powerpad.h"
|
#include "powerpad.h"
|
||||||
|
#include "snesadapter.h"
|
||||||
#include "suborkey.h"
|
#include "suborkey.h"
|
||||||
#include "zapper.h"
|
#include "zapper.h"
|
||||||
|
|
||||||
@ -182,6 +183,7 @@ void nes_control_port1_devices(device_slot_interface &device)
|
|||||||
device.option_add("zapper", NES_ZAPPER);
|
device.option_add("zapper", NES_ZAPPER);
|
||||||
device.option_add("4score_p1p3", NES_4SCORE_P1P3);
|
device.option_add("4score_p1p3", NES_4SCORE_P1P3);
|
||||||
device.option_add("miracle_piano", NES_MIRACLE);
|
device.option_add("miracle_piano", NES_MIRACLE);
|
||||||
|
device.option_add("snes_adapter", NES_SNESADAPTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nes_control_port2_devices(device_slot_interface &device)
|
void nes_control_port2_devices(device_slot_interface &device)
|
||||||
@ -191,6 +193,7 @@ void nes_control_port2_devices(device_slot_interface &device)
|
|||||||
device.option_add("vaus", NES_ARKPADDLE);
|
device.option_add("vaus", NES_ARKPADDLE);
|
||||||
device.option_add("powerpad", NES_POWERPAD);
|
device.option_add("powerpad", NES_POWERPAD);
|
||||||
device.option_add("4score_p2p4", NES_4SCORE_P2P4);
|
device.option_add("4score_p2p4", NES_4SCORE_P2P4);
|
||||||
|
device.option_add("snes_adapter", NES_SNESADAPTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fc_control_port1_devices(device_slot_interface &device)
|
void fc_control_port1_devices(device_slot_interface &device)
|
||||||
|
@ -70,7 +70,7 @@ static INPUT_PORTS_START( nes_fcpad_p2 )
|
|||||||
|
|
||||||
PORT_START("MIC")
|
PORT_START("MIC")
|
||||||
PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED )
|
PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Microphone") PORT_CODE(KEYCODE_M)
|
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("%p Microphone")
|
||||||
INPUT_PORTS_END
|
INPUT_PORTS_END
|
||||||
|
|
||||||
static INPUT_PORTS_START( nes_ccpad_left )
|
static INPUT_PORTS_START( nes_ccpad_left )
|
||||||
|
72
src/devices/bus/nes_ctrl/snesadapter.cpp
Normal file
72
src/devices/bus/nes_ctrl/snesadapter.cpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:kmg
|
||||||
|
/**********************************************************************
|
||||||
|
|
||||||
|
Nintendo Family Computer & Entertainment System SNES controller port adapter
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "snesadapter.h"
|
||||||
|
// slot devices
|
||||||
|
#include "bus/snes_ctrl/joypad.h"
|
||||||
|
#include "bus/snes_ctrl/mouse.h"
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// DEVICE DEFINITIONS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
DEFINE_DEVICE_TYPE(NES_SNESADAPTER, nes_snesadapter_device, "nes_snesadapter", "SNES Controller Port Adapter")
|
||||||
|
|
||||||
|
|
||||||
|
static void snes_controllers(device_slot_interface &device)
|
||||||
|
{
|
||||||
|
device.option_add("snes_joypad", SNES_JOYPAD);
|
||||||
|
device.option_add("snes_mouse", SNES_MOUSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_add_mconfig - add device configuration
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void nes_snesadapter_device::device_add_mconfig(machine_config &config)
|
||||||
|
{
|
||||||
|
SNES_CONTROL_PORT(config, m_snesctrl, snes_controllers, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// LIVE DEVICE
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// nes_snesadapter_device - constructor
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
nes_snesadapter_device::nes_snesadapter_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||||
|
: device_t(mconfig, NES_SNESADAPTER, tag, owner, clock)
|
||||||
|
, device_nes_control_port_interface(mconfig, *this)
|
||||||
|
, m_snesctrl(*this, "port")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// read
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
u8 nes_snesadapter_device::read_bit0()
|
||||||
|
{
|
||||||
|
return m_snesctrl->read_pin4();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// write
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void nes_snesadapter_device::write(u8 data)
|
||||||
|
{
|
||||||
|
m_snesctrl->write_strobe(data);
|
||||||
|
}
|
46
src/devices/bus/nes_ctrl/snesadapter.h
Normal file
46
src/devices/bus/nes_ctrl/snesadapter.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:kmg
|
||||||
|
/**********************************************************************
|
||||||
|
|
||||||
|
Nintendo Family Computer & Entertainment System SNES controller port adapter
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#ifndef MAME_BUS_NES_CTRL_SNESADAPTER_H
|
||||||
|
#define MAME_BUS_NES_CTRL_SNESADAPTER_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ctrl.h"
|
||||||
|
#include "bus/snes_ctrl/ctrl.h"
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// TYPE DEFINITIONS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
// ======================> nes_snesadapter_device
|
||||||
|
|
||||||
|
class nes_snesadapter_device : public device_t, public device_nes_control_port_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// construction/destruction
|
||||||
|
nes_snesadapter_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// device-level overrides
|
||||||
|
virtual void device_start() override { }
|
||||||
|
virtual void device_add_mconfig(machine_config &config) override;
|
||||||
|
|
||||||
|
virtual u8 read_bit0() override;
|
||||||
|
virtual void write(u8 data) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
required_device<snes_control_port_device> m_snesctrl;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// device type definition
|
||||||
|
DECLARE_DEVICE_TYPE(NES_SNESADAPTER, nes_snesadapter_device)
|
||||||
|
|
||||||
|
#endif // MAME_BUS_NES_CTRL_SNESADAPTER_H
|
@ -18,18 +18,18 @@ DEFINE_DEVICE_TYPE(SNES_JOYPAD, snes_joypad_device, "snes_joypad", "Nintendo SNE
|
|||||||
|
|
||||||
static INPUT_PORTS_START( snes_joypad )
|
static INPUT_PORTS_START( snes_joypad )
|
||||||
PORT_START("JOYPAD")
|
PORT_START("JOYPAD")
|
||||||
PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("B")
|
PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("%p B")
|
||||||
PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Y")
|
PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("%p Y")
|
||||||
PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Select")
|
PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_SELECT )
|
||||||
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Start")
|
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_START )
|
||||||
PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
|
PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
|
||||||
PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
|
PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
|
||||||
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
|
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
|
||||||
PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
|
PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
|
||||||
PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("A")
|
PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("%p A")
|
||||||
PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("X")
|
PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("%p X")
|
||||||
PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("L")
|
PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("%p L")
|
||||||
PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("R")
|
PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("%p R")
|
||||||
PORT_BIT( 0xf000, IP_ACTIVE_HIGH, IPT_UNUSED )
|
PORT_BIT( 0xf000, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||||
INPUT_PORTS_END
|
INPUT_PORTS_END
|
||||||
|
|
||||||
|
@ -31,11 +31,11 @@ static INPUT_PORTS_START( snes_mouse )
|
|||||||
// due to the relative nature of movement detection in SNES mouse, when we wrap the system would
|
// due to the relative nature of movement detection in SNES mouse, when we wrap the system would
|
||||||
// detect a sudden jump in the wrong direction, making the usage unfriendly...
|
// detect a sudden jump in the wrong direction, making the usage unfriendly...
|
||||||
PORT_START("MOUSE_X")
|
PORT_START("MOUSE_X")
|
||||||
PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_NAME("Superscope X Axis") PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
|
PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_NAME("Mouse X Axis") PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
|
||||||
// PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
|
// PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
|
||||||
|
|
||||||
PORT_START("MOUSE_Y")
|
PORT_START("MOUSE_Y")
|
||||||
PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_Y) PORT_NAME("Superscope Y Axis") PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
|
PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_Y) PORT_NAME("Mouse Y Axis") PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
|
||||||
// PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
|
// PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
|
||||||
INPUT_PORTS_END
|
INPUT_PORTS_END
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user