| 4551 | } |
| 4552 | |
| 4553 | static void queue_input_event (int evt, const TCHAR *custom, int state, int max, int linecnt, int autofire) |
| 4554 | { |
| 4555 | struct input_queue_struct *iq; |
| 4556 | int idx; |
| 4557 | |
| 4558 | if (!evt) |
| 4559 | return; |
| 4560 | idx = check_input_queue (evt); |
| 4561 | if (state < 0 && idx >= 0) { |
| 4562 | iq = &input_queue[idx]; |
| 4563 | iq->nextlinecnt = -1; |
| 4564 | iq->linecnt = -1; |
| 4565 | iq->evt = 0; |
| 4566 | if (iq->state == 0 && evt > 0) |
| 4567 | handle_input_event (evt, 0, 1, 0); |
| 4568 | } else if (state >= 0 && idx < 0) { |
| 4569 | if (evt == 0 && custom == NULL) |
| 4570 | return; |
| 4571 | for (idx = 0; idx < INPUT_QUEUE_SIZE; idx++) { |
| 4572 | iq = &input_queue[idx]; |
| 4573 | if (iq->linecnt < 0) |
| 4574 | break; |
| 4575 | } |
| 4576 | if (idx == INPUT_QUEUE_SIZE) { |
| 4577 | write_log (_T("input queue overflow\n")); |
| 4578 | return; |
| 4579 | } |
| 4580 | xfree (iq->custom); |
| 4581 | iq->custom = NULL; |
| 4582 | if (custom) |
| 4583 | iq->custom = my_strdup (custom); |
| 4584 | iq->evt = evt; |
| 4585 | iq->state = iq->storedstate = state; |
| 4586 | iq->max = max; |
| 4587 | iq->linecnt = linecnt < 0 ? maxvpos + maxvpos / 2 : linecnt; |
| 4588 | iq->nextlinecnt = autofire > 0 ? linecnt : -1; |
| 4589 | } |
| 4590 | } |
| 4591 | |
| 4592 | static uae_u8 keybuf[256]; |
| 4593 | #define MAX_PENDING_EVENTS 20 |
no test coverage detected