summaryrefslogtreecommitdiff
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
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
-rw-r--r--apps/plugins/puzzles/SOURCES2
-rw-r--r--apps/plugins/puzzles/SOURCES.games2
-rw-r--r--apps/plugins/puzzles/puzzles.make14
-rw-r--r--apps/plugins/puzzles/rbcompat.h3
-rw-r--r--apps/plugins/puzzles/rockbox.c24
5 files changed, 22 insertions, 23 deletions
diff --git a/apps/plugins/puzzles/SOURCES b/apps/plugins/puzzles/SOURCES
index f190daffb1..c9611548f9 100644
--- a/apps/plugins/puzzles/SOURCES
+++ b/apps/plugins/puzzles/SOURCES
@@ -13,7 +13,7 @@ src/latin.c
13src/laydomino.c 13src/laydomino.c
14src/loopgen.c 14src/loopgen.c
15/*src/malloc.c*/ /* we have our own */ 15/*src/malloc.c*/ /* we have our own */
16src/maxflow.c 16src/matching.c
17src/midend.c 17src/midend.c
18src/misc.c 18src/misc.c
19src/penrose.c 19src/penrose.c
diff --git a/apps/plugins/puzzles/SOURCES.games b/apps/plugins/puzzles/SOURCES.games
index 1b958d00ca..2b80ea3300 100644
--- a/apps/plugins/puzzles/SOURCES.games
+++ b/apps/plugins/puzzles/SOURCES.games
@@ -45,7 +45,7 @@ src/untangle.c
45 45
46/* no c200v2 */ 46/* no c200v2 */
47#if PLUGIN_BUFFER_SIZE > 0x14000 47#if PLUGIN_BUFFER_SIZE > 0x14000
48src/pearl.c
49src/loopy.c 48src/loopy.c
49src/pearl.c
50src/solo.c 50src/solo.c
51#endif 51#endif
diff --git a/apps/plugins/puzzles/puzzles.make b/apps/plugins/puzzles/puzzles.make
index 80a2aba76c..45f591d544 100644
--- a/apps/plugins/puzzles/puzzles.make
+++ b/apps/plugins/puzzles/puzzles.make
@@ -33,12 +33,14 @@ ifeq ($(MODELNAME), sansac200v2)
33PUZZLES_OPTIMIZE = -Os # tiny plugin buffer 33PUZZLES_OPTIMIZE = -Os # tiny plugin buffer
34endif 34endif
35 35
36# we suppress all warnings 36# we suppress all warnings with -w
37PUZZLESFLAGS = -I$(PUZZLES_SRCDIR)/dummy \ 37PUZZLESFLAGS = -I$(PUZZLES_SRCDIR)/dummy $(filter-out \
38 $(filter-out -O%,$(PLUGINFLAGS)) $(PUZZLES_OPTIMIZE) \ 38 -O%,$(PLUGINFLAGS)) $(PUZZLES_OPTIMIZE) \
39 -Wno-unused-parameter -Wno-sign-compare -Wno-strict-aliasing -w \ 39 -Wno-unused-parameter -Wno-sign-compare \
40 -DFOR_REAL -I$(PUZZLES_SRCDIR)/src -I$(PUZZLES_SRCDIR) -include \ 40 -Wno-strict-aliasing -DFOR_REAL \
41 $(PUZZLES_SRCDIR)/rbcompat.h 41 -I$(PUZZLES_SRCDIR)/src -I$(PUZZLES_SRCDIR) -include \
42 $(PUZZLES_SRCDIR)/rbcompat.h -ffunction-sections \
43 -fdata-sections -w
42 44
43$(PUZZLES_OBJDIR)/sgt-%.rock: $(PUZZLES_OBJDIR)/src/%.o $(PUZZLES_OBJDIR)/help/%.o $(PUZZLES_SHARED_OBJ) $(TLSFLIB) 45$(PUZZLES_OBJDIR)/sgt-%.rock: $(PUZZLES_OBJDIR)/src/%.o $(PUZZLES_OBJDIR)/help/%.o $(PUZZLES_SHARED_OBJ) $(TLSFLIB)
44 $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(PUZZLES_OBJDIR)/$*.elf \ 46 $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(PUZZLES_OBJDIR)/$*.elf \
diff --git a/apps/plugins/puzzles/rbcompat.h b/apps/plugins/puzzles/rbcompat.h
index ed1ae87653..272f97db30 100644
--- a/apps/plugins/puzzles/rbcompat.h
+++ b/apps/plugins/puzzles/rbcompat.h
@@ -4,6 +4,7 @@
4#include "plugin.h" 4#include "plugin.h"
5#include "rbassert.h" 5#include "rbassert.h"
6#include "lib/pluginlib_exit.h" 6#include "lib/pluginlib_exit.h"
7#include "lib/stdio_compat.h"
7 8
8#include <tlsf.h> 9#include <tlsf.h>
9 10
@@ -77,6 +78,4 @@ double acos_wrapper(double x);
77 78
78#define abs(x) ((x)<0?-(x):(x)) 79#define abs(x) ((x)<0?-(x):(x))
79 80
80/* work around compilation error */
81typedef void FILE;
82#endif 81#endif
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 }