summaryrefslogtreecommitdiffstats
path: root/apps/plugins/puzzles
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles')
-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
src/laydomino.c
src/loopgen.c
/*src/malloc.c*/ /* we have our own */
-src/maxflow.c
+src/matching.c
src/midend.c
src/misc.c
src/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
/* no c200v2 */
#if PLUGIN_BUFFER_SIZE > 0x14000
-src/pearl.c
src/loopy.c
+src/pearl.c
src/solo.c
#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)
PUZZLES_OPTIMIZE = -Os # tiny plugin buffer
endif
-# we suppress all warnings
-PUZZLESFLAGS = -I$(PUZZLES_SRCDIR)/dummy \
- $(filter-out -O%,$(PLUGINFLAGS)) $(PUZZLES_OPTIMIZE) \
- -Wno-unused-parameter -Wno-sign-compare -Wno-strict-aliasing -w \
- -DFOR_REAL -I$(PUZZLES_SRCDIR)/src -I$(PUZZLES_SRCDIR) -include \
- $(PUZZLES_SRCDIR)/rbcompat.h
+# we suppress all warnings with -w
+PUZZLESFLAGS = -I$(PUZZLES_SRCDIR)/dummy $(filter-out \
+ -O%,$(PLUGINFLAGS)) $(PUZZLES_OPTIMIZE) \
+ -Wno-unused-parameter -Wno-sign-compare \
+ -Wno-strict-aliasing -DFOR_REAL \
+ -I$(PUZZLES_SRCDIR)/src -I$(PUZZLES_SRCDIR) -include \
+ $(PUZZLES_SRCDIR)/rbcompat.h -ffunction-sections \
+ -fdata-sections -w
$(PUZZLES_OBJDIR)/sgt-%.rock: $(PUZZLES_OBJDIR)/src/%.o $(PUZZLES_OBJDIR)/help/%.o $(PUZZLES_SHARED_OBJ) $(TLSFLIB)
$(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 @@
#include "plugin.h"
#include "rbassert.h"
#include "lib/pluginlib_exit.h"
+#include "lib/stdio_compat.h"
#include <tlsf.h>
@@ -77,6 +78,4 @@ double acos_wrapper(double x);
#define abs(x) ((x)<0?-(x):(x))
-/* work around compilation error */
-typedef void FILE;
#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)
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;
}
}