Previous 199869 Revisions Next

r34295 Friday 9th January, 2015 at 22:21:19 UTC by Couriersud
Moved osd midi stuff to osd/modules/midi. Needed to touch a couple of
other files so that mame compiles and links. Tested SDL build
(linux/windows).
[src/emu]clifront.c 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
[src/osd]osdcore.c osdcore.h osdepend.c osdepend.h
[src/osd/sdl]sdl.mak sdlmain.c
[src/osd/windows]windows.mak winfile.c

trunk/src/emu/bus/rs232/rs232.h
r242806r242807
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") \
r242806r242807
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
r242806r242807
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") \
r242806r242807
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") \
r242806r242807
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
r242806r242807
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
r242806r242807
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
r242806r242807
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
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
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
3131INPUT_PORTS_END
3232
3333
trunk/src/emu/bus/sms_ctrl/lphaser.c
r242806r242807
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
r242806r242807
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
r242806r242807
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
r242806r242807
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
r242806r242807
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/clifront.c
r242806r242807
780780
781781void cli_frontend::listmididevices(const char *gamename)
782782{
783   osd_list_midi_devices();
783   m_osd.list_midi_devices();
784784}
785785
786786
trunk/src/emu/ioport.h
r242806r242807
992992   friend class dynamic_field;
993993
994994   // flags for ioport_fields
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
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
10041003
10051004public:
10061005   // construction/destruction
r242806r242807
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); }
r242806r242807
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; }
r242806r242807
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
r242806r242807
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;
514513            item->next = itemlist;
515514            itemlist = item;
516515
r242806r242807
584583               item->sortorder = sortorder + suborder[seqtype];
585584               item->type = field->is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
586585               item->name = name;
587               item->owner_name = field->used_in_device() ? (field->device().tag() + 1) : NULL;
588586               item->next = itemlist;
589587               itemlist = item;
590588
r242806r242807
791789      /* generate the name of the item itself, based off the base name and the type */
792790      item = itemarray[curitem];
793791      assert(nameformat[item->type] != NULL);
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);
792      text.printf(nameformat[item->type], item->name);
801793
802794      /* if we're polling this item, use some spaces with left/right arrows */
803795      if (pollingref == item->ref)
r242806r242807
929921         if (field->type() == type && field->enabled())
930922         {
931923            UINT32 flags = 0;
932            astring name;
933924
934925            /* set the left/right flags appropriately */
935926            if (field->has_previous_setting())
r242806r242807
938929               flags |= MENU_FLAG_RIGHT_ARROW;
939930
940931            /* 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());
932            item_append(field->name(), field->setting_name(), flags, (void *)field);
945933
946            item_append(name.cstr(), field->setting_name(), flags, (void *)field);
947
948934            /* for DIP switches, build up the model */
949935            if (type == IPT_DIPSWITCH && field->first_diplocation() != NULL)
950936            {
r242806r242807
12311217               {
12321218                  analog_item_data *data;
12331219                  UINT32 flags = 0;
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                 
1220
12401221                  /* allocate a data item for tracking what this menu item refers to */
12411222                  data = (analog_item_data *)m_pool_alloc(sizeof(*data));
12421223                  data->field = field;
r242806r242807
12471228                  {
12481229                     default:
12491230                     case ANALOG_ITEM_KEYSPEED:
1250                        text.printf("%s Digital Speed", name.cstr());
1231                        text.printf("%s Digital Speed", field->name());
12511232                        subtext.printf("%d", settings.delta);
12521233                        data->min = 0;
12531234                        data->max = 255;
r242806r242807
12561237                        break;
12571238
12581239                     case ANALOG_ITEM_CENTERSPEED:
1259                        text.printf("%s Autocenter Speed", name.cstr());
1240                        text.printf("%s Autocenter Speed", field->name());
12601241                        subtext.printf("%d", settings.centerdelta);
12611242                        data->min = 0;
12621243                        data->max = 255;
r242806r242807
12651246                        break;
12661247
12671248                     case ANALOG_ITEM_REVERSE:
1268                        text.printf("%s Reverse", name.cstr());
1249                        text.printf("%s Reverse", field->name());
12691250                        subtext.cpy(settings.reverse ? "On" : "Off");
12701251                        data->min = 0;
12711252                        data->max = 1;
r242806r242807
12741255                        break;
12751256
12761257                     case ANALOG_ITEM_SENSITIVITY:
1277                        text.printf("%s Sensitivity", name.cstr());
1258                        text.printf("%s Sensitivity", field->name());
12781259                        subtext.printf("%d", settings.sensitivity);
12791260                        data->min = 1;
12801261                        data->max = 255;
trunk/src/emu/ui/miscmenu.h
r242806r242807
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 */
8584      UINT16              sortorder;          /* sorting information */
8685      UINT8               type;               /* type of port */
8786   };
trunk/src/osd/osdcore.c
r242806r242807
11#include "emucore.h"
22#include "osdcore.h"
3#include "portmidi/portmidi.h"
43
54bool g_print_verbose = false;
65
r242806r242807
166165}
167166#endif
168167
169static const int RX_EVENT_BUF_SIZE = 512;
170
171#define MIDI_SYSEX  0xf0
172#define MIDI_EOX    0xf7
173
174struct osd_midi_device
175{
176   #ifndef DISABLE_MIDI
177   PortMidiStream *pmStream;
178   PmEvent rx_evBuf[RX_EVENT_BUF_SIZE];
179   #endif
180   UINT8 xmit_in[4]; // Pm_Messages mean we can at most have 3 residue bytes
181   int xmit_cnt;
182   UINT8 last_status;
183   bool rx_sysex;
184};
185
186void osd_list_midi_devices(void)
187{
188   #ifndef DISABLE_MIDI
189   int num_devs = Pm_CountDevices();
190   const PmDeviceInfo *pmInfo;
191
192   printf("\n");
193
194   if (num_devs == 0)
195   {
196      printf("No MIDI ports were found\n");
197      return;
198   }
199
200   printf("MIDI input ports:\n");
201   for (int i = 0; i < num_devs; i++)
202   {
203      pmInfo = Pm_GetDeviceInfo(i);
204
205      if (pmInfo->input)
206      {
207         printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultInputDeviceID()) ? "(default)" : "");
208      }
209   }
210
211   printf("\nMIDI output ports:\n");
212   for (int i = 0; i < num_devs; i++)
213   {
214      pmInfo = Pm_GetDeviceInfo(i);
215
216      if (pmInfo->output)
217      {
218         printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultOutputDeviceID()) ? "(default)" : "");
219      }
220   }
221   #else
222   printf("\nMIDI is not supported in this build\n");
223   #endif
224}
225
226osd_midi_device *osd_open_midi_input(const char *devname)
227{
228   #ifndef DISABLE_MIDI
229   int num_devs = Pm_CountDevices();
230   int found_dev = -1;
231   const PmDeviceInfo *pmInfo;
232   PortMidiStream *stm;
233   osd_midi_device *ret;
234
235   if (!strcmp("default", devname))
236   {
237      found_dev = Pm_GetDefaultInputDeviceID();
238   }
239   else
240   {
241      for (int i = 0; i < num_devs; i++)
242      {
243         pmInfo = Pm_GetDeviceInfo(i);
244
245         if (pmInfo->input)
246         {
247            if (!strcmp(devname, pmInfo->name))
248            {
249               found_dev = i;
250               break;
251            }
252         }
253      }
254   }
255
256   if (found_dev >= 0)
257   {
258      if (Pm_OpenInput(&stm, found_dev, NULL, RX_EVENT_BUF_SIZE, NULL, NULL) == pmNoError)
259      {
260         ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device));
261         memset(ret, 0, sizeof(osd_midi_device));
262         ret->pmStream = stm;
263         return ret;
264      }
265      else
266      {
267         printf("Couldn't open PM device\n");
268         return NULL;
269      }
270   }
271   else
272   {
273      return NULL;
274   }
275   #else
276   return NULL;
277   #endif
278}
279
280osd_midi_device *osd_open_midi_output(const char *devname)
281{
282   #ifndef DISABLE_MIDI
283   int num_devs = Pm_CountDevices();
284   int found_dev = -1;
285   const PmDeviceInfo *pmInfo;
286   PortMidiStream *stm;
287   osd_midi_device *ret;
288
289   if (!strcmp("default", devname))
290   {
291      found_dev = Pm_GetDefaultOutputDeviceID();
292   }
293   else
294   {
295      for (int i = 0; i < num_devs; i++)
296      {
297         pmInfo = Pm_GetDeviceInfo(i);
298
299         if (pmInfo->output)
300         {
301            if (!strcmp(devname, pmInfo->name))
302            {
303               found_dev = i;
304               break;
305            }
306         }
307      }
308   }
309
310   if (found_dev >= 0)
311   {
312      if (Pm_OpenOutput(&stm, found_dev, NULL, 100, NULL, NULL, 0) == pmNoError)
313      {
314         ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device));
315         memset(ret, 0, sizeof(osd_midi_device));
316         ret->pmStream = stm;
317         return ret;
318      }
319      else
320      {
321         printf("Couldn't open PM device\n");
322         return NULL;
323      }
324   }
325   else
326   {
327      return NULL;
328   }
329   #endif
330   return NULL;
331}
332
333void osd_close_midi_channel(osd_midi_device *dev)
334{
335   #ifndef DISABLE_MIDI
336   Pm_Close(dev->pmStream);
337   osd_free(dev);
338   #endif
339}
340
341bool osd_poll_midi_channel(osd_midi_device *dev)
342{
343   #ifndef DISABLE_MIDI
344   PmError chk = Pm_Poll(dev->pmStream);
345
346   return (chk == pmGotData) ? true : false;
347   #else
348   return false;
349   #endif
350}
351
352int osd_read_midi_channel(osd_midi_device *dev, UINT8 *pOut)
353{
354   #ifndef DISABLE_MIDI
355   int msgsRead = Pm_Read(dev->pmStream, dev->rx_evBuf, RX_EVENT_BUF_SIZE);
356   int bytesOut = 0;
357
358   if (msgsRead <= 0)
359   {
360      return 0;
361   }
362
363   for (int msg = 0; msg < msgsRead; msg++)
364   {
365      UINT8 status = Pm_MessageStatus(dev->rx_evBuf[msg].message);
366
367      if (dev->rx_sysex)
368      {
369         if (status & 0x80)  // sys real-time imposing on us?
370         {
371            if ((status == 0xf2) || (status == 0xf3))
372            {
373               *pOut++ = status;
374               *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
375               *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
376               bytesOut += 3;
377            }
378            else
379            {
380               *pOut++ = status;
381               bytesOut++;
382               if (status == MIDI_EOX)
383               {
384                  dev->rx_sysex = false;
385               }
386            }
387         }
388         else    // shift out the sysex bytes
389         {
390            for (int i = 0; i < 4; i++)
391            {
392               UINT8 byte = dev->rx_evBuf[msg].message & 0xff;
393               *pOut++ = byte;
394               bytesOut++;
395               if (byte == MIDI_EOX)
396               {
397                  dev->rx_sysex = false;
398                  break;
399               }
400               dev->rx_evBuf[msg].message >>= 8;
401            }
402         }
403      }
404      else
405      {
406         switch ((status>>4) & 0xf)
407         {
408            case 0xc:   // 2-byte messages
409            case 0xd:
410               *pOut++ = status;
411               *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
412               bytesOut += 2;
413               break;
414
415            case 0xf:   // system common
416               switch (status & 0xf)
417               {
418                  case 0: // System Exclusive
419                  {
420                     *pOut++ = status;   // this should be OK: the shortest legal sysex is F0 tt dd F7, I believe
421                     *pOut++ = (dev->rx_evBuf[msg].message>>8) & 0xff;
422                     *pOut++ = (dev->rx_evBuf[msg].message>>16) & 0xff;
423                     UINT8 last = *pOut++ = (dev->rx_evBuf[msg].message>>24) & 0xff;
424                     bytesOut += 4;
425                     dev->rx_sysex = (last != MIDI_EOX);
426                     break;
427                  }
428
429                  case 7: // End of System Exclusive
430                     *pOut++ = status;
431                     bytesOut += 1;
432                     dev->rx_sysex = false;
433                     break;
434
435                  case 2: // song pos
436                  case 3: // song select
437                     *pOut++ = status;
438                     *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
439                     *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
440                     bytesOut += 3;
441                     break;
442
443                  default:    // all other defined Fx messages are 1 byte
444                     break;
445               }
446               break;
447
448            default:
449               *pOut++ = status;
450               *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
451               *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
452               bytesOut += 3;
453               break;
454         }
455      }
456   }
457
458   return bytesOut;
459   #else
460   return 0;
461   #endif
462}
463
464void osd_write_midi_channel(osd_midi_device *dev, UINT8 data)
465{
466   #ifndef DISABLE_MIDI
467   int bytes_needed = 0;
468   PmEvent ev;
469   ev.timestamp = 0;   // use the current time
470
471//  printf("write: %02x (%d)\n", data, dev->xmit_cnt);
472
473   // reject data bytes when no valid status exists
474   if ((dev->last_status == 0) && !(data & 0x80))
475   {
476      dev->xmit_cnt = 0;
477      return;
478   }
479
480   if (dev->xmit_cnt >= 4)
481   {
482      printf("MIDI out: packet assembly overflow, contact MAMEdev!\n");
483      return;
484   }
485
486   // handle sysex
487   if (dev->last_status == MIDI_SYSEX)
488   {
489//      printf("sysex: %02x (%d)\n", data, dev->xmit_cnt);
490
491      // if we get a status that isn't sysex, assume it's system common
492      if ((data & 0x80) && (data != MIDI_EOX))
493      {
494//          printf("common during sysex!\n");
495         ev.message = Pm_Message(data, 0, 0);
496         Pm_Write(dev->pmStream, &ev, 1);
497         return;
498      }
499
500      dev->xmit_in[dev->xmit_cnt++] = data;
501
502      // if EOX or 4 bytes filled, transmit 4 bytes
503      if ((dev->xmit_cnt == 4) || (data == MIDI_EOX))
504      {
505         ev.message = dev->xmit_in[0] | (dev->xmit_in[1]<<8) | (dev->xmit_in[2]<<16) | (dev->xmit_in[3]<<24);
506         Pm_Write(dev->pmStream, &ev, 1);
507         dev->xmit_in[0] = dev->xmit_in[1] = dev->xmit_in[2] = dev->xmit_in[3] = 0;
508         dev->xmit_cnt = 0;
509
510//          printf("SysEx packet: %08x\n", ev.message);
511
512         // if this is EOX, kill the running status
513         if (data == MIDI_EOX)
514         {
515            dev->last_status = 0;
516         }
517      }
518
519      return;
520   }
521
522   // handle running status.  don't allow system real-time messages to be considered as running status.
523   if ((dev->xmit_cnt == 0) && (data & 0x80) && (data < 0xf8))
524   {
525      dev->last_status = data;
526   }
527
528   if ((dev->xmit_cnt == 0) && !(data & 0x80))
529   {
530      dev->xmit_in[dev->xmit_cnt++] = dev->last_status;
531      dev->xmit_in[dev->xmit_cnt++] = data;
532//      printf("\trunning status: [%d] = %02x, [%d] = %02x, last_status = %02x\n", dev->xmit_cnt-2, dev->last_status, dev->xmit_cnt-1, data, dev->last_status);
533   }
534   else
535   {
536      dev->xmit_in[dev->xmit_cnt++] = data;
537//      printf("\tNRS: [%d] = %02x\n", dev->xmit_cnt-1, data);
538   }
539
540   if ((dev->xmit_cnt == 1) && (dev->xmit_in[0] == MIDI_SYSEX))
541   {
542//      printf("Start SysEx!\n");
543      dev->last_status = MIDI_SYSEX;
544      return;
545   }
546
547   // are we there yet?
548//  printf("status check: %02x\n", dev->xmit_in[0]);
549   switch ((dev->xmit_in[0]>>4) & 0xf)
550   {
551      case 0xc:   // 2-byte messages
552      case 0xd:
553         bytes_needed = 2;
554         break;
555
556      case 0xf:   // system common
557         switch (dev->xmit_in[0] & 0xf)
558         {
559            case 0: // System Exclusive is handled above
560               break;
561
562            case 7: // End of System Exclusive
563               bytes_needed = 1;
564               break;
565
566            case 2: // song pos
567            case 3: // song select
568               bytes_needed = 3;
569               break;
570
571            default:    // all other defined Fx messages are 1 byte
572               bytes_needed = 1;
573               break;
574         }
575         break;
576
577      default:
578         bytes_needed = 3;
579         break;
580   }
581
582   if (dev->xmit_cnt == bytes_needed)
583   {
584      ev.message = Pm_Message(dev->xmit_in[0], dev->xmit_in[1], dev->xmit_in[2]);
585      Pm_Write(dev->pmStream, &ev, 1);
586      dev->xmit_cnt = 0;
587   }
588
589   #endif
590}
trunk/src/osd/osdcore.h
r242806r242807
874874***************************************************************************/
875875struct osd_midi_device;
876876
877bool osd_midi_init();
878void osd_midi_exit();
877879void osd_list_midi_devices(void);
878880// free result with osd_close_midi_channel()
879881osd_midi_device *osd_open_midi_input(const char *devname);
trunk/src/osd/osdepend.c
r242806r242807
1111
1212#include "emu.h"
1313#include "osdepend.h"
14#include "portmidi/portmidi.h"
1514#include "modules/sound/none.h"
1615#include "modules/debugger/none.h"
1716#include "modules/debugger/debugint.h"
r242806r242807
474473   return true;
475474}
476475
477bool osd_interface::midi_init()
478{
479   #ifndef DISABLE_MIDI
480   Pm_Initialize();
481   #endif
482   return true;
483}
484
485
486476void osd_interface::exit_subsystems()
487477{
488478   video_exit();
r242806r242807
521511{
522512}
523513
524void osd_interface::midi_exit()
525{
526   #ifndef DISABLE_MIDI
527   Pm_Terminate();
528   #endif
529}
530
531514void osd_interface::osd_exit()
532515{
533516   exit_subsystems();
trunk/src/osd/osdepend.h
r242806r242807
167167   // video overridables
168168   virtual void *get_slider_list();
169169
170   // midi overridables
171   // FIXME: this should return a list of devices, not list them on stdout
172   virtual void list_midi_devices(void);
173
174   // FIXME: everything below seems to be osd specific and not part of
175   //        this INTERFACE but part of the osd IMPLEMENTATION
176
170177   void init_subsystems();
171178
172179   virtual bool video_init();
trunk/src/osd/sdl/sdl.mak
r242806r242807
394394SDLSRC = $(SRC)/osd/$(OSD)
395395SDLOBJ = $(OBJ)/osd/$(OSD)
396396
397OBJDIRS += $(SDLOBJ) $(OSDOBJ)/modules/sync $(OSDOBJ)/modules/lib
397OBJDIRS += $(SDLOBJ) \
398   $(OSDOBJ)/modules/sync \
399   $(OSDOBJ)/modules/lib \
400   $(OSDOBJ)/modules/midi \
398401
399402#-------------------------------------------------
400403# OSD core library
r242806r242807
430433   $(SDLOBJ)/output.o \
431434   $(SDLOBJ)/watchdog.o \
432435
436ifdef NO_USE_MIDI
437   OSDOBJS += $(OSDOBJ)/modules/midi/none.o
438else
439   OSDOBJS += $(OSDOBJ)/modules/midi/portmidi.o
440endif
441
433442ifeq ($(BASE_TARGETOS),win32)
434443   OSDOBJS += $(OSDOBJ)/modules/sound/direct_sound.o
435444endif
436445
437ifdef NO_USE_MIDI
438DEFS += -DDISABLE_MIDI=1
439endif
440
441446# Add SDL2.0 support
442447
443448ifeq ($(SDL_LIBVER),sdl2)
trunk/src/osd/sdl/sdlmain.c
r242806r242807
14381438}
14391439#endif
14401440#endif
1441
1442//-------------------------------------------------
1443// FIXME: Doesn't belong here but there's no better
1444//        place currently.
1445//-------------------------------------------------
1446
1447bool osd_interface::midi_init()
1448{
1449    // this should be done on the OS_level
1450    return osd_midi_init();
1451}
1452
1453//-------------------------------------------------
1454//  list_midi_devices - list available midi devices
1455//-------------------------------------------------
1456
1457void osd_interface::list_midi_devices(void)
1458{
1459    osd_list_midi_devices();
1460}
1461
1462void osd_interface::midi_exit()
1463{
1464    osd_midi_exit();
1465}
trunk/src/osd/windows/windows.mak
r242806r242807
8787OSDSRC = $(SRC)/osd
8888OSDOBJ = $(OBJ)/osd
8989
90OBJDIRS += $(WINOBJ) $(OSDOBJ)/modules/sync $(OSDOBJ)/modules/lib
90OBJDIRS += $(WINOBJ) \
91   $(OSDOBJ)/modules/sync \
92   $(OSDOBJ)/modules/lib \
93   $(OSDOBJ)/modules/midi \
9194
9295ifdef USE_QTDEBUG
9396OBJDIRS += $(OSDOBJ)/modules/debugger/qt
r242806r242807
374377   $(WINOBJ)/video.o \
375378   $(WINOBJ)/window.o \
376379   $(WINOBJ)/winmenu.o \
377   $(WINOBJ)/winmain.o
380   $(WINOBJ)/winmain.o \
381   $(OSDOBJ)/modules/midi/portmidi.o \
378382
379383ifdef USE_SDL
380384OSDOBJS += \
trunk/src/osd/windows/winfile.c
r242806r242807
2222#include "winutil.h"
2323#include "winutf8.h"
2424
25#if defined(SDLMAME_WIN32) || defined(SDLMAME_OS2)
26#define INVPATHSEPCH '/'
27#else
28#define INVPATHSEPCH '\\'
29#endif
30
2531#include "winfile.h"
2632
2733//============================================================
r242806r242807
9096
9197   // convert the path into something Windows compatible
9298   dst = (*file)->filename;
93#if defined(SDLMAME_WIN32) || defined(SDLMAME_OS2)
9499   for (src = t_path; *src != 0; src++)
95      *dst++ = (*src == '/') ? '\\' : *src;
96#else
97   for (src = t_path; *src != 0; src++)
98100      *dst++ = *src;//(*src == '/') ? '\\' : *src;
99#endif
100101   *dst++ = 0;
101102
102103   // select the file open modes
r242806r242807
126127      // create the path if necessary
127128      if (error == ERROR_PATH_NOT_FOUND && (openflags & OPEN_FLAG_CREATE) && (openflags & OPEN_FLAG_CREATE_PATHS))
128129      {
129         TCHAR *pathsep = _tcsrchr((*file)->filename, '\\');
130         TCHAR *pathsep = _tcsrchr((*file)->filename, INVPATHSEPCH);
130131         if (pathsep != NULL)
131132         {
132133            // create the path up to the file
133134            *pathsep = 0;
134135            error = create_path_recursive((*file)->filename);
135            *pathsep = '\\';
136            *pathsep = INVPATHSEPCH;
136137
137138            // attempt to reopen the file
138139            if (error == NO_ERROR)
r242806r242807
405406
406407DWORD create_path_recursive(const TCHAR *path)
407408{
408   TCHAR *sep = (TCHAR *)_tcsrchr(path, '\\');
409   TCHAR *sep = (TCHAR *)_tcsrchr(path, INVPATHSEPCH);
409410
410411   // if there's still a separator, and it's not the root, nuke it and recurse
411   if (sep != NULL && sep > path && sep[0] != ':' && sep[-1] != '\\')
412   if (sep != NULL && sep > path && sep[0] != ':' && sep[-1] != INVPATHSEPCH)
412413   {
413414      *sep = 0;
414415      create_path_recursive(path);
415      *sep = '\\';
416      *sep = INVPATHSEPCH;
416417   }
417418
418419   // if the path already exists, we're done


Previous 199869 Revisions Next


© 1997-2024 The MAME Team