mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
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
This commit is contained in:
parent
295fb9b402
commit
171483bbd5
@ -832,6 +832,8 @@ std::string input_manager::code_to_token(input_code code) const
|
|||||||
{
|
{
|
||||||
// determine the devclass part
|
// determine the devclass part
|
||||||
const char *devclass = (*devclass_token_table)[code.device_class()];
|
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
|
// determine the devindex part; keyboard 0 doesn't show an index
|
||||||
std::string devindex = string_format("%d", code.device_index() + 1);
|
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);
|
str.append("_").append(devcode);
|
||||||
if (modifier != nullptr)
|
if (modifier != nullptr)
|
||||||
str.append("_").append(modifier);
|
str.append("_").append(modifier);
|
||||||
if (itemclass[0] != 0)
|
if (itemclass != nullptr && itemclass[0] != 0)
|
||||||
str.append("_").append(itemclass);
|
str.append("_").append(itemclass);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -684,8 +684,7 @@ input_device_item::input_device_item(input_device &device, const char *name, voi
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// otherwise, create a tokenized name
|
// otherwise, create a tokenized name
|
||||||
m_token.assign(name);
|
m_token.assign(strmakeupper(name));
|
||||||
strmakeupper(m_token);
|
|
||||||
strdelchr(m_token, ' ');
|
strdelchr(m_token, ' ');
|
||||||
strdelchr(m_token, '_');
|
strdelchr(m_token, '_');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user