{
int i;
+ //write_log(_T("%s\n"), s);
+
if (!_tcsncmp(s, _T("KEY_RAW_"), 8)) {
// KEY_RAW_UP <code>
// KEY_RAW_DOWN <code>
{
TCHAR *event_string;
int delay;
+ int append;
struct delayed_event *next;
};
static struct delayed_event *delayed_events;
-static int handle_custom_event (const TCHAR *custom)
+int handle_custom_event (const TCHAR *custom, int append)
{
TCHAR *p, *buf, *nextp;
bool noquot = false;
+ bool first = true;
+ int adddelay = 0;
- if (custom == NULL)
+ if (custom == NULL) {
return 0;
- set_config_changed ();
- write_log (_T("%s\n"), custom);
+ }
+ //write_log (_T("%s\n"), custom);
+
+ if (append) {
+ struct delayed_event *dee = delayed_events;
+ while (dee) {
+ if (dee->delay > 0 && dee->delay > adddelay && dee->append) {
+ adddelay = dee->delay;
+ }
+ dee = dee->next;
+ }
+ }
+
p = buf = my_strdup_trim (custom);
if (p[0] != '\"')
noquot = true;
while (p && *p) {
- TCHAR *p2;
+ TCHAR *p2 = NULL;
if (!noquot) {
if (*p != '\"')
break;
}
}
//write_log (L"-> '%s'\n", p);
- if (!_tcsnicmp (p, _T("delay "), 6)) {
- int delay = _tstol (p + 6);
+ if (!_tcsnicmp (p, _T("delay "), 6) || !_tcsnicmp (p, _T("vdelay "), 7) || !_tcsnicmp (p, _T("hdelay "), 7) || adddelay) {
+ TCHAR *next = NULL;
+ int delay = -1;
+ if (!_tcsnicmp (p, _T("delay "), 6)) {
+ next = p + 7;
+ delay = _tstol(p + 6) * maxvpos_nom;
+ if (!delay)
+ delay = maxvpos_nom;
+ } else if (!_tcsnicmp (p, _T("vdelay "), 7)) {
+ next = p + 8;
+ delay = _tstol(p + 7) * maxvpos_nom;
+ if (!delay)
+ delay = maxvpos_nom;
+ } else if (!_tcsnicmp (p, _T("hdelay "), 7)) {
+ next = p + 8;
+ delay = _tstol(p + 7);
+ }
+ if (adddelay > 0 && adddelay > delay)
+ delay = adddelay;
if (delay >= 0) {
+ if (!p2) {
+ if (!next)
+ p2 = p;
+ else
+ p2 = _tcschr(next, ' ');
+ }
struct delayed_event *de = delayed_events;
while (de) {
if (de->delay < 0) {
de->delay = delay;
- de->event_string = my_strdup (p2);
+ de->event_string = p2 ? my_strdup (p2) : my_strdup(_T(""));
+ de->append = append;
break;
}
de = de->next;
de->next = delayed_events;
delayed_events = de;
de->delay = delay;
- de->event_string = my_strdup (p2);
+ de->append = append;
+ de->event_string = p2 ? my_strdup (p2) : my_strdup(_T(""));
}
}
break;
- } else if (!_tcsicmp (p, _T("no_config_check"))) {
+ }
+ if (first) {
+ first = false;
+ if (!append)
+ set_config_changed ();
+ }
+ if (!_tcsicmp (p, _T("no_config_check"))) {
config_changed = 0;
} else if (!_tcsicmp (p, _T("do_config_check"))) {
set_config_changed ();
if (pp)
*pp++ = 0;
inputdevice_uaelib (p, pp);
+ } else if (!_tcsnicmp(p, _T("key_raw_up "), 11)) {
+ TCHAR *pp = _tcschr (p + 10, ' ');
+ if (pp) {
+ *pp++ = 0;
+ inputdevice_uaelib (p, pp);
+ }
+ } else if (!_tcsnicmp(p, _T("key_raw_down "), 13)) {
+ TCHAR *pp = _tcschr (p + 12, ' ');
+ if (pp) {
+ *pp++ = 0;
+ inputdevice_uaelib (p, pp);
+ }
} else {
cfgfile_parse_line (&changed_prefs, p, 0);
}
catweasel_hsync ();
#endif
+ struct delayed_event *de = delayed_events;
+ while (de) {
+ if (de->delay > 0)
+ de->delay--;
+ if (de->delay == 0) {
+ de->delay = -1;
+ if (de->event_string) {
+ TCHAR *s = de->event_string;
+ de->event_string = NULL;
+ handle_custom_event (s, 0);
+ xfree (s);
+ }
+ }
+ de = de->next;
+ }
+
for (int i = 0; i < INPUT_QUEUE_SIZE; i++) {
struct input_queue_struct *iq = &input_queue[i];
if (iq->linecnt > 0) {
else
iq->state = iq->storedstate;
if (iq->custom)
- handle_custom_event (iq->custom);
+ handle_custom_event (iq->custom, 0);
if (iq->evt)
handle_input_event (iq->evt, iq->state, iq->max, 0, false, true);
iq->linecnt = iq->nextlinecnt;
int send_input_event (int nr, int state, int max, int autofire)
{
+ check_enable(nr);
return handle_input_event(nr, state, max, autofire, false, false);
}
mouseupdate (0, true);
inputread = -1;
- struct delayed_event *de = delayed_events;
- while (de) {
- if (de->delay > 0)
- de->delay--;
- if (de->delay == 0) {
- de->delay = -1;
- if (de->event_string) {
- TCHAR *s = de->event_string;
- de->event_string = NULL;
- handle_custom_event (s);
- xfree (s);
- }
- }
- de = de->next;
- }
-
inputdevice_handle_inputcode ();
if (mouseedge_alive > 0)
mouseedge_alive--;
xfree (de->event_string);
xfree (de);
}
-
}
static int getoldport (struct uae_input_device *id)
if (state && custom) {
if (autofire)
queue_input_event (-1, custom, 1, 1, currprefs.input_autofire_linecnt, 1);
- handle_custom_event (custom);
+ handle_custom_event (custom, 0);
return true;
}
}
if (autofire)
queue_input_event (-1, custom, 1, 1, currprefs.input_autofire_linecnt, 1);
if (custom)
- handle_custom_event (custom);
+ handle_custom_event (custom, 0);
}
id->flags[offset][slotoffset] &= ~(ID_FLAG_CUSTOMEVENT_TOGGLED1 | ID_FLAG_CUSTOMEVENT_TOGGLED2);