summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/rockbox.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2018-04-24 19:05:49 -0400
committerFranklin Wei <git@fwei.tk>2018-04-24 19:06:30 -0400
commit992a12670e65eab504eec2f8c4d7a120a4a6dd50 (patch)
tree523beb13e924f07fad2c9b95da26dfb6915e556d /apps/plugins/puzzles/rockbox.c
parentb29611fe2c629d8d951d969875a57132df055bdd (diff)
downloadrockbox-992a12670e65eab504eec2f8c4d7a120a4a6dd50.tar.gz
rockbox-992a12670e65eab504eec2f8c4d7a120a4a6dd50.zip
puzzles: update frontend for new upstream, misc. changes
The upstream code changed a little bit with regard to the request_keys() API. Also, we save some bytes (especially on the c200v2) by compiling with -ffunction-sections and -fdata-sections, which allows Net to fit once again. Change-Id: I3ab30127169c73e4cd8996f0c12e1223ee18d79f
Diffstat (limited to 'apps/plugins/puzzles/rockbox.c')
-rw-r--r--apps/plugins/puzzles/rockbox.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index 1982da8e3e..e681db3c16 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -1506,25 +1506,25 @@ static void send_click(int button, bool release)
1506 1506
1507static int choose_key(void) 1507static int choose_key(void)
1508{ 1508{
1509 char *game_keys = NULL; 1509 int options = 0;
1510 1510
1511 const game *gm = midend_which_game(me); 1511 key_label *game_keys = midend_request_keys(me, &options);
1512 if(gm->request_keys)
1513 game_keys = gm->request_keys(midend_get_params(me));
1514 1512
1515 if(!game_keys) 1513 if(!game_keys || !options)
1516 return; 1514 return 0;
1517 1515
1518 int options = strlen(game_keys);
1519 int sel = 0; 1516 int sel = 0;
1520 1517
1521 while(1) 1518 while(1)
1522 { 1519 {
1523 midend_process_key(me, 0, 0, game_keys[sel]); 1520 if(timer_on)
1521 timer_cb();
1522 midend_process_key(me, 0, 0, game_keys[sel].button);
1524 midend_redraw(me); 1523 midend_redraw(me);
1525 rb->lcd_update(); 1524 rb->lcd_update();
1525 rb->yield();
1526 1526
1527 int button = rb->button_get(true); 1527 int button = rb->button_get_w_tmo(timer_on ? TIMER_INTERVAL : -1);
1528 switch(button) 1528 switch(button)
1529 { 1529 {
1530 case BTN_LEFT: 1530 case BTN_LEFT:
@@ -1538,11 +1538,9 @@ static int choose_key(void)
1538 case BTN_PAUSE: 1538 case BTN_PAUSE:
1539 return -1; 1539 return -1;
1540 case BTN_FIRE: 1540 case BTN_FIRE:
1541 midend_force_redraw(me); 1541 free_keys(game_keys, options);
1542 rb->lcd_update();
1543 free(game_keys);
1544 1542
1545 /* the key has already been sent to the game */ 1543 /* the key has already been sent to the game, just return */
1546 return 0; 1544 return 0;
1547 } 1545 }
1548 } 1546 }