From 451bd0731c33a24d597cf094b57efc690ec63607 Mon Sep 17 00:00:00 2001 From: etabeta78 Date: Fri, 9 Jan 2015 23:01:40 +0100 Subject: ioport: added a PORT_DEVICE flag to identify inputs of any kind which are connected to a device different from the root_device. these are the dynamical inputs and it might be useful to be able to catch them without performing a string comparison of the device tag against the root_device one. [Fabio Priuli] ui: start displaying the device tag close to input names for the dynamical inputs which use PORT_DEVICE, so to avoid some weird quirks in the input menus when slot devices are modified. [Fabio Priuli] out of whatsnew: for testing purposes I have added PORT_DEVICE only to serial inputs (bus/rs232) and SMS controllers (bus/smsctrl). if you want to test these with slot devices of a driver you are more familiar with, just add the macro to the inputs you want to test. note: it is under discussion whether PORT_DEVICE is in fact useful, or if a string comparison for each input port is not too costly in terms of performances and thus enough for our scopes... we will see the result of the discussion, but in any case it will remain possible to match the sets of inputs with their device :) --- src/emu/bus/rs232/rs232.h | 10 +++++----- src/emu/bus/rs232/ser_mouse.c | 10 +++++----- src/emu/bus/sms_ctrl/graphic.c | 10 +++++----- src/emu/bus/sms_ctrl/joypad.c | 16 ++++++++-------- src/emu/bus/sms_ctrl/lphaser.c | 8 ++++---- src/emu/bus/sms_ctrl/paddle.c | 8 ++++---- src/emu/bus/sms_ctrl/rfu.c | 2 +- src/emu/bus/sms_ctrl/sports.c | 14 +++++++------- src/emu/bus/sms_ctrl/sportsjp.c | 10 +++++----- src/emu/ioport.h | 22 ++++++++++++++-------- src/emu/ui/miscmenu.c | 33 ++++++++++++++++++++++++++------- src/emu/ui/miscmenu.h | 1 + 12 files changed, 85 insertions(+), 59 deletions(-) diff --git a/src/emu/bus/rs232/rs232.h b/src/emu/bus/rs232/rs232.h index a7df88e0700..5ca961ee9bd 100644 --- a/src/emu/bus/rs232/rs232.h +++ b/src/emu/bus/rs232/rs232.h @@ -41,7 +41,7 @@ #define MCFG_RS232_BAUD(_tag, _default_baud, _description, _class, _write_line) \ PORT_START(_tag) \ - PORT_CONFNAME(0xff, _default_baud, _description) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \ + PORT_CONFNAME(0xff, _default_baud, _description) PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \ PORT_CONFSETTING( RS232_BAUD_110, "110") \ PORT_CONFSETTING( RS232_BAUD_150, "150") \ PORT_CONFSETTING( RS232_BAUD_300, "300") \ @@ -62,7 +62,7 @@ #define MCFG_RS232_STARTBITS(_tag, _default_startbits, _description, _class, _write_line) \ PORT_START(_tag) \ - PORT_CONFNAME(0xff, _default_startbits, _description) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \ + PORT_CONFNAME(0xff, _default_startbits, _description) PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \ PORT_CONFSETTING( RS232_STARTBITS_0, "0") \ PORT_CONFSETTING( RS232_STARTBITS_1, "1") @@ -73,7 +73,7 @@ #define MCFG_RS232_DATABITS(_tag, _default_databits, _description, _class, _write_line) \ PORT_START(_tag) \ - PORT_CONFNAME(0xff, _default_databits, _description) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \ + PORT_CONFNAME(0xff, _default_databits, _description) PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \ PORT_CONFSETTING( RS232_DATABITS_5, "5") \ PORT_CONFSETTING( RS232_DATABITS_6, "6") \ PORT_CONFSETTING( RS232_DATABITS_7, "7") \ @@ -87,7 +87,7 @@ #define MCFG_RS232_PARITY(_tag, _default_parity, _description, _class, _write_line) \ PORT_START(_tag) \ - PORT_CONFNAME(0xff, _default_parity, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \ + PORT_CONFNAME(0xff, _default_parity, "Parity") PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \ PORT_CONFSETTING( RS232_PARITY_NONE, "None") \ PORT_CONFSETTING( RS232_PARITY_ODD, "Odd") \ PORT_CONFSETTING( RS232_PARITY_EVEN, "Even") \ @@ -101,7 +101,7 @@ #define MCFG_RS232_STOPBITS(_tag, _default_stopbits, _description, _class, _write_line) \ PORT_START(_tag) \ - PORT_CONFNAME(0xff, 0x01, _description) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \ + PORT_CONFNAME(0xff, 0x01, _description) PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \ PORT_CONFSETTING( RS232_STOPBITS_0, "0") \ PORT_CONFSETTING( RS232_STOPBITS_1, "1") \ PORT_CONFSETTING( RS232_STOPBITS_1_5, "1.5") \ diff --git a/src/emu/bus/rs232/ser_mouse.c b/src/emu/bus/rs232/ser_mouse.c index 823cf732607..c1b22769398 100644 --- a/src/emu/bus/rs232/ser_mouse.c +++ b/src/emu/bus/rs232/ser_mouse.c @@ -246,15 +246,15 @@ WRITE_LINE_MEMBER(microsoft_mouse_device::input_rts) static INPUT_PORTS_START( ser_mouse ) PORT_START( "ser_mouse_btn" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_DEVICE PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_DEVICE PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_DEVICE PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2) PORT_START( "ser_mouse_x" ) /* Mouse - X AXIS */ - PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_DEVICE PORT_SENSITIVITY(100) PORT_DEVICE PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_START( "ser_mouse_y" ) /* Mouse - Y AXIS */ - PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_DEVICE PORT_SENSITIVITY(100) PORT_DEVICE PORT_KEYDELTA(0) PORT_PLAYER(1) INPUT_PORTS_END ioport_constructor serial_mouse_device::device_input_ports() const diff --git a/src/emu/bus/sms_ctrl/graphic.c b/src/emu/bus/sms_ctrl/graphic.c index a04b9c59473..527d8688f3b 100644 --- a/src/emu/bus/sms_ctrl/graphic.c +++ b/src/emu/bus/sms_ctrl/graphic.c @@ -46,16 +46,16 @@ const device_type SMS_GRAPHIC = &device_creator; static INPUT_PORTS_START( sms_graphic ) PORT_START("BUTTONS") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) // MENU - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) // DO - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) // PEN + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // MENU + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_DEVICE // DO + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_DEVICE // PEN PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("X") - PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) + PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_X) PORT_DEVICE PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_START("Y") - PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) + PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_Y) PORT_DEVICE PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) INPUT_PORTS_END diff --git a/src/emu/bus/sms_ctrl/joypad.c b/src/emu/bus/sms_ctrl/joypad.c index 578fd2054ae..34f49cd80ae 100644 --- a/src/emu/bus/sms_ctrl/joypad.c +++ b/src/emu/bus/sms_ctrl/joypad.c @@ -20,14 +20,14 @@ const device_type SMS_JOYPAD = &device_creator; static INPUT_PORTS_START( sms_joypad ) PORT_START("JOYPAD") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // TH - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) // TR + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_DEVICE + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_DEVICE + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_DEVICE + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_DEVICE + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // TL + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // TH + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_DEVICE // TR INPUT_PORTS_END diff --git a/src/emu/bus/sms_ctrl/lphaser.c b/src/emu/bus/sms_ctrl/lphaser.c index 8736657cae6..696f4ff90eb 100644 --- a/src/emu/bus/sms_ctrl/lphaser.c +++ b/src/emu/bus/sms_ctrl/lphaser.c @@ -38,15 +38,15 @@ INPUT_CHANGED_MEMBER( sms_light_phaser_device::position_changed ) static INPUT_PORTS_START( sms_light_phaser ) PORT_START("CTRL_PORT") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL (trigger) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_light_phaser_device, th_pin_r, NULL) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // TL (trigger) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_light_phaser_device, th_pin_r, NULL) PORT_BIT( 0x9f, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("LPHASER_X") - PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_CHANGED_MEMBER(DEVICE_SELF, sms_light_phaser_device, position_changed, 0) + PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_X) PORT_DEVICE PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_CHANGED_MEMBER(DEVICE_SELF, sms_light_phaser_device, position_changed, 0) PORT_START("LPHASER_Y") - PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_CHANGED_MEMBER(DEVICE_SELF, sms_light_phaser_device, position_changed, 0) + PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_Y) PORT_DEVICE PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_CHANGED_MEMBER(DEVICE_SELF, sms_light_phaser_device, position_changed, 0) INPUT_PORTS_END diff --git a/src/emu/bus/sms_ctrl/paddle.c b/src/emu/bus/sms_ctrl/paddle.c index affe7456ab3..176c537a02f 100644 --- a/src/emu/bus/sms_ctrl/paddle.c +++ b/src/emu/bus/sms_ctrl/paddle.c @@ -42,14 +42,14 @@ CUSTOM_INPUT_MEMBER( sms_paddle_device::tr_pin_r ) static INPUT_PORTS_START( sms_paddle ) PORT_START("CTRL_PORT") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, dir_pins_r, NULL) // Directional pins + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, dir_pins_r, NULL) // Directional pins PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // TL PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // TH - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, tr_pin_r, NULL) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, tr_pin_r, NULL) PORT_START("PADDLE_X") // Paddle knob - PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) + PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_DEVICE PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) INPUT_PORTS_END diff --git a/src/emu/bus/sms_ctrl/rfu.c b/src/emu/bus/sms_ctrl/rfu.c index c04ca1f8a84..d00376f0b37 100644 --- a/src/emu/bus/sms_ctrl/rfu.c +++ b/src/emu/bus/sms_ctrl/rfu.c @@ -23,7 +23,7 @@ const device_type SMS_RAPID_FIRE = &device_creator; static INPUT_PORTS_START( sms_rapid_fire ) PORT_START("rfu_sw") // Rapid Fire Unit switches - PORT_CONFNAME( 0x03, 0x00, "Rapid Fire Unit" ) + PORT_CONFNAME( 0x03, 0x00, "Rapid Fire Unit" ) PORT_DEVICE PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x01, "Button 1" ) PORT_CONFSETTING( 0x02, "Button 2" ) diff --git a/src/emu/bus/sms_ctrl/sports.c b/src/emu/bus/sms_ctrl/sports.c index 81bf836dd8e..a173f2d8ca4 100644 --- a/src/emu/bus/sms_ctrl/sports.c +++ b/src/emu/bus/sms_ctrl/sports.c @@ -71,24 +71,24 @@ INPUT_CHANGED_MEMBER( sms_sports_pad_device::th_pin_w ) static INPUT_PORTS_START( sms_sports_pad ) PORT_START("SPORTS_IN") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_device, dir_pins_r, NULL) // Directional pins + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_device, dir_pins_r, NULL) // Directional pins PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL (Button 1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_r, NULL) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) // TR (Button 2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // TL (Button 1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_r, NULL) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_DEVICE // TR (Button 2) PORT_START("SPORTS_OUT") PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) // Directional pins PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // TL (Button 1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_CHANGED_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_w, NULL) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_DEVICE PORT_CHANGED_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_w, NULL) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // TR (Button 2) PORT_START("SPORTS_X") /* Sports Pad X axis */ - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_START("SPORTS_Y") /* Sports Pad Y axis */ - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE INPUT_PORTS_END diff --git a/src/emu/bus/sms_ctrl/sportsjp.c b/src/emu/bus/sms_ctrl/sportsjp.c index 4fc166ccd3d..30333604cc1 100644 --- a/src/emu/bus/sms_ctrl/sportsjp.c +++ b/src/emu/bus/sms_ctrl/sportsjp.c @@ -53,17 +53,17 @@ DECLARE_CUSTOM_INPUT_MEMBER( sms_sports_pad_jp_device::dir_pins_r ) static INPUT_PORTS_START( sms_sports_pad_jp ) PORT_START("SPORTS_JP_IN") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_jp_device, dir_pins_r, NULL) // Directional pins + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_jp_device, dir_pins_r, NULL) // Directional pins PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL (Button 1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // TL (Button 1) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // TH - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) // TR (Button 2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_DEVICE // TR (Button 2) PORT_START("SPORTS_JP_X") /* Sports Pad X axis */ - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_START("SPORTS_JP_Y") /* Sports Pad Y axis */ - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40) INPUT_PORTS_END diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 06bc98d759d..831c5232d60 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -992,14 +992,15 @@ class ioport_field friend class dynamic_field; // flags for ioport_fields - static const int FIELD_FLAG_UNUSED = 0x01; // set if this field is unused but relevant to other games on the same hw - static const int FIELD_FLAG_COCKTAIL = 0x02; // set if this field is relevant only for cocktail cabinets - static const int FIELD_FLAG_TOGGLE = 0x04; // set if this field should behave as a toggle - static const int FIELD_FLAG_ROTATED = 0x08; // set if this field represents a rotated control - static const int ANALOG_FLAG_REVERSE = 0x10; // analog only: reverse the sense of the axis - static const int ANALOG_FLAG_RESET = 0x20; // analog only: always preload in->default for relative axes, returning only deltas - static const int ANALOG_FLAG_WRAPS = 0x40; // analog only: positional count wraps around - static const int ANALOG_FLAG_INVERT = 0x80; // analog only: bitwise invert bits + static const int FIELD_FLAG_UNUSED = 0x0001; // set if this field is unused but relevant to other games on the same hw + static const int FIELD_FLAG_COCKTAIL = 0x0002; // set if this field is relevant only for cocktail cabinets + static const int FIELD_FLAG_TOGGLE = 0x0004; // set if this field should behave as a toggle + static const int FIELD_FLAG_ROTATED = 0x0008; // set if this field represents a rotated control + static const int FIELD_FLAG_DEVICE = 0x0010; // set if this field is used only in a device + static const int ANALOG_FLAG_REVERSE = 0x0020; // analog only: reverse the sense of the axis + static const int ANALOG_FLAG_RESET = 0x0040; // analog only: always preload in->default for relative axes, returning only deltas + static const int ANALOG_FLAG_WRAPS = 0x0080; // analog only: positional count wraps around + static const int ANALOG_FLAG_INVERT = 0x0100; // analog only: bitwise invert bits public: // construction/destruction @@ -1027,6 +1028,7 @@ public: bool cocktail() const { return ((m_flags & FIELD_FLAG_COCKTAIL) != 0); } bool toggle() const { return ((m_flags & FIELD_FLAG_TOGGLE) != 0); } bool rotated() const { return ((m_flags & FIELD_FLAG_ROTATED) != 0); } + bool used_in_device() const { return ((m_flags & FIELD_FLAG_DEVICE) != 0); } bool analog_reverse() const { return ((m_flags & ANALOG_FLAG_REVERSE) != 0); } bool analog_reset() const { return ((m_flags & ANALOG_FLAG_RESET) != 0); } bool analog_wraps() const { return ((m_flags & ANALOG_FLAG_WRAPS) != 0); } @@ -1489,6 +1491,7 @@ public: void field_set_way(int way) const { m_curfield->m_way = way; } void field_set_rotated() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_ROTATED; } void field_set_name(const char *name) const { m_curfield->m_name = string_from_token(name); } + void field_set_device() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_DEVICE; } void field_set_player(int player) const { m_curfield->m_player = player - 1; } void field_set_cocktail() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_COCKTAIL; field_set_player(2); } void field_set_toggle() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_TOGGLE; } @@ -1624,6 +1627,9 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, a #define PORT_NAME(_name) \ configurer.field_set_name(_name); +#define PORT_DEVICE \ + configurer.field_set_device(); + #define PORT_PLAYER(_player) \ configurer.field_set_player(_player); diff --git a/src/emu/ui/miscmenu.c b/src/emu/ui/miscmenu.c index efacccb92af..b304a7f47a6 100644 --- a/src/emu/ui/miscmenu.c +++ b/src/emu/ui/miscmenu.c @@ -510,6 +510,7 @@ void ui_menu_input_general::populate() item->sortorder = sortorder * 4 + suborder[seqtype]; item->type = ioport_manager::type_is_analog(entry->type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; item->name = entry->name(); + item->owner_name = NULL; item->next = itemlist; itemlist = item; @@ -583,6 +584,7 @@ void ui_menu_input_specific::populate() item->sortorder = sortorder + suborder[seqtype]; item->type = field->is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; item->name = name; + item->owner_name = field->used_in_device() ? (field->device().tag() + 1) : NULL; item->next = itemlist; itemlist = item; @@ -789,7 +791,13 @@ void ui_menu_input::populate_and_sort(input_item_data *itemlist) /* generate the name of the item itself, based off the base name and the type */ item = itemarray[curitem]; assert(nameformat[item->type] != NULL); - text.printf(nameformat[item->type], item->name); + if (item->owner_name) + { + text.printf("[%s] ", item->owner_name); + text.catprintf(nameformat[item->type], item->name); + } + else + text.printf(nameformat[item->type], item->name); /* if we're polling this item, use some spaces with left/right arrows */ if (pollingref == item->ref) @@ -921,6 +929,7 @@ void ui_menu_settings::populate() if (field->type() == type && field->enabled()) { UINT32 flags = 0; + astring name; /* set the left/right flags appropriately */ if (field->has_previous_setting()) @@ -929,7 +938,12 @@ void ui_menu_settings::populate() flags |= MENU_FLAG_RIGHT_ARROW; /* add the menu item */ - item_append(field->name(), field->setting_name(), flags, (void *)field); + if (field->used_in_device()) + name.cpy("[").cat(field->device().tag() + 1).cat("] ").cat(field->name()); + else + name.cpy(field->name()); + + item_append(name.cstr(), field->setting_name(), flags, (void *)field); /* for DIP switches, build up the model */ if (type == IPT_DIPSWITCH && field->first_diplocation() != NULL) @@ -1217,7 +1231,12 @@ void ui_menu_analog::populate() { analog_item_data *data; UINT32 flags = 0; - + astring name; + if (field->used_in_device()) + name.cpy("[").cat(field->device().tag() + 1).cat("] ").cat(field->name()); + else + name.cpy(field->name()); + /* allocate a data item for tracking what this menu item refers to */ data = (analog_item_data *)m_pool_alloc(sizeof(*data)); data->field = field; @@ -1228,7 +1247,7 @@ void ui_menu_analog::populate() { default: case ANALOG_ITEM_KEYSPEED: - text.printf("%s Digital Speed", field->name()); + text.printf("%s Digital Speed", name.cstr()); subtext.printf("%d", settings.delta); data->min = 0; data->max = 255; @@ -1237,7 +1256,7 @@ void ui_menu_analog::populate() break; case ANALOG_ITEM_CENTERSPEED: - text.printf("%s Autocenter Speed", field->name()); + text.printf("%s Autocenter Speed", name.cstr()); subtext.printf("%d", settings.centerdelta); data->min = 0; data->max = 255; @@ -1246,7 +1265,7 @@ void ui_menu_analog::populate() break; case ANALOG_ITEM_REVERSE: - text.printf("%s Reverse", field->name()); + text.printf("%s Reverse", name.cstr()); subtext.cpy(settings.reverse ? "On" : "Off"); data->min = 0; data->max = 1; @@ -1255,7 +1274,7 @@ void ui_menu_analog::populate() break; case ANALOG_ITEM_SENSITIVITY: - text.printf("%s Sensitivity", field->name()); + text.printf("%s Sensitivity", name.cstr()); subtext.printf("%d", settings.sensitivity); data->min = 1; data->max = 255; diff --git a/src/emu/ui/miscmenu.h b/src/emu/ui/miscmenu.h index cb4d8fb2f24..717236335b9 100644 --- a/src/emu/ui/miscmenu.h +++ b/src/emu/ui/miscmenu.h @@ -81,6 +81,7 @@ protected: input_seq seq; /* copy of the live sequence */ const input_seq * defseq; /* pointer to the default sequence */ const char * name; /* pointer to the base name of the item */ + const char * owner_name; /* pointer to the name of the owner of the item */ UINT16 sortorder; /* sorting information */ UINT8 type; /* type of port */ }; -- cgit v1.2.3