Previous 199869 Revisions Next

r34307 Saturday 10th January, 2015 at 11:22:36 UTC by Fabio Priuli
let's try with a different approach that does not require to add a new macro to each slot
device. also, group inputs in UI based on the device they are attached to and display
their tag only once instead of at each input. nw.

p.s. a clean build is likely needed
[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
r242818r242819
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_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
44   PORT_CONFNAME(0xff, _default_baud, _description) 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") \
r242818r242819
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_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
65   PORT_CONFNAME(0xff, _default_startbits, _description) 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
r242818r242819
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_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
76   PORT_CONFNAME(0xff, _default_databits, _description) 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") \
r242818r242819
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_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
90   PORT_CONFNAME(0xff, _default_parity, "Parity") 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") \
r242818r242819
101101
102102#define MCFG_RS232_STOPBITS(_tag, _default_stopbits, _description, _class, _write_line) \
103103   PORT_START(_tag) \
104   PORT_CONFNAME(0xff, 0x01, _description) PORT_DEVICE PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, _class, _write_line) \
104   PORT_CONFNAME(0xff, 0x01, _description) 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
r242818r242819
246246
247247static INPUT_PORTS_START( ser_mouse )
248248   PORT_START( "ser_mouse_btn" )
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)
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)
252252
253253   PORT_START( "ser_mouse_x" ) /* Mouse - X AXIS */
254   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_DEVICE PORT_SENSITIVITY(100) PORT_DEVICE PORT_KEYDELTA(0) PORT_PLAYER(1)
254   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) 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_DEVICE PORT_SENSITIVITY(100) PORT_DEVICE PORT_KEYDELTA(0) PORT_PLAYER(1)
257   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) 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
r242818r242819
4646
4747static INPUT_PORTS_START( sms_graphic )
4848   PORT_START("BUTTONS")
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
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
5252   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
5353
5454   PORT_START("X")
55   PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_X) PORT_DEVICE PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15)
55   PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_X) 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_DEVICE PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(15)
58   PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_Y) 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
r242818r242819
2020
2121static INPUT_PORTS_START( sms_joypad )
2222   PORT_START("JOYPAD")
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
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
2727   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )   // Vcc
28   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_DEVICE // TL
28   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )  // TL
2929   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )   // TH
30   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_DEVICE // TR
30   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )  // TR
3131INPUT_PORTS_END
3232
3333
trunk/src/emu/bus/sms_ctrl/lphaser.c
r242818r242819
3838
3939static INPUT_PORTS_START( sms_light_phaser )
4040   PORT_START("CTRL_PORT")
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)
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)
4343   PORT_BIT( 0x9f, IP_ACTIVE_LOW, IPT_UNUSED )
4444
4545   PORT_START("LPHASER_X")
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)
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)
4747
4848   PORT_START("LPHASER_Y")
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)
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)
5050INPUT_PORTS_END
5151
5252
trunk/src/emu/bus/sms_ctrl/paddle.c
r242818r242819
4242
4343static INPUT_PORTS_START( sms_paddle )
4444   PORT_START("CTRL_PORT")
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
45   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) 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 ) PORT_DEVICE // TL
47   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL
4848   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // TH
49   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_DEVICE PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, tr_pin_r, NULL)
49   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) 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_DEVICE PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255)
52   PORT_BIT( 0xff, 0x80, IPT_PADDLE) 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
r242818r242819
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" ) PORT_DEVICE
26   PORT_CONFNAME( 0x03, 0x00, "Rapid Fire Unit" )
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
r242818r242819
7171
7272static INPUT_PORTS_START( sms_sports_pad )
7373   PORT_START("SPORTS_IN")
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
74   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) 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 ) 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)
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)
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_DEVICE PORT_CHANGED_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_w, NULL)
84   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OUTPUT ) 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_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE
88   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) 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_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE
91   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE
9292INPUT_PORTS_END
9393
9494
trunk/src/emu/bus/sms_ctrl/sportsjp.c
r242818r242819
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_DEVICE 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_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 ) PORT_DEVICE // TL (Button 1)
58   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL (Button 1)
5959   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )  // TH
60   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_DEVICE // TR (Button 2)
60   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) // TR (Button 2)
6161
6262   PORT_START("SPORTS_JP_X")    /* Sports Pad X axis */
63   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40)
63   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) 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_DEVICE PORT_SENSITIVITY(50) PORT_KEYDELTA(40)
66   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40)
6767INPUT_PORTS_END
6868
6969
trunk/src/emu/ioport.h
r242818r242819
996996   static const int FIELD_FLAG_COCKTAIL = 0x0002;    // set if this field is relevant only for cocktail cabinets
997997   static const int FIELD_FLAG_TOGGLE =   0x0004;    // set if this field should behave as a toggle
998998   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
999   static const int ANALOG_FLAG_REVERSE = 0x0010;    // analog only: reverse the sense of the axis
1000   static const int ANALOG_FLAG_RESET =   0x0020;    // analog only: always preload in->default for relative axes, returning only deltas
1001   static const int ANALOG_FLAG_WRAPS =   0x0040;    // analog only: positional count wraps around
1002   static const int ANALOG_FLAG_INVERT =  0x0080;    // analog only: bitwise invert bits
10041003
10051004public:
10061005   // construction/destruction
r242818r242819
10281027   bool cocktail() const { return ((m_flags & FIELD_FLAG_COCKTAIL) != 0); }
10291028   bool toggle() const { return ((m_flags & FIELD_FLAG_TOGGLE) != 0); }
10301029   bool rotated() const { return ((m_flags & FIELD_FLAG_ROTATED) != 0); }
1031   bool used_in_device() const { return ((m_flags & FIELD_FLAG_DEVICE) != 0); }
10321030   bool analog_reverse() const { return ((m_flags & ANALOG_FLAG_REVERSE) != 0); }
10331031   bool analog_reset() const { return ((m_flags & ANALOG_FLAG_RESET) != 0); }
10341032   bool analog_wraps() const { return ((m_flags & ANALOG_FLAG_WRAPS) != 0); }
r242818r242819
14911489   void field_set_way(int way) const { m_curfield->m_way = way; }
14921490   void field_set_rotated() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_ROTATED; }
14931491   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; }
14951492   void field_set_player(int player) const { m_curfield->m_player = player - 1; }
14961493   void field_set_cocktail() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_COCKTAIL; field_set_player(2); }
14971494   void field_set_toggle() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_TOGGLE; }
r242818r242819
16271624#define PORT_NAME(_name) \
16281625   configurer.field_set_name(_name);
16291626
1630#define PORT_DEVICE \
1631   configurer.field_set_device();
1632
16331627#define PORT_PLAYER(_player) \
16341628   configurer.field_set_player(_player);
16351629
trunk/src/emu/ui/miscmenu.c
r242818r242819
561561            ((field->type() == IPT_OTHER && field->name() != NULL) || machine().ioport().type_group(field->type(), field->player()) != IPG_INVALID))
562562         {
563563            input_seq_type seqtype;
564            UINT16 sortorder;
564            UINT32 sortorder;
565565
566566            /* determine the sorting order */
567567            if (field->type() >= IPT_START1 && field->type() < IPT_ANALOG_LAST)
568            {
568569               sortorder = (field->type() << 2) | (field->player() << 12);
570               if (strcmp(field->device().tag(), ":"))
571                  sortorder |= 0x10000;
572            }
569573            else
570574               sortorder = field->type() | 0xf000;
571575
r242818r242819
584588               item->sortorder = sortorder + suborder[seqtype];
585589               item->type = field->is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
586590               item->name = name;
587               item->owner_name = field->used_in_device() ? (field->device().tag() + 1) : NULL;
591               item->owner_name = field->device().tag();
588592               item->next = itemlist;
589593               itemlist = item;
590594
r242818r242819
762766   const char *nameformat[INPUT_TYPE_TOTAL] = { 0 };
763767   input_item_data **itemarray, *item;
764768   int numitems = 0, curitem;
769   astring text;
765770   astring subtext;
766   astring text;
771   astring prev_owner;
772   bool first_entry = true;
767773
768774   /* create a mini lookup table for name format based on type */
769775   nameformat[INPUT_TYPE_DIGITAL] = "%s";
r242818r242819
791797      /* generate the name of the item itself, based off the base name and the type */
792798      item = itemarray[curitem];
793799      assert(nameformat[item->type] != NULL);
794      if (item->owner_name)
800
801      if (strcmp(item->owner_name, prev_owner.cstr()) != 0)
795802      {
796         text.printf("[%s] ", item->owner_name);
797         text.catprintf(nameformat[item->type], item->name);
803         if (first_entry)
804            first_entry = false;
805         else
806            item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
807         text.printf("[root%s]", item->owner_name);
808         item_append(text, NULL, 0, NULL);
809         prev_owner.cpy(item->owner_name);
798810      }
799      else
800         text.printf(nameformat[item->type], item->name);
801811
812      text.printf(nameformat[item->type], item->name);
813
802814      /* if we're polling this item, use some spaces with left/right arrows */
803815      if (pollingref == item->ref)
804816      {
r242818r242819
917929   ioport_field *field;
918930   ioport_port *port;
919931   dip_descriptor **diplist_tailptr;
932   astring prev_owner;
933   bool first_entry = true;
920934
921935   /* reset the dip switch tracking */
922936   dipcount = 0;
r242818r242819
938952               flags |= MENU_FLAG_RIGHT_ARROW;
939953
940954            /* add the menu item */
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());
955            if (strcmp(field->device().tag(), prev_owner.cstr()) != 0)
956            {
957               if (first_entry)
958                  first_entry = false;
959               else
960                  item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
961               name.printf("[root%s]", field->device().tag());
962               item_append(name, NULL, 0, NULL);
963               prev_owner.cpy(field->device().tag());
964            }
945965
946            item_append(name.cstr(), field->setting_name(), flags, (void *)field);
966            name.cpy(field->name());
947967
968            item_append(name, field->setting_name(), flags, (void *)field);
969
948970            /* for DIP switches, build up the model */
949971            if (type == IPT_DIPSWITCH && field->first_diplocation() != NULL)
950972            {
r242818r242819
11871209{
11881210   ioport_field *field;
11891211   ioport_port *port;
1212   astring text;
11901213   astring subtext;
1191   astring text;
1214   astring prev_owner;
1215   bool first_entry = true;
11921216
11931217   /* loop over input ports and add the items */
11941218   for (port = machine().ioport().first_port(); port != NULL; port = port->next())
r242818r242819
12321256                  analog_item_data *data;
12331257                  UINT32 flags = 0;
12341258                  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());
1259                  if (strcmp(field->device().tag(), prev_owner.cstr()) != 0)
1260                  {
1261                     if (first_entry)
1262                        first_entry = false;
1263                     else
1264                        item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
1265                     name.printf("[root%s]", field->device().tag());
1266                     item_append(name, NULL, 0, NULL);
1267                     prev_owner.cpy(field->device().tag());
1268                  }
1269
1270                  name.cpy(field->name());
12391271                 
12401272                  /* allocate a data item for tracking what this menu item refers to */
12411273                  data = (analog_item_data *)m_pool_alloc(sizeof(*data));
trunk/src/emu/ui/miscmenu.h
r242818r242819
8282      const input_seq *   defseq;             /* pointer to the default sequence */
8383      const char *        name;               /* pointer to the base name of the item */
8484      const char *        owner_name;         /* pointer to the name of the owner of the item */
85      UINT16              sortorder;          /* sorting information */
85      UINT32              sortorder;          /* sorting information */
8686      UINT8               type;               /* type of port */
8787   };
8888


Previous 199869 Revisions Next


© 1997-2024 The MAME Team