From d464f337726f9e0d33b4dc45c0cff668e78c572e Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 17 Dec 2022 07:56:52 +1100 Subject: bus/sms_ctrl: Added Konami Hyper Shot for Sega, too. --- scripts/src/bus.lua | 2 + src/devices/bus/msx/ctrl/hypershot.cpp | 4 +- src/devices/bus/sms_ctrl/controllers.cpp | 4 ++ src/devices/bus/sms_ctrl/controllers.h | 1 + src/devices/bus/sms_ctrl/hypershot.cpp | 66 ++++++++++++++++++++++++++++++++ src/devices/bus/sms_ctrl/hypershot.h | 18 +++++++++ 6 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 src/devices/bus/sms_ctrl/hypershot.cpp create mode 100644 src/devices/bus/sms_ctrl/hypershot.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 6c570865c64..e2d290b55d3 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -3549,6 +3549,8 @@ if (BUSES["SMS_CTRL"]~=null) then MAME_DIR .. "src/devices/bus/sms_ctrl/controllers.h", MAME_DIR .. "src/devices/bus/sms_ctrl/diypaddle.cpp", MAME_DIR .. "src/devices/bus/sms_ctrl/diypaddle.h", + MAME_DIR .. "src/devices/bus/sms_ctrl/hypershot.cpp", + MAME_DIR .. "src/devices/bus/sms_ctrl/hypershot.h", MAME_DIR .. "src/devices/bus/sms_ctrl/graphic.cpp", MAME_DIR .. "src/devices/bus/sms_ctrl/graphic.h", MAME_DIR .. "src/devices/bus/sms_ctrl/joypad.cpp", diff --git a/src/devices/bus/msx/ctrl/hypershot.cpp b/src/devices/bus/msx/ctrl/hypershot.cpp index f14f25c237e..f70418a7f99 100644 --- a/src/devices/bus/msx/ctrl/hypershot.cpp +++ b/src/devices/bus/msx/ctrl/hypershot.cpp @@ -25,8 +25,8 @@ namespace { INPUT_PORTS_START(hypershot) PORT_START("BUTTONS") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("%p Run") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("%p Jump") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("%p Run") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("%p Jump") INPUT_PORTS_END diff --git a/src/devices/bus/sms_ctrl/controllers.cpp b/src/devices/bus/sms_ctrl/controllers.cpp index b7c6057684a..43e7c63dcc7 100644 --- a/src/devices/bus/sms_ctrl/controllers.cpp +++ b/src/devices/bus/sms_ctrl/controllers.cpp @@ -17,6 +17,7 @@ #include "controllers.h" #include "diypaddle.h" +#include "hypershot.h" #include "graphic.h" #include "joypad.h" #include "lphaser.h" @@ -33,6 +34,7 @@ char const *const SMS_CTRL_OPTION_DIY_PADDLE = "diypaddle"; +char const *const SMS_CTRL_OPTION_HYPERSHOT = "hypershot"; char const *const SMS_CTRL_OPTION_GRAPHIC = "graphic"; char const *const SMS_CTRL_OPTION_LPHASER = "lphaser"; char const *const SMS_CTRL_OPTION_MD_6BUTTON = "md6button"; @@ -53,6 +55,7 @@ char const *const SMS_CTRL_OPTION_TEAM_PLAYER = "teamplay"; void sms_control_port_devices(device_slot_interface &device) { device.option_add(SMS_CTRL_OPTION_DIY_PADDLE, SMS_DIY_PADDLE); + device.option_add(SMS_CTRL_OPTION_HYPERSHOT, SMS_HYPERSHOT); device.option_add(SMS_CTRL_OPTION_GRAPHIC, SMS_GRAPHIC); device.option_add(SMS_CTRL_OPTION_LPHASER, SMS_LIGHT_PHASER); device.option_add(SMS_CTRL_OPTION_MD_6BUTTON, SMS_MD6BUTTON); @@ -72,5 +75,6 @@ void sms_control_port_devices(device_slot_interface &device) void sms_control_port_passive_devices(device_slot_interface &device) { + device.option_add(SMS_CTRL_OPTION_HYPERSHOT, SMS_HYPERSHOT); device.option_add(SMS_CTRL_OPTION_JOYPAD, SMS_JOYPAD); } diff --git a/src/devices/bus/sms_ctrl/controllers.h b/src/devices/bus/sms_ctrl/controllers.h index d4f92beef09..67868790831 100644 --- a/src/devices/bus/sms_ctrl/controllers.h +++ b/src/devices/bus/sms_ctrl/controllers.h @@ -12,6 +12,7 @@ extern char const *const SMS_CTRL_OPTION_DIY_PADDLE; +extern char const *const SMS_CTRL_OPTION_HYPERSHOT; extern char const *const SMS_CTRL_OPTION_GRAPHIC; extern char const *const SMS_CTRL_OPTION_LPHASER; extern char const *const SMS_CTRL_OPTION_MD_6BUTTON; diff --git a/src/devices/bus/sms_ctrl/hypershot.cpp b/src/devices/bus/sms_ctrl/hypershot.cpp new file mode 100644 index 00000000000..53356eed2a9 --- /dev/null +++ b/src/devices/bus/sms_ctrl/hypershot.cpp @@ -0,0 +1,66 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/********************************************************************** + + Konami JE 502/JE 503 Hyper Shot emulation + + Very simple controller with two buttons. RUN is connected to + both right and down, and JUMP is connected to TL. Symmetrical + case allows use with either button to the left. + + Known versions: + * JE 502 original Japanese version, metal case + * JE 503 cost-reduced Japanese version, plastic case + * JE 503-X02 cost-reduced export version, plastic case + +**********************************************************************/ + +#include "emu.h" +#include "hypershot.h" + + +namespace { + +INPUT_PORTS_START( sms_hypershot ) + PORT_START("BUTTONS") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("%p Run") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("%p Jump") +INPUT_PORTS_END + + + +class sms_hypershot_device : public device_t, public device_sms_control_interface +{ +public: + sms_hypershot_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + + virtual u8 in_r() override; + +protected: + virtual ioport_constructor device_input_ports() const override { return INPUT_PORTS_NAME(sms_hypershot); } + virtual void device_start() override { } + +private: + required_ioport m_buttons; +}; + + +sms_hypershot_device::sms_hypershot_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) : + device_t(mconfig, SMS_HYPERSHOT, tag, owner, clock), + device_sms_control_interface(mconfig, *this), + m_buttons(*this, "BUTTONS") +{ +} + + +u8 sms_hypershot_device::in_r() +{ + u8 const inputs = m_buttons->read(); + return 0x25 | (BIT(inputs, 1) << 4) | (BIT(inputs, 0) ? 0x0a : 0x00); +} + +} // anonymous namespace + + + +DEFINE_DEVICE_TYPE_PRIVATE(SMS_HYPERSHOT, device_sms_control_interface, sms_hypershot_device, "sms_hypershot", "Konami Hyper Shot (JE 502/JE 503, Sega)") diff --git a/src/devices/bus/sms_ctrl/hypershot.h b/src/devices/bus/sms_ctrl/hypershot.h new file mode 100644 index 00000000000..f6ee4131131 --- /dev/null +++ b/src/devices/bus/sms_ctrl/hypershot.h @@ -0,0 +1,18 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/********************************************************************** + + Konami JE 502/JE 503 Hyper Shot emulation + +**********************************************************************/ +#ifndef MAME_BUS_SMS_CTRL_HYPERSHOT_H +#define MAME_BUS_SMS_CTRL_HYPERSHOT_H + +#pragma once + +#include "smsctrl.h" + + +DECLARE_DEVICE_TYPE(SMS_HYPERSHOT, device_sms_control_interface) + +#endif // MAME_BUS_SMS_CTRL_HYPERSHOT_H -- cgit v1.2.3