bus/nes_ctrl: Updated mahjong controller based on hardware info. (#9024)

* bus/nes_ctrl: Updated mahjong controller base on hardware info.
- Fixed reversed Start and Select buttons.
- Added more labels to the multi-use buttons.

* emu/inpttype.ipp: Added player 3 and player 4 mahjong input types.
This commit is contained in:
0kmg 2021-12-21 10:21:40 -09:00 committed by GitHub
parent 860292661b
commit c76d2b2cb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 123 additions and 46 deletions

View File

@ -17728,7 +17728,7 @@ license:CC0
</part>
</software>
<software name="ideyumj1" cloneof="ideyumj">
<software name="ideyomj1" cloneof="ideyomj">
<description>Ide Yousuke Meijin no Jissen Mahjong (Jpn)</description>
<year>1987</year>
<publisher>Capcom</publisher>
@ -17750,7 +17750,7 @@ license:CC0
</part>
</software>
<software name="ideyumj">
<software name="ideyomj">
<description>Ide Yousuke Meijin no Jissen Mahjong (Jpn, Rev. A)</description>
<year>1987</year>
<publisher>Capcom</publisher>
@ -17772,7 +17772,7 @@ license:CC0
</part>
</software>
<software name="ideyumj2">
<software name="ideyomj2">
<description>Ide Yousuke Meijin no Jissen Mahjong II (Jpn)</description>
<year>1991</year>
<publisher>Capcom</publisher>
@ -17784,6 +17784,7 @@ license:CC0
<feature name="slot" value="sxrom" />
<feature name="pcb" value="HVC-SNROM" />
<feature name="mmc1_type" value="MMC1B2" />
<feature name="peripheral" value="mjcontroller" />
<dataarea name="prg" size="262144">
<rom name="cap-2q-0 prg" size="262144" crc="7b44fb2a" sha1="5f04d72eb14a0014e44c2875f705c62913538e42" offset="00000" />
</dataarea>

View File

@ -218,7 +218,7 @@ void fc_expansion_devices(device_slot_interface &device)
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);
device.option_add("mahjong", NES_MJPANEL);
device.option_add("pachinko", NES_PACHINKO);
device.option_add("partytap", NES_PARTYTAP);
device.option_add("hori_twin", NES_HORITWIN);

View File

@ -2,7 +2,14 @@
// copyright-holders:Fabio Priuli
/**********************************************************************
Nintendo Family Computer Mahjong Panel
Nintendo Family Computer Capcom Mahjong Controller
There are two versions of this controller, one packed with the 1st
and 2nd Ide Yousoku Meijin no Jissen Mahjong, respectively. Both
have the original game's serial "CAP-IM" on back. Controller serials
HC-01 or HC-02 appear on revisions of the 1st game's controller.
HC-01 also appears on the 2nd game's controller. At least one
version of the original controller has a PCB marked 0827-06 HORI.
**********************************************************************/
@ -13,7 +20,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(NES_MJPANEL, nes_mjpanel_device, "nes_mjpanel", "Famicom Mahjong Panel")
DEFINE_DEVICE_TYPE(NES_MJPANEL, nes_mjpanel_device, "nes_mjpanel", "Capcom Mahjong Controller")
static INPUT_PORTS_START( nes_mjpanel )
@ -22,17 +29,17 @@ static INPUT_PORTS_START( nes_mjpanel )
PORT_START("MJPANEL.1")
PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_N )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_M )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_N ) PORT_NAME("%p Mahjong N / Circle")
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_M ) PORT_NAME("%p Mahjong M / Square")
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_L )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_K )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_MAHJONG_J )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_I )
PORT_START("MJPANEL.2")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_H )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_G )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_F )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_H ) PORT_NAME("%p Mahjong H / Right")
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_G ) PORT_NAME("%p Mahjong G / Up")
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_F ) PORT_NAME("%p Mahjong F / Left")
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_E )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_D )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_C )
@ -45,9 +52,9 @@ static INPUT_PORTS_START( nes_mjpanel )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_CHI )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_PON )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_KAN )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Mahjong Select")
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Mahjong Start")
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_KAN ) PORT_NAME("%p Mahjong Kan / Right")
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("%p Start / Down")
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("%p Select / Left")
INPUT_PORTS_END
@ -70,11 +77,12 @@ ioport_constructor nes_mjpanel_device::device_input_ports() const
// nes_mjpanel_device - constructor
//-------------------------------------------------
nes_mjpanel_device::nes_mjpanel_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
nes_mjpanel_device::nes_mjpanel_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, NES_MJPANEL, tag, owner, clock)
, device_nes_control_port_interface(mconfig, *this)
, m_panel(*this, "MJPANEL.%u", 0)
, m_latch(0)
, m_row(0)
{
}
@ -86,16 +94,8 @@ nes_mjpanel_device::nes_mjpanel_device(const machine_config &mconfig, const char
void nes_mjpanel_device::device_start()
{
save_item(NAME(m_latch));
}
//-------------------------------------------------
// device_reset
//-------------------------------------------------
void nes_mjpanel_device::device_reset()
{
m_latch = 0;
save_item(NAME(m_row));
save_item(NAME(m_strobe));
}
@ -103,17 +103,16 @@ void nes_mjpanel_device::device_reset()
// read
//-------------------------------------------------
uint8_t nes_mjpanel_device::read_exp(offs_t offset)
u8 nes_mjpanel_device::read_exp(offs_t offset)
{
uint8_t ret = 0;
if (offset)
u8 ret = 0;
if (offset) // $4017
{
if (m_strobe)
set_latch();
ret = (m_latch & 1) << 1;
m_latch >>= 1;
}
else
logerror("Error: Mahjong panel read from $4016\n");
return ret;
}
@ -121,13 +120,17 @@ uint8_t nes_mjpanel_device::read_exp(offs_t offset)
// write
//-------------------------------------------------
void nes_mjpanel_device::write(uint8_t data)
void nes_mjpanel_device::write(u8 data)
{
if (data & 0x01)
return;
if (data & 0xf8)
logerror("Error: Mahjong panel read with mux data %02x\n", (data & 0xfe));
else
m_latch = m_panel[(data & 0xfe) >> 1]->read();
m_row = (data >> 1) & 0x03;
if (write_strobe(data))
set_latch();
}
void nes_mjpanel_device::set_latch()
{
if (m_row)
m_latch = m_panel[m_row]->read();
else // hardware behavior of the apparently unused input row
m_latch = m_panel[1]->read() | m_panel[2]->read();
}

View File

@ -2,7 +2,7 @@
// copyright-holders:Fabio Priuli
/**********************************************************************
Nintendo Family Computer Mahjong Panel
Nintendo Family Computer Capcom Mahjong Controller
**********************************************************************/
@ -25,26 +25,27 @@ class nes_mjpanel_device : public device_t,
{
public:
// construction/destruction
nes_mjpanel_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
nes_mjpanel_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 void device_reset() override;
virtual uint8_t read_exp(offs_t offset) override;
virtual void write(uint8_t data) override;
virtual u8 read_exp(offs_t offset) override;
virtual void write(u8 data) override;
private:
void set_latch();
required_ioport_array<4> m_panel;
uint32_t m_latch;
u8 m_latch;
u8 m_row;
};
// device type definition
DECLARE_DEVICE_TYPE(NES_MJPANEL, nes_mjpanel_device)
#endif // MAME_BUS_NES_CTRL_MJPANEL_H

View File

@ -250,6 +250,39 @@ namespace {
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, SELECT, N_p("input-name", "%p Select"), input_seq(KEYCODE_7, input_seq::or_code, JOYCODE_SELECT_INDEXED(2)) ) \
CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P3_MAHJONG \
CORE_INPUT_TYPES_BEGIN(p3_mahjong) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_A, N_p("input-name", "%p Mahjong A"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_B, N_p("input-name", "%p Mahjong B"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_C, N_p("input-name", "%p Mahjong C"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_D, N_p("input-name", "%p Mahjong D"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_E, N_p("input-name", "%p Mahjong E"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_F, N_p("input-name", "%p Mahjong F"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_G, N_p("input-name", "%p Mahjong G"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_H, N_p("input-name", "%p Mahjong H"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_I, N_p("input-name", "%p Mahjong I"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_J, N_p("input-name", "%p Mahjong J"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_K, N_p("input-name", "%p Mahjong K"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_L, N_p("input-name", "%p Mahjong L"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_M, N_p("input-name", "%p Mahjong M"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_N, N_p("input-name", "%p Mahjong N"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_O, N_p("input-name", "%p Mahjong O"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_P, N_p("input-name", "%p Mahjong P"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_Q, N_p("input-name", "%p Mahjong Q"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_KAN, N_p("input-name", "%p Mahjong Kan"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_PON, N_p("input-name", "%p Mahjong Pon"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_CHI, N_p("input-name", "%p Mahjong Chi"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_REACH, N_p("input-name", "%p Mahjong Reach"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_RON, N_p("input-name", "%p Mahjong Ron"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_FLIP_FLOP, N_p("input-name", "%p Mahjong Flip Flop"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_BET, N_p("input-name", "%p Mahjong Bet"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_SCORE, N_p("input-name", "%p Mahjong Take Score"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_DOUBLE_UP, N_p("input-name", "%p Mahjong Double Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_BIG, N_p("input-name", "%p Mahjong Big"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_SMALL, N_p("input-name", "%p Mahjong Small"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, MAHJONG_LAST_CHANCE, N_p("input-name", "%p Mahjong Last Chance"), input_seq() ) \
CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P4 \
CORE_INPUT_TYPES_BEGIN(p4) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(KEYCODE_8_PAD, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(3)) ) \
@ -284,6 +317,39 @@ namespace {
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, SELECT, N_p("input-name", "%p Select"), input_seq(KEYCODE_8, input_seq::or_code, JOYCODE_SELECT_INDEXED(3)) ) \
CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P4_MAHJONG \
CORE_INPUT_TYPES_BEGIN(p4_mahjong) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_A, N_p("input-name", "%p Mahjong A"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_B, N_p("input-name", "%p Mahjong B"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_C, N_p("input-name", "%p Mahjong C"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_D, N_p("input-name", "%p Mahjong D"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_E, N_p("input-name", "%p Mahjong E"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_F, N_p("input-name", "%p Mahjong F"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_G, N_p("input-name", "%p Mahjong G"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_H, N_p("input-name", "%p Mahjong H"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_I, N_p("input-name", "%p Mahjong I"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_J, N_p("input-name", "%p Mahjong J"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_K, N_p("input-name", "%p Mahjong K"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_L, N_p("input-name", "%p Mahjong L"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_M, N_p("input-name", "%p Mahjong M"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_N, N_p("input-name", "%p Mahjong N"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_O, N_p("input-name", "%p Mahjong O"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_P, N_p("input-name", "%p Mahjong P"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_Q, N_p("input-name", "%p Mahjong Q"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_KAN, N_p("input-name", "%p Mahjong Kan"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_PON, N_p("input-name", "%p Mahjong Pon"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_CHI, N_p("input-name", "%p Mahjong Chi"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_REACH, N_p("input-name", "%p Mahjong Reach"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_RON, N_p("input-name", "%p Mahjong Ron"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_FLIP_FLOP, N_p("input-name", "%p Mahjong Flip Flop"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_BET, N_p("input-name", "%p Mahjong Bet"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_SCORE, N_p("input-name", "%p Mahjong Take Score"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_DOUBLE_UP, N_p("input-name", "%p Mahjong Double Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_BIG, N_p("input-name", "%p Mahjong Big"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_SMALL, N_p("input-name", "%p Mahjong Small"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, MAHJONG_LAST_CHANCE, N_p("input-name", "%p Mahjong Last Chance"), input_seq() ) \
CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P5 \
CORE_INPUT_TYPES_BEGIN(p5) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(4)) ) \
@ -920,7 +986,9 @@ CORE_INPUT_TYPES_P2
CORE_INPUT_TYPES_P2_MAHJONG
CORE_INPUT_TYPES_P2_HANAFUDA
CORE_INPUT_TYPES_P3
CORE_INPUT_TYPES_P3_MAHJONG
CORE_INPUT_TYPES_P4
CORE_INPUT_TYPES_P4_MAHJONG
CORE_INPUT_TYPES_P5
CORE_INPUT_TYPES_P6
CORE_INPUT_TYPES_P7
@ -978,7 +1046,9 @@ constexpr size_t core_input_types_count()
CORE_INPUT_TYPES_P2_MAHJONG
CORE_INPUT_TYPES_P2_HANAFUDA
CORE_INPUT_TYPES_P3
CORE_INPUT_TYPES_P3_MAHJONG
CORE_INPUT_TYPES_P4
CORE_INPUT_TYPES_P4_MAHJONG
CORE_INPUT_TYPES_P5
CORE_INPUT_TYPES_P6
CORE_INPUT_TYPES_P7
@ -1034,7 +1104,9 @@ ATTR_COLD inline void emplace_core_types(std::vector<input_type_entry> &typelist
emplace_core_types_p2_mahjong(typelist);
emplace_core_types_p2_hanafuda(typelist);
emplace_core_types_p3(typelist);
emplace_core_types_p3_mahjong(typelist);
emplace_core_types_p4(typelist);
emplace_core_types_p4_mahjong(typelist);
emplace_core_types_p5(typelist);
emplace_core_types_p6(typelist);
emplace_core_types_p7(typelist);