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

Function inputdevice_get_used_device

src/inputdevice.cpp:617–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

615}
616
617static 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
641static void inputdevice_store_clear(void)
642{

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected