Support uae-configuration on the fly input config changes.
This commit is contained in:
parent
0c40a7e472
commit
2ce9453e19
2 changed files with 32 additions and 20 deletions
|
@ -2803,9 +2803,8 @@ static int cfgfile_parse_host(struct uae_prefs* p, TCHAR* option, TCHAR* value)
|
|||
const TCHAR* tmp1;
|
||||
TCHAR* tmp2;
|
||||
|
||||
if (_tcsncmp(option, _T("input."), 6) == 0)
|
||||
{
|
||||
read_inputdevice_config(p, option, value);
|
||||
if (_tcsncmp (option, _T("input."), 6) == 0 || _tcsncmp(option, _T("input_"), 6) == 0) {
|
||||
read_inputdevice_config (p, option, value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -5544,11 +5543,15 @@ void cfgfile_addcfgparam(TCHAR* line)
|
|||
}
|
||||
if (!cfgfile_separate_line(line, line1b, line2b))
|
||||
return;
|
||||
u = xcalloc (struct strlist, 1);
|
||||
u->option = my_strdup(line1b);
|
||||
u->value = my_strdup(line2b);
|
||||
u->next = temp_lines;
|
||||
temp_lines = u;
|
||||
if (!_tcsnicmp(line1b, _T("input."), 6)) {
|
||||
line1b[5] = '_';
|
||||
}
|
||||
if (u) {
|
||||
u->option = my_strdup(line1b);
|
||||
u->value = my_strdup(line2b);
|
||||
u->next = temp_lines;
|
||||
temp_lines = u;
|
||||
}
|
||||
}
|
||||
|
||||
static int cmdlineparser(const TCHAR* s, TCHAR* outp[], int max)
|
||||
|
@ -7332,9 +7335,13 @@ void error_log(const TCHAR* format, ...)
|
|||
va_end(parms);
|
||||
|
||||
strlist* u = xcalloc(struct strlist, 1);
|
||||
u->option = my_strdup(bufp);
|
||||
u->next = error_lines;
|
||||
error_lines = u;
|
||||
if (u) {
|
||||
u->option = my_strdup(bufp);
|
||||
if (u->option) {
|
||||
u->next = error_lines;
|
||||
error_lines = u;
|
||||
}
|
||||
}
|
||||
|
||||
if (bufp != buffer)
|
||||
xfree(bufp);
|
||||
|
|
|
@ -1417,6 +1417,7 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *
|
|||
TCHAR *p2, *custom;
|
||||
struct temp_uids *tid = &temp_uid;
|
||||
struct inputdevice_functions *idf = NULL;
|
||||
bool directmode = option[5] == '_';
|
||||
|
||||
option += 6; /* "input." */
|
||||
p = getstring (&option);
|
||||
|
@ -1464,7 +1465,7 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *
|
|||
return;
|
||||
idnum--;
|
||||
|
||||
if (idnum != tid->idnum) {
|
||||
if (idnum != tid->idnum || directmode) {
|
||||
reset_inputdevice_config_temp();
|
||||
tid->idnum = idnum;
|
||||
}
|
||||
|
@ -1520,33 +1521,37 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *
|
|||
if (devtype != tid->lastdevtype) {
|
||||
tid->lastdevtype = devtype;
|
||||
}
|
||||
|
||||
if (!_tcscmp (p2, _T("name"))) {
|
||||
xfree(tid->configname);
|
||||
tid->configname = my_strdup (value);
|
||||
if (directmode) {
|
||||
tid->joystick = joystick;
|
||||
tid->devtype = devtype;
|
||||
}
|
||||
|
||||
if (!_tcscmp (p2, _T("name"))) {
|
||||
xfree(tid->configname);
|
||||
tid->configname = my_strdup (value);
|
||||
tid->custom = false;
|
||||
tid->empty = false;
|
||||
tid->disabled = false;
|
||||
tid->joystick = joystick;
|
||||
tid->devtype = devtype;
|
||||
return;
|
||||
}
|
||||
if (!_tcscmp (p2, _T("friendlyname"))) {
|
||||
xfree (tid->name);
|
||||
tid->name = my_strdup (value);
|
||||
tid->joystick = joystick;
|
||||
tid->devtype = devtype;
|
||||
tid->custom = false;
|
||||
tid->empty = false;
|
||||
tid->disabled = false;
|
||||
tid->joystick = joystick;
|
||||
tid->devtype = devtype;
|
||||
return;
|
||||
}
|
||||
if (!_tcscmp (p2, _T("custom"))) {
|
||||
p = value;
|
||||
tid->custom = getnum(&p);
|
||||
tid->empty = false;
|
||||
tid->joystick = joystick;
|
||||
tid->devtype = devtype;
|
||||
tid->empty = false;
|
||||
return;
|
||||
}
|
||||
if (!_tcscmp(p2, _T("empty"))) {
|
||||
|
@ -1636,7 +1641,7 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *
|
|||
return;
|
||||
}
|
||||
|
||||
if (newdev) {
|
||||
if (newdev && !directmode) {
|
||||
if (!tid->initialized)
|
||||
clear_id(id);
|
||||
if (!tid->empty && tid->devtype == IDTYPE_KEYBOARD && !tid->initialized) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue