1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Franklin Wei 2018-04-24 19:05:49 -04:00
parent b29611fe2c
commit 992a12670e
5 changed files with 22 additions and 23 deletions

View file

@ -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

View file

@ -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

View file

@ -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 \

View file

@ -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

View file

@ -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;
}
}