From: notaz Date: Thu, 26 Jun 2008 20:27:33 +0000 (+0000) Subject: improved autorepeat behavior in menus X-Git-Tag: v1.85~460 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=385760631f8c75fff0882f8764dbcca9c898e896;p=picodrive.git improved autorepeat behavior in menus git-svn-id: file:///home/notaz/opt/svn/PicoDrive@499 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/platform/gizmondo/menu.c b/platform/gizmondo/menu.c index 1c74589a..9e1994dd 100644 --- a/platform/gizmondo/menu.c +++ b/platform/gizmondo/menu.c @@ -48,16 +48,17 @@ static unsigned int inp_prev = 0; static unsigned long wait_for_input(unsigned int interesting) { - unsigned int ret; - static int repeats = 0, wait = 50; + unsigned long ret; + static int repeats = 0, wait = 20; int release = 0, i; - if (repeats == 2 || repeats == 4) wait /= 2; - if (repeats == 6) wait = 15; + if (repeats == 2) wait = 3; + else if (repeats == 4) wait = 2; + else if (repeats == 6) wait = 1; - for (i = 0; i < 6 && inp_prev == Framework_PollGetButtons(); i++) { + for (i = 0; i < wait && inp_prev == Framework_PollGetButtons(); i++) { if (i == 0) repeats++; - Sleep(wait); + Sleep(30); } while ( !((ret = Framework_PollGetButtons()) & interesting) ) { @@ -67,8 +68,10 @@ static unsigned long wait_for_input(unsigned int interesting) if (release || ret != inp_prev) { repeats = 0; - wait = 50; + wait = 20; } + if (wait > 6 && (ret&(BTN_UP|BTN_LEFT|BTN_DOWN|BTN_RIGHT))) + wait = 6; inp_prev = ret; // we don't need diagonals in menus diff --git a/platform/gp2x/menu.c b/platform/gp2x/menu.c index 05d09035..db4c9fab 100644 --- a/platform/gp2x/menu.c +++ b/platform/gp2x/menu.c @@ -46,7 +46,7 @@ static int inp_prevjoy = 0; static unsigned long wait_for_input(unsigned long interesting) { unsigned long ret; - static int repeats = 0, wait = 6; + static int repeats = 0, wait = 20; int release = 0, i; if (repeats == 2) wait = 3; @@ -65,8 +65,10 @@ static unsigned long wait_for_input(unsigned long interesting) if (release || ret != inp_prev) { repeats = 0; - wait = 6; + wait = 20; } + if (wait > 6 && (ret&(GP2X_UP|GP2X_LEFT|GP2X_DOWN|GP2X_RIGHT))) + wait = 6; inp_prev = ret; inp_prevjoy = 0; diff --git a/platform/psp/menu.c b/platform/psp/menu.c index 744c99d0..85669aef 100644 --- a/platform/psp/menu.c +++ b/platform/psp/menu.c @@ -52,7 +52,7 @@ static unsigned int inp_prev = 0; static unsigned long wait_for_input(unsigned int interesting, int is_key_config) { unsigned int ret; - static int repeats = 0, wait = 6; + static int repeats = 0, wait = 20; int release = 0, count, i; if (!is_key_config) @@ -76,12 +76,14 @@ static unsigned long wait_for_input(unsigned int interesting, int is_key_config) if (release || ret != inp_prev) { repeats = 0; - wait = 6; + wait = 20; } inp_prev = ret; if (!is_key_config) ret |= (ret & 0xf0000000) >> 24; // use analog as d-pad + if (wait > 6 && (ret&(BTN_UP|BTN_LEFT|BTN_DOWN|BTN_RIGHT))) + wait = 6; // we don't need diagonals in menus if ((ret&BTN_UP) && (ret&BTN_LEFT)) ret &= ~BTN_LEFT;