Previous 199869 Revisions Next

r34293 Friday 9th January, 2015 at 22:01:40 UTC by Fabio Priuli
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]ioport.h
[src/emu/bus/rs232]rs232.h ser_mouse.c
[src/emu/bus/sms_ctrl]graphic.c joypad.c lphaser.c paddle.c rfu.c sports.c sportsjp.c
[src/emu/ui]miscmenu.c miscmenu.h

trunk/src/emu/bus/rs232/rs232.h
r242804r242805
4141
4242#define MCFG_RS232_BAUD(_tag, _default_baud, _description, _class, _write_line) \
4343   PORT_START(_tag) \
44   PORT_CONFNAME(0xff, _default_baud, _description) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
44   PORT_CONFNAME(0xff, _default_baud, _description) PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
4545   PORT_CONFSETTING( RS232_BAUD_110, "110") \
4646   PORT_CONFSETTING( RS232_BAUD_150, "150") \
4747   PORT_CONFSETTING( RS232_BAUD_300, "300") \
r242804r242805
6262
6363#define MCFG_RS232_STARTBITS(_tag, _default_startbits, _description, _class, _write_line) \
6464   PORT_START(_tag) \
65   PORT_CONFNAME(0xff, _default_startbits, _description) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
65   PORT_CONFNAME(0xff, _default_startbits, _description) PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
6666   PORT_CONFSETTING( RS232_STARTBITS_0, "0") \
6767   PORT_CONFSETTING( RS232_STARTBITS_1, "1")
6868
r242804r242805
7373
7474#define MCFG_RS232_DATABITS(_tag, _default_databits, _description, _class, _write_line) \
7575   PORT_START(_tag) \
76   PORT_CONFNAME(0xff, _default_databits, _description) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
76   PORT_CONFNAME(0xff, _default_databits, _description) PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
7777   PORT_CONFSETTING( RS232_DATABITS_5, "5") \
7878   PORT_CONFSETTING( RS232_DATABITS_6, "6") \
7979   PORT_CONFSETTING( RS232_DATABITS_7, "7") \
r242804r242805
8787
8888#define MCFG_RS232_PARITY(_tag, _default_parity, _description, _class, _write_line) \
8989   PORT_START(_tag) \
90   PORT_CONFNAME(0xff, _default_parity, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
90   PORT_CONFNAME(0xff, _default_parity, "Parity") PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
9191   PORT_CONFSETTING( RS232_PARITY_NONE, "None") \
9292   PORT_CONFSETTING( RS232_PARITY_ODD, "Odd") \
9393   PORT_CONFSETTING( RS232_PARITY_EVEN, "Even") \
r242804r242805
101101
102102#define MCFG_RS232_STOPBITS(_tag, _default_stopbits, _description, _class, _write_line) \
103103   PORT_START(_tag) \
104   PORT_CONFNAME(0xff, 0x01, _description) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
104   PORT_CONFNAME(0xff, 0x01, _description) PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
105105   PORT_CONFSETTING( RS232_STOPBITS_0, "0") \
106106   PORT_CONFSETTING( RS232_STOPBITS_1, "1") \
107107   PORT_CONFSETTING( RS232_STOPBITS_1_5, "1.5") \
trunk/src/emu/bus/rs232/ser_mouse.c
r242804r242805
246246
247247static INPUT_PORTS_START( ser_mouse )
248248   PORT_START( "ser_mouse_btn" )
249   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1)
250   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3)
251   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2)
249   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_DEVICE PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1)
250   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_DEVICE PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3)
251   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_DEVICE PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2)
252252
253253   PORT_START( "ser_mouse_x" ) /* Mouse - X AXIS */
254   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
254   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_DEVICE PORT_SENSITIVITY(100) PORT_DEVICE PORT_KEYDELTA(0) PORT_PLAYER(1)
255255
256256   PORT_START( "ser_mouse_y" ) /* Mouse - Y AXIS */
257   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
257   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_DEVICE PORT_SENSITIVITY(100) PORT_DEVICE PORT_KEYDELTA(0) PORT_PLAYER(1)
258258INPUT_PORTS_END
259259
260260ioport_constructor serial_mouse_device::device_input_ports() const
trunk/src/emu/bus/sms_ctrl/graphic.c
r242804r242805
4646
4747static INPUT_PORTS_START( sms_graphic )
4848   PORT_START("BUTTONS")
49   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) // MENU
50   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) // DO
51   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) // PEN
49   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // MENU
50   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_DEVICE // DO
51   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_DEVICE // PEN
5252   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
5353
5454   PORT_START("X")
55   PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15)
55   PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_X) PORT_DEVICE PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15)
5656
5757   PORT_START("Y")
58   PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15)
58   PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_Y) PORT_DEVICE PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15)
5959INPUT_PORTS_END
6060
6161
trunk/src/emu/bus/sms_ctrl/joypad.c
r242804r242805
2020
2121static INPUT_PORTS_START( sms_joypad )
2222   PORT_START("JOYPAD")
23   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
24   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
25   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
26   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
27   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc
28   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL
29   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // TH
30   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) // TR
23   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_DEVICE
24   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_DEVICE
25   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_DEVICE
26   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_DEVICE
27   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )   // Vcc
28   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE  // TL
29   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )   // TH
30   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_DEVICE  // TR
3131INPUT_PORTS_END
3232
3333
trunk/src/emu/bus/sms_ctrl/lphaser.c
r242804r242805
3838
3939static INPUT_PORTS_START( sms_light_phaser )
4040   PORT_START("CTRL_PORT")
41   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL (trigger)
42   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_light_phaser_device, th_pin_r, NULL)
41   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // TL (trigger)
42   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_light_phaser_device, th_pin_r, NULL)
4343   PORT_BIT( 0x9f, IP_ACTIVE_LOW, IPT_UNUSED )
4444
4545   PORT_START("LPHASER_X")
46   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)
46   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)
4747
4848   PORT_START("LPHASER_Y")
49   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)
49   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)
5050INPUT_PORTS_END
5151
5252
trunk/src/emu/bus/sms_ctrl/paddle.c
r242804r242805
4242
4343static INPUT_PORTS_START( sms_paddle )
4444   PORT_START("CTRL_PORT")
45   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, dir_pins_r, NULL) // Directional pins
45   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, dir_pins_r, NULL) // Directional pins
4646   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc
47   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL
47   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // TL
4848   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // TH
49   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, tr_pin_r, NULL)
49   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, tr_pin_r, NULL)
5050
5151   PORT_START("PADDLE_X") // Paddle knob
52   PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255)
52   PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_DEVICE PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255)
5353INPUT_PORTS_END
5454
5555
trunk/src/emu/bus/sms_ctrl/rfu.c
r242804r242805
2323
2424static INPUT_PORTS_START( sms_rapid_fire )
2525   PORT_START("rfu_sw")   // Rapid Fire Unit switches
26   PORT_CONFNAME( 0x03, 0x00, "Rapid Fire Unit" )
26   PORT_CONFNAME( 0x03, 0x00, "Rapid Fire Unit" ) PORT_DEVICE
2727   PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
2828   PORT_CONFSETTING( 0x01, "Button 1" )
2929   PORT_CONFSETTING( 0x02, "Button 2" )
trunk/src/emu/bus/sms_ctrl/sports.c
r242804r242805
7171
7272static INPUT_PORTS_START( sms_sports_pad )
7373   PORT_START("SPORTS_IN")
74   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_device, dir_pins_r, NULL) // Directional pins
74   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
7575   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc
76   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL (Button 1)
77   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_r, NULL)
78   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) // TR (Button 2)
76   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // TL (Button 1)
77   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_r, NULL)
78   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_DEVICE // TR (Button 2)
7979
8080   PORT_START("SPORTS_OUT")
8181   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) // Directional pins
8282   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc
8383   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // TL (Button 1)
84   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_CHANGED_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_w, NULL)
84   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_DEVICE PORT_CHANGED_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_w, NULL)
8585   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // TR (Button 2)
8686
8787   PORT_START("SPORTS_X")    /* Sports Pad X axis */
88   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE
88   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE
8989
9090   PORT_START("SPORTS_Y")    /* Sports Pad Y axis */
91   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE
91   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE
9292INPUT_PORTS_END
9393
9494
trunk/src/emu/bus/sms_ctrl/sportsjp.c
r242804r242805
5353
5454static INPUT_PORTS_START( sms_sports_pad_jp )
5555   PORT_START("SPORTS_JP_IN")
56   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_jp_device, dir_pins_r, NULL) // Directional pins
56   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
5757   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc
58   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL (Button 1)
58   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // TL (Button 1)
5959   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )  // TH
60   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) // TR (Button 2)
60   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_DEVICE // TR (Button 2)
6161
6262   PORT_START("SPORTS_JP_X")    /* Sports Pad X axis */
63   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40)
63   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40)
6464
6565   PORT_START("SPORTS_JP_Y")    /* Sports Pad Y axis */
66   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40)
66   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40)
6767INPUT_PORTS_END
6868
6969
trunk/src/emu/ioport.h
r242804r242805
992992   friend class dynamic_field;
993993
994994   // flags for ioport_fields
995   static const int FIELD_FLAG_UNUSED = 0x01;      // set if this field is unused but relevant to other games on the same hw
996   static const int FIELD_FLAG_COCKTAIL = 0x02;    // set if this field is relevant only for cocktail cabinets
997   static const int FIELD_FLAG_TOGGLE = 0x04;      // set if this field should behave as a toggle
998   static const int FIELD_FLAG_ROTATED = 0x08;     // set if this field represents a rotated control
999   static const int ANALOG_FLAG_REVERSE = 0x10;    // analog only: reverse the sense of the axis
1000   static const int ANALOG_FLAG_RESET = 0x20;      // analog only: always preload in->default for relative axes, returning only deltas
1001   static const int ANALOG_FLAG_WRAPS = 0x40;      // analog only: positional count wraps around
1002   static const int ANALOG_FLAG_INVERT = 0x80;     // analog only: bitwise invert bits
995   static const int FIELD_FLAG_UNUSED =   0x0001;    // set if this field is unused but relevant to other games on the same hw
996   static const int FIELD_FLAG_COCKTAIL = 0x0002;    // set if this field is relevant only for cocktail cabinets
997   static const int FIELD_FLAG_TOGGLE =   0x0004;    // set if this field should behave as a toggle
998   static const int FIELD_FLAG_ROTATED =  0x0008;    // set if this field represents a rotated control
999   static const int FIELD_FLAG_DEVICE =   0x0010;    // set if this field is used only in a device
1000   static const int ANALOG_FLAG_REVERSE = 0x0020;    // analog only: reverse the sense of the axis
1001   static const int ANALOG_FLAG_RESET =   0x0040;    // analog only: always preload in->default for relative axes, returning only deltas
1002   static const int ANALOG_FLAG_WRAPS =   0x0080;    // analog only: positional count wraps around
1003   static const int ANALOG_FLAG_INVERT =  0x0100;    // analog only: bitwise invert bits
10031004
10041005public:
10051006   // construction/destruction
r242804r242805
10271028   bool cocktail() const { return ((m_flags & FIELD_FLAG_COCKTAIL) != 0); }
10281029   bool toggle() const { return ((m_flags & FIELD_FLAG_TOGGLE) != 0); }
10291030   bool rotated() const { return ((m_flags & FIELD_FLAG_ROTATED) != 0); }
1031   bool used_in_device() const { return ((m_flags & FIELD_FLAG_DEVICE) != 0); }
10301032   bool analog_reverse() const { return ((m_flags & ANALOG_FLAG_REVERSE) != 0); }
10311033   bool analog_reset() const { return ((m_flags & ANALOG_FLAG_RESET) != 0); }
10321034   bool analog_wraps() const { return ((m_flags & ANALOG_FLAG_WRAPS) != 0); }
r242804r242805
14891491   void field_set_way(int way) const { m_curfield->m_way = way; }
14901492   void field_set_rotated() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_ROTATED; }
14911493   void field_set_name(const char *name) const { m_curfield->m_name = string_from_token(name); }
1494   void field_set_device() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_DEVICE; }
14921495   void field_set_player(int player) const { m_curfield->m_player = player - 1; }
14931496   void field_set_cocktail() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_COCKTAIL; field_set_player(2); }
14941497   void field_set_toggle() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_TOGGLE; }
r242804r242805
16241627#define PORT_NAME(_name) \
16251628   configurer.field_set_name(_name);
16261629
1630#define PORT_DEVICE \
1631   configurer.field_set_device();
1632
16271633#define PORT_PLAYER(_player) \
16281634   configurer.field_set_player(_player);
16291635
trunk/src/emu/ui/miscmenu.c
r242804r242805
510510            item->sortorder = sortorder * 4 + suborder[seqtype];
511511            item->type = ioport_manager::type_is_analog(entry->type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
512512            item->name = entry->name();
513            item->owner_name = NULL;
513514            item->next = itemlist;
514515            itemlist = item;
515516
r242804r242805
583584               item->sortorder = sortorder + suborder[seqtype];
584585               item->type = field->is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
585586               item->name = name;
587               item->owner_name = field->used_in_device() ? (field->device().tag() + 1) : NULL;
586588               item->next = itemlist;
587589               itemlist = item;
588590
r242804r242805
789791      /* generate the name of the item itself, based off the base name and the type */
790792      item = itemarray[curitem];
791793      assert(nameformat[item->type] != NULL);
792      text.printf(nameformat[item->type], item->name);
794      if (item->owner_name)
795      {
796         text.printf("[%s] ", item->owner_name);
797         text.catprintf(nameformat[item->type], item->name);
798      }
799      else
800         text.printf(nameformat[item->type], item->name);
793801
794802      /* if we're polling this item, use some spaces with left/right arrows */
795803      if (pollingref == item->ref)
r242804r242805
921929         if (field->type() == type && field->enabled())
922930         {
923931            UINT32 flags = 0;
932            astring name;
924933
925934            /* set the left/right flags appropriately */
926935            if (field->has_previous_setting())
r242804r242805
929938               flags |= MENU_FLAG_RIGHT_ARROW;
930939
931940            /* add the menu item */
932            item_append(field->name(), field->setting_name(), flags, (void *)field);
941            if (field->used_in_device())
942               name.cpy("[").cat(field->device().tag() + 1).cat("] ").cat(field->name());
943            else
944               name.cpy(field->name());
933945
946            item_append(name.cstr(), field->setting_name(), flags, (void *)field);
947
934948            /* for DIP switches, build up the model */
935949            if (type == IPT_DIPSWITCH && field->first_diplocation() != NULL)
936950            {
r242804r242805
12171231               {
12181232                  analog_item_data *data;
12191233                  UINT32 flags = 0;
1220
1234                  astring name;
1235                  if (field->used_in_device())
1236                     name.cpy("[").cat(field->device().tag() + 1).cat("] ").cat(field->name());
1237                  else
1238                     name.cpy(field->name());
1239                 
12211240                  /* allocate a data item for tracking what this menu item refers to */
12221241                  data = (analog_item_data *)m_pool_alloc(sizeof(*data));
12231242                  data->field = field;
r242804r242805
12281247                  {
12291248                     default:
12301249                     case ANALOG_ITEM_KEYSPEED:
1231                        text.printf("%s Digital Speed", field->name());
1250                        text.printf("%s Digital Speed", name.cstr());
12321251                        subtext.printf("%d", settings.delta);
12331252                        data->min = 0;
12341253                        data->max = 255;
r242804r242805
12371256                        break;
12381257
12391258                     case ANALOG_ITEM_CENTERSPEED:
1240                        text.printf("%s Autocenter Speed", field->name());
1259                        text.printf("%s Autocenter Speed", name.cstr());
12411260                        subtext.printf("%d", settings.centerdelta);
12421261                        data->min = 0;
12431262                        data->max = 255;
r242804r242805
12461265                        break;
12471266
12481267                     case ANALOG_ITEM_REVERSE:
1249                        text.printf("%s Reverse", field->name());
1268                        text.printf("%s Reverse", name.cstr());
12501269                        subtext.cpy(settings.reverse ? "On" : "Off");
12511270                        data->min = 0;
12521271                        data->max = 1;
r242804r242805
12551274                        break;
12561275
12571276                     case ANALOG_ITEM_SENSITIVITY:
1258                        text.printf("%s Sensitivity", field->name());
1277                        text.printf("%s Sensitivity", name.cstr());
12591278                        subtext.printf("%d", settings.sensitivity);
12601279                        data->min = 1;
12611280                        data->max = 255;
trunk/src/emu/ui/miscmenu.h
r242804r242805
8181      input_seq           seq;                /* copy of the live sequence */
8282      const input_seq *   defseq;             /* pointer to the default sequence */
8383      const char *        name;               /* pointer to the base name of the item */
84      const char *        owner_name;         /* pointer to the name of the owner of the item */
8485      UINT16              sortorder;          /* sorting information */
8586      UINT8               type;               /* type of port */
8687   };


Previous 199869 Revisions Next


© 1997-2024 The MAME Team