diff options
author | Franklin Wei <git@fwei.tk> | 2018-04-24 19:05:49 -0400 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2018-04-24 19:06:30 -0400 |
commit | 992a12670e65eab504eec2f8c4d7a120a4a6dd50 (patch) | |
tree | 523beb13e924f07fad2c9b95da26dfb6915e556d /apps/plugins/puzzles/rockbox.c | |
parent | b29611fe2c629d8d951d969875a57132df055bdd (diff) | |
download | rockbox-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.c | 24 |
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) static int choose_key(void) { - char *game_keys = NULL; + int options = 0; - const game *gm = midend_which_game(me); - if(gm->request_keys) - game_keys = gm->request_keys(midend_get_params(me)); + key_label *game_keys = midend_request_keys(me, &options); - if(!game_keys) - return; + if(!game_keys || !options) + return 0; - int options = strlen(game_keys); int sel = 0; while(1) { - midend_process_key(me, 0, 0, game_keys[sel]); + if(timer_on) + timer_cb(); + midend_process_key(me, 0, 0, game_keys[sel].button); midend_redraw(me); rb->lcd_update(); + rb->yield(); - int button = rb->button_get(true); + int button = rb->button_get_w_tmo(timer_on ? TIMER_INTERVAL : -1); switch(button) { case BTN_LEFT: @@ -1538,11 +1538,9 @@ static int choose_key(void) case BTN_PAUSE: return -1; case BTN_FIRE: - midend_force_redraw(me); - rb->lcd_update(); - free(game_keys); + free_keys(game_keys, options); - /* the key has already been sent to the game */ + /* the key has already been sent to the game, just return */ return 0; } } |