| 615 | } |
| 616 | |
| 617 | static struct jport *inputdevice_get_used_device(int portnum, int ageindex) |
| 618 | { |
| 619 | int idx = -1; |
| 620 | int used[MAX_STORED_JPORTS] = { 0 }; |
| 621 | if (ageindex < 0) |
| 622 | return NULL; |
| 623 | while (ageindex >= 0) { |
| 624 | uae_u32 age = 0; |
| 625 | idx = -1; |
| 626 | for (int i = 0; i < MAX_STORED_JPORTS; i++) { |
| 627 | struct stored_jport *jp = &stored_jports[portnum][i]; |
| 628 | if (jp->inuse && !used[i] && jp->age > age) { |
| 629 | age = jp->age; |
| 630 | idx = i; |
| 631 | } |
| 632 | } |
| 633 | if (idx < 0) |
| 634 | return NULL; |
| 635 | used[idx] = 1; |
| 636 | ageindex--; |
| 637 | } |
| 638 | return &stored_jports[portnum][idx].jp; |
| 639 | } |
| 640 | |
| 641 | static void inputdevice_store_clear(void) |
| 642 | { |
no outgoing calls
no test coverage detected