keydev: fix timing or repeat release

This commit is contained in:
Lephe 2024-01-07 16:47:51 +01:00
parent 18a7b9ae5b
commit 235fa8a361
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 16 additions and 11 deletions

1
TODO
View File

@ -17,7 +17,6 @@ Extensions on existing code:
* core: run destructors when a task-switch results in leaving the app
* fs: support read-only files backed with GetBlockAddress() on fx-CG
* kernel: SH4- or G-III-specific linker scripts?
* keysc: global shortcut SHIFT+0+EXIT for abort() as an infinite loop break
Future directions:
* Audio playback using TSWilliamson's libsnd method

View File

@ -142,6 +142,22 @@ void keydev_tick(keydev_t *d, uint us)
d->time++;
/* Disable repeat if the repeating key was released */
if(d->rep_key != 0)
{
int row = (d->rep_key >> 4);
int col = 0x80 >> (d->rep_key & 0x7);
if(!(d->state_now[row] & col))
{
d->rep_key = 0;
d->rep_count = -1;
d->rep_time = -1;
d->rep_delay = -1;
d->delayed_shift = 0;
d->delayed_alpha = 0;
}
}
if(d->rep_key != 0)
{
if(d->rep_delay >= 0)
@ -193,16 +209,6 @@ key_event_t keydev_unqueue_event(keydev_t *d)
{
d->state_queue[row] &= ~col;
d->state_flips[row] ^= col;
/* End the current repeating streak */
if(d->rep_key == ev.key)
{
d->rep_key = 0;
d->rep_count = -1;
d->rep_time = -1;
d->rep_delay = -1;
d->delayed_shift = 0;
d->delayed_alpha = 0;
}
}
return ev;