MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / inject_events

Function inject_events

src/inputdevice.cpp:4116–4205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4114}
4115
4116static void inject_events (const TCHAR *str)
4117{
4118 bool quot = false;
4119 bool first = true;
4120 uae_u8 keys[300];
4121 int keycnt = 0;
4122
4123 for (;;) {
4124 TCHAR ch = *str++;
4125 if (!ch)
4126 break;
4127
4128 if (ch == '\'') {
4129 first = false;
4130 quot = !quot;
4131 continue;
4132 }
4133
4134 if (!quot && (ch == ' ' || first)) {
4135 const TCHAR *s = str;
4136 if (first)
4137 s--;
4138 while (*s == ' ')
4139 s++;
4140 const TCHAR *s2 = s;
4141 while (*s && *s != ' ')
4142 s++;
4143 int s2len = (int)(s - s2);
4144 if (!s2len)
4145 break;
4146 for (int i = 1; events[i].name; i++) {
4147 const TCHAR *cf = events[i].confname;
4148 if (!_tcsnicmp (cf, _T("KEY_"), 4))
4149 cf += 4;
4150 if (events[i].allow_mask == AM_K && !_tcsnicmp (cf, s2, _tcslen (cf)) && s2len == _tcslen (cf)) {
4151 int j;
4152 uae_u8 kc = events[i].data << 1;
4153 TCHAR tch = _totupper (s2[0]);
4154 if (tch != s2[0]) {
4155 // release
4156 for (j = 0; j < keycnt; j++) {
4157 if (keys[j] == kc)
4158 keys[j] = 0xff;
4159 }
4160 kc |= 0x01;
4161 } else {
4162 for (j = 0; j < keycnt; j++) {
4163 if (keys[j] == kc) {
4164 kc = 0xff;
4165 }
4166 }
4167 if (kc != 0xff) {
4168 for (j = 0; j < keycnt; j++) {
4169 if (keys[j] == 0xff) {
4170 keys[j] = kc;
4171 break;
4172 }
4173 }

Callers 1

handle_custom_eventFunction · 0.85

Calls 1

record_keyFunction · 0.85

Tested by

no test coverage detected