| 2232 | } |
| 2233 | |
| 2234 | void inputdevice_parse_jport_custom(struct uae_prefs *pr, int index, int port, TCHAR *outname) |
| 2235 | { |
| 2236 | const TCHAR *eventstr = pr->jports_custom[index].custom; |
| 2237 | TCHAR data[CONFIG_BLEN]; |
| 2238 | TCHAR *bufp; |
| 2239 | int cnt = 0; |
| 2240 | |
| 2241 | custom_autoswitch_joy[index] = 0; |
| 2242 | custom_autoswitch_mouse[index] = 0; |
| 2243 | |
| 2244 | if (eventstr == NULL || eventstr[0] == 0) |
| 2245 | return; |
| 2246 | if (outname) |
| 2247 | outname[0] = 0; |
| 2248 | |
| 2249 | write_log(_T("parse_custom port %d, '%s'\n"), port, eventstr ? eventstr : _T("<NULL>")); |
| 2250 | |
| 2251 | _tcscpy(data, eventstr); |
| 2252 | _tcscat(data, _T(" ")); |
| 2253 | bufp = data; |
| 2254 | for (;;) { |
| 2255 | const struct inputevent *ie; |
| 2256 | TCHAR *next = bufp; |
| 2257 | TCHAR devtype; |
| 2258 | int devindex; |
| 2259 | int flags = 0; |
| 2260 | const TCHAR *bufp2 = bufp; |
| 2261 | struct uae_input_device *id = 0; |
| 2262 | int joystick = 0; |
| 2263 | int devnum = 0; |
| 2264 | int num = -1; |
| 2265 | int keynum = 0; |
| 2266 | int idtype = -1; |
| 2267 | int odevindex = -1; |
| 2268 | const TCHAR *pbufp = NULL; |
| 2269 | bool skipped = false; |
| 2270 | |
| 2271 | while (next != NULL && *next != ' ' && *next != 0) |
| 2272 | next++; |
| 2273 | if (!next || *next == 0) |
| 2274 | break; |
| 2275 | *next++ = 0; |
| 2276 | TCHAR *p = getstring(&bufp2); |
| 2277 | if (!p) |
| 2278 | goto skip; |
| 2279 | |
| 2280 | pbufp = bufp2; |
| 2281 | devindex = getnum(&bufp2); |
| 2282 | odevindex = devindex; |
| 2283 | if (*bufp == 0) |
| 2284 | goto skip; |
| 2285 | if (devindex < 0 || devindex >= MAX_INPUT_DEVICES) |
| 2286 | goto skip; |
| 2287 | |
| 2288 | devtype = _totupper(*p); |
| 2289 | if (devtype == 'M') { |
| 2290 | idtype = IDTYPE_MOUSE; |
| 2291 | } else if (devtype == 'J') { |
no test coverage detected