mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-27 14:57:56 +00:00
KEYMAPPER: Remove action id length restriction
This commit is contained in:
parent
b7a816f1eb
commit
a449b87c5d
backends/keymapper
@ -29,12 +29,10 @@
|
||||
namespace Common {
|
||||
|
||||
Action::Action(Keymap *boss, const char *i, String des)
|
||||
: _boss(boss), description(des) {
|
||||
: _boss(boss), description(des), id(i) {
|
||||
assert(i);
|
||||
assert(_boss);
|
||||
|
||||
Common::strlcpy(id, i, ACTION_ID_SIZE);
|
||||
|
||||
_boss->addAction(this);
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,6 @@ namespace Common {
|
||||
struct HardwareInput;
|
||||
class Keymap;
|
||||
|
||||
#define ACTION_ID_SIZE (5)
|
||||
|
||||
struct KeyActionEntry {
|
||||
const KeyState ks;
|
||||
const char *id;
|
||||
@ -47,7 +45,7 @@ struct KeyActionEntry {
|
||||
|
||||
struct Action {
|
||||
/** unique id used for saving/loading to config */
|
||||
char id[ACTION_ID_SIZE];
|
||||
const char *id;
|
||||
/** Human readable description */
|
||||
String description;
|
||||
|
||||
|
@ -74,7 +74,7 @@ const HardwareInput *Keymap::getActionMapping(Action *action) const {
|
||||
|
||||
const Action *Keymap::findAction(const char *id) const {
|
||||
for (ActionList::const_iterator it = _actions.begin(); it != _actions.end(); ++it) {
|
||||
if (strncmp((*it)->id, id, ACTION_ID_SIZE) == 0)
|
||||
if (strcmp((*it)->id, id) == 0)
|
||||
return *it;
|
||||
}
|
||||
|
||||
@ -131,13 +131,7 @@ void Keymap::saveMappings() {
|
||||
const Action *action = it->_value;
|
||||
const HardwareInput *input = it->_key;
|
||||
|
||||
uint actIdLen = strlen(action->id);
|
||||
|
||||
actIdLen = (actIdLen > ACTION_ID_SIZE) ? ACTION_ID_SIZE : actIdLen;
|
||||
|
||||
String actId(action->id, action->id + actIdLen);
|
||||
|
||||
_configDomain->setVal(prefix + actId, input->id);
|
||||
_configDomain->setVal(prefix + action->id, input->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user