forked from len0rd/rockbox
puzzles: new input scheme for Mines and Magnets
Both these puzzles now have long press mapped to spacebar.
This commit is contained in:
parent
f1b82b1acf
commit
076cf0aa9b
1 changed files with 20 additions and 5 deletions
|
@ -1641,6 +1641,15 @@ static int process_input(int tmo)
|
||||||
/* weird stuff */
|
/* weird stuff */
|
||||||
exit_on_usb(button);
|
exit_on_usb(button);
|
||||||
|
|
||||||
|
/* these games require a second input on long-press */
|
||||||
|
if(accept_input && (button == (BTN_FIRE | BUTTON_REPEAT)) &&
|
||||||
|
(strcmp("Mines", midend_which_game(me)->name) != 0 ||
|
||||||
|
strcmp("Magnets", midend_which_game(me)->name) != 0))
|
||||||
|
{
|
||||||
|
accept_input = false;
|
||||||
|
return ' ';
|
||||||
|
}
|
||||||
|
|
||||||
button = rb->button_status();
|
button = rb->button_status();
|
||||||
|
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
@ -1666,12 +1675,17 @@ static int process_input(int tmo)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* special case for inertia: moves occur after RELEASES */
|
/* these three games require, for one reason or another, that
|
||||||
if(!strcmp("Inertia", midend_which_game(me)->name))
|
* events fire upon buttons being released rather than when they
|
||||||
|
* are pressed */
|
||||||
|
if(strcmp("Inertia", midend_which_game(me)->name) == 0 ||
|
||||||
|
strcmp("Mines", midend_which_game(me)->name) == 0 ||
|
||||||
|
strcmp("Magnets", midend_which_game(me)->name) == 0 )
|
||||||
{
|
{
|
||||||
LOGF("received button 0x%08x", button);
|
LOGF("received button 0x%08x", button);
|
||||||
|
|
||||||
unsigned released = ~button & last_keystate;
|
unsigned released = ~button & last_keystate;
|
||||||
|
|
||||||
last_keystate = button;
|
last_keystate = button;
|
||||||
|
|
||||||
if(!button)
|
if(!button)
|
||||||
|
@ -1691,16 +1705,17 @@ static int process_input(int tmo)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
button |= released;
|
if(button)
|
||||||
if(last_keystate)
|
|
||||||
{
|
{
|
||||||
LOGF("ignoring input from now until all released");
|
LOGF("ignoring input from now until all released");
|
||||||
accept_input = false;
|
accept_input = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button |= released;
|
||||||
LOGF("accepting event 0x%08x", button);
|
LOGF("accepting event 0x%08x", button);
|
||||||
}
|
}
|
||||||
/* default is to ignore repeats except for untangle */
|
/* default is to ignore repeats except for untangle */
|
||||||
else if(strcmp("Untangle", midend_which_game(me)->name))
|
else if(strcmp("Untangle", midend_which_game(me)->name) != 0)
|
||||||
{
|
{
|
||||||
/* start accepting input again after a release */
|
/* start accepting input again after a release */
|
||||||
if(!button)
|
if(!button)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue