diff options
author | 2016-09-12 18:35:36 -0700 | |
---|---|---|
committer | 2016-09-12 18:35:36 -0700 | |
commit | 2bd18d5fea66bedcde02da1b2c17d83c4640a782 (patch) | |
tree | 21a026c276f83cd6a3619d49ca85cba088485e5b /src/osd/modules/input/input_rawinput.cpp | |
parent | 597626d0593e84868d5d9887c1f44b96222bdd49 (diff) |
Support for configuring device to conrtoller id
This change adds support for configuring device to conrtoller id. This
allows for stable controller ids even if USB devices are plugged /
unplugged, system is rebooted, etc.
See documentation for additional context.
Diffstat (limited to 'src/osd/modules/input/input_rawinput.cpp')
-rw-r--r-- | src/osd/modules/input/input_rawinput.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/osd/modules/input/input_rawinput.cpp b/src/osd/modules/input/input_rawinput.cpp index ee6dbf4a511..44fba696e2c 100644 --- a/src/osd/modules/input/input_rawinput.cpp +++ b/src/osd/modules/input/input_rawinput.cpp @@ -572,8 +572,16 @@ protected: // improve the name and then allocate a device std::wstring name = rawinput_device_improve_name(tname.get()); - // convert name to utf8 - std::string utf8_name = utf8_from_wstring(name.c_str()); + // convert name to utf8. Preserve raw name as well (if different than improved name) to allow mapping of device to controller. + std::string utf8_name; + if (0 == name.compare(tname.get())) + { + utf8_name = utf8_from_wstring(name.c_str()); + } + else + { + utf8_name = util::string_format("%s (%s)", utf8_from_wstring(name.c_str()), utf8_from_wstring(tname.get())); + } devinfo = devicelist()->create_device<TDevice>(machine, utf8_name.c_str(), *this); |