summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/rockbox.c
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2017-07-26 23:28:50 -0400
committerFranklin Wei <me@fwei.tk>2017-07-27 00:03:09 -0400
commit56dd2eaaf2ccee6f682d30e29b3b6babe1dc49ef (patch)
tree498d12ab6895bf38b0d6253afad83db976116dbb /apps/plugins/puzzles/rockbox.c
parent43e8e3e08b2ba3ce1f1748da0782f07b3fccafcb (diff)
downloadrockbox-56dd2eaaf2ccee6f682d30e29b3b6babe1dc49ef.zip
rockbox-56dd2eaaf2ccee6f682d30e29b3b6babe1dc49ef.tar.gz
rockbox-56dd2eaaf2ccee6f682d30e29b3b6babe1dc49ef.tar.bz2
rockbox-56dd2eaaf2ccee6f682d30e29b3b6babe1dc49ef.tar.xz
puzzles: new input scheme for Mines and Magnets
Both these puzzles now have long press mapped to spacebar.
Diffstat (limited to 'apps/plugins/puzzles/rockbox.c')
-rw-r--r--apps/plugins/puzzles/rockbox.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index 2f07b39..511c1ee 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -1641,6 +1641,15 @@ static int process_input(int tmo)
/* weird stuff */
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();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -1666,12 +1675,17 @@ static int process_input(int tmo)
return rc;
}
- /* special case for inertia: moves occur after RELEASES */
- if(!strcmp("Inertia", midend_which_game(me)->name))
+ /* these three games require, for one reason or another, that
+ * 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);
unsigned released = ~button & last_keystate;
+
last_keystate = button;
if(!button)
@@ -1691,16 +1705,17 @@ static int process_input(int tmo)
return 0;
}
- button |= released;
- if(last_keystate)
+ if(button)
{
LOGF("ignoring input from now until all released");
accept_input = false;
}
+
+ button |= released;
LOGF("accepting event 0x%08x", button);
}
/* 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 */
if(!button)