mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
osd/sdl: Removed keyboard/mouse/joystick device mapping options.
The keyboard and mouse device mapping options did nothing at all, mostly because of lack of support for separating inputs from multiple devices. The joystick options were useless when you have two of the same kind of controller, and you can achieve the same thing with controller configuration files.
This commit is contained in:
parent
f066d1da32
commit
b80b4066bf
@ -412,10 +412,15 @@ SDL Keyboard Mapping
|
||||
SDL Joystick Mapping
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
| :ref:`joyidx <mame-scommandline-joyidx>`
|
||||
| :ref:`sixaxis <mame-scommandline-sixaxis>`
|
||||
|
||||
|
||||
SDL Lightgun Mapping
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
| :ref:`lightgun_index <mame-scommandline-lightgunindex>`
|
||||
|
||||
|
||||
SDL Low-level Driver Options
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -2,7 +2,9 @@ SDL-Specific Commandline Options
|
||||
================================
|
||||
|
||||
|
||||
This section contains configuration options that are specific to any build supported by SDL (including Windows where compiled as SDL instead of native).
|
||||
This section contains configuration options that are specific to any build
|
||||
supported by SDL (including Windows where compiled as SDL instead of
|
||||
native).
|
||||
|
||||
|
||||
|
||||
@ -13,7 +15,9 @@ Performance Options
|
||||
|
||||
**-[no]sdlvideofps**
|
||||
|
||||
Enable output of benchmark data on the SDL video subsystem, including your system's video driver, X server (if applicable), and OpenGL stack in **-video opengl** mode.
|
||||
Enable output of benchmark data on the SDL video subsystem, including your
|
||||
system’s video driver, X server (if applicable), and OpenGL stack in
|
||||
**-video opengl** mode.
|
||||
|
||||
|
||||
Video Options
|
||||
@ -23,13 +27,13 @@ Video Options
|
||||
|
||||
**-[no]centerh**
|
||||
|
||||
Center horizontally within the view area. Default is ON (**-centerh**).
|
||||
Center horizontally within the view area. Default is ON (**-centerh**).
|
||||
|
||||
.. _mame-scommandline-centerv:
|
||||
|
||||
**-[no]centerv**
|
||||
|
||||
Center vertically within the view area. Default is ON (**-centerv**).
|
||||
Center vertically within the view area. Default is ON (**-centerv**).
|
||||
|
||||
|
||||
Video Soft-Specific Options
|
||||
@ -39,7 +43,8 @@ Video Soft-Specific Options
|
||||
|
||||
**-scalemode**
|
||||
|
||||
Scale mode: none, async, yv12, yuy2, yv12x2, yuy2x2 (**-video soft** only). Default is *none*.
|
||||
Scale mode: none, async, yv12, yuy2, yv12x2, yuy2x2 (**-video soft** only).
|
||||
Default is *none*.
|
||||
|
||||
|
||||
SDL Keyboard Mapping
|
||||
@ -49,54 +54,58 @@ SDL Keyboard Mapping
|
||||
|
||||
**-keymap**
|
||||
|
||||
Enable keymap. Default is OFF (**-nokeymap**)
|
||||
Enable keymap. Default is OFF (**-nokeymap**)
|
||||
|
||||
.. _mame-scommandline-keymapfile:
|
||||
|
||||
**-keymap_file** *<file>*
|
||||
|
||||
Keymap Filename. Default is ``keymap.dat``.
|
||||
Keymap file name. Default is ``keymap.dat``.
|
||||
|
||||
|
||||
SDL Joystick Mapping
|
||||
--------------------
|
||||
|
||||
.. _mame-scommandline-joyidx:
|
||||
|
||||
|
|
||||
| **-joy_idx1** *<name>*
|
||||
| **-joy_idx2** *<name>*
|
||||
| ...
|
||||
| **-joy_idx8** *<name>*
|
||||
|
|
||||
|
||||
Name of joystick mapped to a given joystick slot, default is *auto*.
|
||||
|
||||
|
||||
.. _mame-scommandline-sixaxis:
|
||||
|
||||
**-sixaxis**
|
||||
|
||||
Use special handling for PS3 SixAxis controllers. Default is OFF (**-nosixaxis**)
|
||||
Use special handling for PlayStation 3 SixAxis controllers. Default is OFF
|
||||
(**-nosixaxis**)
|
||||
|
||||
|
||||
SDL Lightgun Mapping
|
||||
--------------------
|
||||
|
||||
.. _mame-scommandline-lightgunindex:
|
||||
|
||||
|
|
||||
| **-lightgun_index1** *<name>*
|
||||
| **-lightgun_index2** *<name>*
|
||||
| ...
|
||||
| **-lightgun_index8** *<name>*
|
||||
|
|
||||
|
||||
Device name or ID mapped to a given lightgun slot.
|
||||
|
||||
|
||||
SDL Low-level Driver Options
|
||||
~---------------------------
|
||||
----------------------------
|
||||
|
||||
.. _mame-scommandline-videodriver:
|
||||
|
||||
**-videodriver** *<driver>*
|
||||
|
||||
SDL video driver to use ('x11', 'directfb', ... or '*auto*' for SDL default)
|
||||
SDL video driver to use ('x11', 'directfb', ... or '*auto*' for SDL default)
|
||||
|
||||
.. _mame-scommandline-audiodriver:
|
||||
|
||||
**-audiodriver** *<driver>*
|
||||
|
||||
SDL audio driver to use ('alsa', 'arts', ... or '*auto*' for SDL default)
|
||||
SDL audio driver to use ('alsa', 'arts', ... or '*auto*' for SDL default)
|
||||
|
||||
.. _mame-scommandline-gllib:
|
||||
|
||||
**-gl_lib** *<driver>*
|
||||
|
||||
Alternative **libGL.so** to use; '*auto*' for system default
|
||||
Alternative **libGL.so** to use; '*auto*' for system default
|
||||
|
@ -725,15 +725,14 @@ public:
|
||||
{
|
||||
case SDL_JOYAXISMOTION:
|
||||
{
|
||||
int axis = sdlevent.jaxis.axis;
|
||||
|
||||
int const axis = sdlevent.jaxis.axis;
|
||||
if (axis <= 3)
|
||||
{
|
||||
joystick.axes[sdlevent.jaxis.axis] = (sdlevent.jaxis.value * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
int magic = (sdlevent.jaxis.value / 2) + 16384;
|
||||
int const magic = (sdlevent.jaxis.value / 2) + 16384;
|
||||
joystick.axes[sdlevent.jaxis.axis] = magic;
|
||||
}
|
||||
}
|
||||
@ -974,32 +973,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
void devmap_register(device_map_t &devmap, int physical_idx, const std::string &name)
|
||||
{
|
||||
// Attempt to find the entry by name
|
||||
auto entry = std::find_if(
|
||||
std::begin(devmap.map),
|
||||
std::end(devmap.map),
|
||||
[&name] (auto const &item) { return (item.name == name) && (item.physical < 0); });
|
||||
|
||||
// If we didn't find it by name, find the first free slot
|
||||
if (entry == std::end(devmap.map))
|
||||
{
|
||||
entry = std::find_if(
|
||||
std::begin(devmap.map),
|
||||
std::end(devmap.map),
|
||||
[] (auto const &item) { return item.name.empty(); });
|
||||
}
|
||||
|
||||
if (entry != std::end(devmap.map))
|
||||
{
|
||||
entry->physical = physical_idx;
|
||||
entry->name = name;
|
||||
int logical_idx = std::distance(std::begin(devmap.map), entry);
|
||||
devmap.logical[physical_idx] = logical_idx;
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================
|
||||
// sdl_joystick_module
|
||||
//============================================================
|
||||
@ -1007,10 +980,9 @@ void devmap_register(device_map_t &devmap, int physical_idx, const std::string &
|
||||
class sdl_joystick_module : public sdl_input_module
|
||||
{
|
||||
private:
|
||||
device_map_t m_joy_map;
|
||||
bool m_initialized_joystick;
|
||||
bool m_initialized_haptic;
|
||||
bool m_sixaxis_mode;
|
||||
bool m_initialized_joystick;
|
||||
bool m_initialized_haptic;
|
||||
bool m_sixaxis_mode;
|
||||
public:
|
||||
sdl_joystick_module() :
|
||||
sdl_input_module(OSD_JOYSTICKINPUT_PROVIDER),
|
||||
@ -1058,29 +1030,26 @@ public:
|
||||
|
||||
m_sixaxis_mode = downcast<const sdl_options *>(options())->sixaxis();
|
||||
|
||||
m_joy_map.init(machine, SDLOPTION_JOYINDEX, 8, "Joystick mapping");
|
||||
|
||||
osd_printf_verbose("Joystick: Start initialization\n");
|
||||
for (int physical_stick = 0; physical_stick < SDL_NumJoysticks(); physical_stick++)
|
||||
{
|
||||
std::string joy_name = remove_spaces(SDL_JoystickNameForIndex(physical_stick));
|
||||
devmap_register(m_joy_map, physical_stick, joy_name);
|
||||
}
|
||||
|
||||
for (int stick = 0; stick < MAX_DEVMAP_ENTRIES; stick++)
|
||||
{
|
||||
sdl_joystick_device *const devinfo = create_joystick_device(machine, &m_joy_map, stick, DEVICE_CLASS_JOYSTICK);
|
||||
|
||||
if (!devinfo)
|
||||
continue;
|
||||
|
||||
int const physical_stick = m_joy_map.map[stick].physical;
|
||||
SDL_Joystick *const joy = SDL_JoystickOpen(physical_stick);
|
||||
char const *const name = SDL_JoystickName(joy);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(joy);
|
||||
char guid_str[256];
|
||||
guid_str[0] = '\0';
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str) - 1);
|
||||
|
||||
sdl_joystick_device *const devinfo = m_sixaxis_mode
|
||||
? &devicelist().create_device<sdl_sixaxis_joystick_device>(machine, name ? name : guid_str, guid_str, *this)
|
||||
: &devicelist().create_device<sdl_joystick_device>(machine, name ? name : guid_str, guid_str, *this);
|
||||
|
||||
if (!devinfo)
|
||||
{
|
||||
SDL_JoystickClose(joy);
|
||||
continue;
|
||||
}
|
||||
|
||||
devinfo->sdl_state.device = joy;
|
||||
devinfo->sdl_state.joystick_id = SDL_JoystickInstanceID(joy);
|
||||
devinfo->sdl_state.hapdevice = SDL_HapticOpenFromJoystick(joy);
|
||||
@ -1093,7 +1062,7 @@ public:
|
||||
devinfo->sdl_state.serial = std::nullopt;
|
||||
|
||||
osd_printf_verbose("Joystick: %s [GUID %s] Vendor ID %04X, Product ID %04X, Revision %04X\n",
|
||||
SDL_JoystickNameForIndex(physical_stick),
|
||||
name ? name : "<nullptr>",
|
||||
guid_str,
|
||||
SDL_JoystickGetVendor(joy),
|
||||
SDL_JoystickGetProduct(joy),
|
||||
@ -1103,7 +1072,6 @@ public:
|
||||
SDL_JoystickNumButtons(joy),
|
||||
SDL_JoystickNumHats(joy),
|
||||
SDL_JoystickNumBalls(joy));
|
||||
osd_printf_verbose("Joystick: ... Physical id %d mapped to logical id %d\n", physical_stick, stick + 1);
|
||||
if (devinfo->sdl_state.hapdevice)
|
||||
osd_printf_verbose("Joystick: ... Has haptic capability\n");
|
||||
else
|
||||
@ -1256,32 +1224,6 @@ private:
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sdl_joystick_device *create_joystick_device(running_machine &machine, device_map_t *devmap, int index, input_device_class devclass)
|
||||
{
|
||||
char tempname[20];
|
||||
char guid_str[256];
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(m_joy_map.map[index].physical);
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str) - 1);
|
||||
|
||||
if (devmap->map[index].name.empty())
|
||||
{
|
||||
// only map place holders if there were mappings specified
|
||||
if (devmap->initialized)
|
||||
{
|
||||
snprintf(tempname, std::size(tempname), "NC%d", index);
|
||||
m_sixaxis_mode
|
||||
? devicelist().create_device<sdl_sixaxis_joystick_device>(machine, tempname, guid_str, *this)
|
||||
: devicelist().create_device<sdl_joystick_device>(machine, tempname, guid_str, *this);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_sixaxis_mode
|
||||
? &devicelist().create_device<sdl_sixaxis_joystick_device>(machine, std::string(devmap->map[index].name), guid_str, *this)
|
||||
: &devicelist().create_device<sdl_joystick_device>(machine, std::string(devmap->map[index].name), guid_str, *this);
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -28,9 +28,6 @@
|
||||
#define SDLOPTION_KEYMAP_FILE "keymap_file"
|
||||
|
||||
#define SDLOPTION_SIXAXIS "sixaxis"
|
||||
#define SDLOPTION_JOYINDEX "joy_idx"
|
||||
#define SDLOPTION_KEYBINDEX "keyb_idx"
|
||||
#define SDLOPTION_MOUSEINDEX "mouse_index"
|
||||
#if (USE_XINPUT)
|
||||
#define SDLOPTION_LIGHTGUNINDEX "lightgun_index"
|
||||
#endif
|
||||
@ -98,12 +95,8 @@ public:
|
||||
const char *keymap_file() const { return value(SDLOPTION_KEYMAP_FILE); }
|
||||
|
||||
// joystick mapping
|
||||
const char *joy_index(int index) const { return value(util::string_format("%s%d", SDLOPTION_JOYINDEX, index)); }
|
||||
bool sixaxis() const { return bool_value(SDLOPTION_SIXAXIS); }
|
||||
|
||||
const char *mouse_index(int index) const { return value(util::string_format("%s%d", SDLOPTION_MOUSEINDEX, index)); }
|
||||
const char *keyboard_index(int index) const { return value(util::string_format("%s%d", SDLOPTION_KEYBINDEX, index)); }
|
||||
|
||||
const char *video_driver() const { return value(SDLOPTION_VIDEODRIVER); }
|
||||
const char *render_driver() const { return value(SDLOPTION_RENDERDRIVER); }
|
||||
const char *audio_driver() const { return value(SDLOPTION_AUDIODRIVER); }
|
||||
|
@ -103,14 +103,6 @@ const options_entry sdl_options::s_option_entries[] =
|
||||
|
||||
// joystick mapping
|
||||
{ nullptr, nullptr, core_options::option_type::HEADER, "SDL JOYSTICK MAPPING" },
|
||||
{ SDLOPTION_JOYINDEX "1", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of joystick mapped to joystick #1" },
|
||||
{ SDLOPTION_JOYINDEX "2", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of joystick mapped to joystick #2" },
|
||||
{ SDLOPTION_JOYINDEX "3", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of joystick mapped to joystick #3" },
|
||||
{ SDLOPTION_JOYINDEX "4", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of joystick mapped to joystick #4" },
|
||||
{ SDLOPTION_JOYINDEX "5", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of joystick mapped to joystick #5" },
|
||||
{ SDLOPTION_JOYINDEX "6", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of joystick mapped to joystick #6" },
|
||||
{ SDLOPTION_JOYINDEX "7", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of joystick mapped to joystick #7" },
|
||||
{ SDLOPTION_JOYINDEX "8", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of joystick mapped to joystick #8" },
|
||||
{ SDLOPTION_SIXAXIS, "0", core_options::option_type::BOOLEAN, "use special handling for PS3 Sixaxis controllers" },
|
||||
|
||||
#if (USE_XINPUT)
|
||||
@ -126,26 +118,6 @@ const options_entry sdl_options::s_option_entries[] =
|
||||
{ SDLOPTION_LIGHTGUNINDEX "8", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of lightgun mapped to lightgun #8" },
|
||||
#endif
|
||||
|
||||
{ nullptr, nullptr, core_options::option_type::HEADER, "SDL MOUSE MAPPING" },
|
||||
{ SDLOPTION_MOUSEINDEX "1", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of mouse mapped to mouse #1" },
|
||||
{ SDLOPTION_MOUSEINDEX "2", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of mouse mapped to mouse #2" },
|
||||
{ SDLOPTION_MOUSEINDEX "3", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of mouse mapped to mouse #3" },
|
||||
{ SDLOPTION_MOUSEINDEX "4", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of mouse mapped to mouse #4" },
|
||||
{ SDLOPTION_MOUSEINDEX "5", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of mouse mapped to mouse #5" },
|
||||
{ SDLOPTION_MOUSEINDEX "6", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of mouse mapped to mouse #6" },
|
||||
{ SDLOPTION_MOUSEINDEX "7", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of mouse mapped to mouse #7" },
|
||||
{ SDLOPTION_MOUSEINDEX "8", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of mouse mapped to mouse #8" },
|
||||
|
||||
{ nullptr, nullptr, core_options::option_type::HEADER, "SDL KEYBOARD MAPPING" },
|
||||
{ SDLOPTION_KEYBINDEX "1", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of keyboard mapped to keyboard #1" },
|
||||
{ SDLOPTION_KEYBINDEX "2", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of keyboard mapped to keyboard #2" },
|
||||
{ SDLOPTION_KEYBINDEX "3", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of keyboard mapped to keyboard #3" },
|
||||
{ SDLOPTION_KEYBINDEX "4", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of keyboard mapped to keyboard #4" },
|
||||
{ SDLOPTION_KEYBINDEX "5", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of keyboard mapped to keyboard #5" },
|
||||
{ SDLOPTION_KEYBINDEX "6", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of keyboard mapped to keyboard #6" },
|
||||
{ SDLOPTION_KEYBINDEX "7", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of keyboard mapped to keyboard #7" },
|
||||
{ SDLOPTION_KEYBINDEX "8", OSDOPTVAL_AUTO, core_options::option_type::STRING, "name of keyboard mapped to keyboard #8" },
|
||||
|
||||
// SDL low level driver options
|
||||
{ nullptr, nullptr, core_options::option_type::HEADER, "SDL LOW-LEVEL DRIVER OPTIONS" },
|
||||
{ SDLOPTION_VIDEODRIVER ";vd", OSDOPTVAL_AUTO, core_options::option_type::STRING, "SDL video driver to use ('x11', 'directfb', ... or 'auto' for SDL default" },
|
||||
|
Loading…
Reference in New Issue
Block a user