diff options
author | 2021-01-24 14:48:06 -0500 | |
---|---|---|
committer | 2021-01-24 14:49:49 -0500 | |
commit | fd3f7f769ca154a6bd82a7ad89544c5feeca3893 (patch) | |
tree | 7ff5db3da9dd5744234a6e45a7dcf4e479383ad1 /src | |
parent | 425ca2e0338eec61cadc5ea131a20c60152e9cc9 (diff) |
input.cpp, inputdev.cpp: Misc. fixes
- Fix a recent regression with processing XInput DPAD input item tokens
- Prevent code_to_token from blowing up in strange cases
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/input.cpp | 4 | ||||
-rw-r--r-- | src/emu/inputdev.cpp | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/emu/input.cpp b/src/emu/input.cpp index 0cc37abc1c9..f767254fb7b 100644 --- a/src/emu/input.cpp +++ b/src/emu/input.cpp @@ -832,6 +832,8 @@ std::string input_manager::code_to_token(input_code code) const { // determine the devclass part const char *devclass = (*devclass_token_table)[code.device_class()]; + if (devclass == nullptr) + return "INVALID"; // determine the devindex part; keyboard 0 doesn't show an index std::string devindex = string_format("%d", code.device_index() + 1); @@ -858,7 +860,7 @@ std::string input_manager::code_to_token(input_code code) const str.append("_").append(devcode); if (modifier != nullptr) str.append("_").append(modifier); - if (itemclass[0] != 0) + if (itemclass != nullptr && itemclass[0] != 0) str.append("_").append(itemclass); return str; } diff --git a/src/emu/inputdev.cpp b/src/emu/inputdev.cpp index 3ca876ff0d8..783bccf3a31 100644 --- a/src/emu/inputdev.cpp +++ b/src/emu/inputdev.cpp @@ -684,8 +684,7 @@ input_device_item::input_device_item(input_device &device, const char *name, voi else { // otherwise, create a tokenized name - m_token.assign(name); - strmakeupper(m_token); + m_token.assign(strmakeupper(name)); strdelchr(m_token, ' '); strdelchr(m_token, '_'); } |