| 10276 | } |
| 10277 | |
| 10278 | static void inputdevice_get_previous_joy(struct uae_prefs *p, int portnum, bool userconfig) |
| 10279 | { |
| 10280 | struct jport *jpx = &p->jports[portnum]; |
| 10281 | |
| 10282 | if (!userconfig) { |
| 10283 | // default.uae with unplugged device -> NONE |
| 10284 | p->jports[portnum].id = JPORT_NONE; |
| 10285 | return; |
| 10286 | } |
| 10287 | bool found = false; |
| 10288 | int idx = 0; |
| 10289 | for (;;) { |
| 10290 | struct jport *jp = inputdevice_get_used_device(portnum, idx); |
| 10291 | if (!jp) |
| 10292 | break; |
| 10293 | if (jp->idc.configname[0]) { |
| 10294 | found = inputdevice_joyport_config(p, jp->idc.name, jp->idc.configname, portnum, jp->mode, jp->submode, 1, true) != 0; |
| 10295 | if (!found && jp->id == JPORT_UNPLUGGED) |
| 10296 | found = inputdevice_joyport_config(p, jp->idc.name, NULL, portnum, jp->mode, jp->submode, 1, true) != 0; |
| 10297 | } else if (jp->id < JSEM_JOYS && jp->id >= 0) { |
| 10298 | jpx->id = jp->id; |
| 10299 | found = true; |
| 10300 | } |
| 10301 | if (found) { |
| 10302 | jpx->mode = jp->mode; |
| 10303 | jpx->autofire = jp->autofire; |
| 10304 | inputdevice_set_newest_used_device(portnum, jp); |
| 10305 | break; |
| 10306 | } |
| 10307 | idx++; |
| 10308 | } |
| 10309 | if (!found) { |
| 10310 | if (default_keyboard_layout[portnum] > 0) { |
| 10311 | p->jports[portnum].id = default_keyboard_layout[portnum] - 1; |
| 10312 | } else { |
| 10313 | p->jports[portnum].id = JPORT_NONE; |
| 10314 | } |
| 10315 | } |
| 10316 | } |
| 10317 | |
| 10318 | void inputdevice_validate_jports (struct uae_prefs *p, int changedport, bool *fixedports) |
| 10319 | { |
no test coverage detected