summaryrefslogtreecommitdiff
path: root/apps/plugins/chessbox
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2006-02-23 21:16:51 +0000
committerDave Chapman <dave@dchapman.com>2006-02-23 21:16:51 +0000
commita3cfe0a434fd1ef5e4a59e34499d10cd0211f76b (patch)
treeca8a479c1b6a73a75b829c8799813747e20408ac /apps/plugins/chessbox
parente37654521144e1d224f0044268643f20e3b8a363 (diff)
downloadrockbox-a3cfe0a434fd1ef5e4a59e34499d10cd0211f76b.tar.gz
rockbox-a3cfe0a434fd1ef5e4a59e34499d10cd0211f76b.zip
Fixes to Chessclock from Miguel (to make it work again after we broke his patch), plus iPod button mapping changes from me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8816 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/chessbox')
-rw-r--r--apps/plugins/chessbox/Makefile3
-rw-r--r--apps/plugins/chessbox/chessbox.c13
-rw-r--r--apps/plugins/chessbox/gnuchess.c10
-rw-r--r--apps/plugins/chessbox/gnuchess.h5
4 files changed, 16 insertions, 15 deletions
diff --git a/apps/plugins/chessbox/Makefile b/apps/plugins/chessbox/Makefile
index be75b2c5e1..05b6d8f6a7 100644
--- a/apps/plugins/chessbox/Makefile
+++ b/apps/plugins/chessbox/Makefile
@@ -9,7 +9,7 @@
9 9
10INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ 10INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) 11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
12CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 12CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
13 -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN 13 -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
14 14
15ifdef APPEXTRA 15ifdef APPEXTRA
@@ -109,4 +109,3 @@ clean:
109 @rm -f $(OBJDIR)/chessbox.* $(DEPFILE) 109 @rm -f $(OBJDIR)/chessbox.* $(DEPFILE)
110 110
111-include $(DEPFILE) 111-include $(DEPFILE)
112
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c
index d16497dc6a..0d145ec00a 100644
--- a/apps/plugins/chessbox/chessbox.c
+++ b/apps/plugins/chessbox/chessbox.c
@@ -31,9 +31,6 @@ struct cb_command {
31 unsigned short mv; 31 unsigned short mv;
32}; 32};
33 33
34/* global rockbox api */
35static struct plugin_api* rb;
36
37/* External bitmaps */ 34/* External bitmaps */
38extern const fb_data chessbox_pieces[]; 35extern const fb_data chessbox_pieces[];
39 36
@@ -43,13 +40,13 @@ PLUGIN_HEADER
43/* button definitions */ 40/* button definitions */
44#if (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD) 41#if (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
45#define CB_SELECT BUTTON_SELECT 42#define CB_SELECT BUTTON_SELECT
46#define CB_UP BUTTON_SCROLL_BACK 43#define CB_UP BUTTON_MENU
47#define CB_DOWN BUTTON_SCROLL_FWD 44#define CB_DOWN BUTTON_PLAY
48#define CB_LEFT BUTTON_LEFT 45#define CB_LEFT BUTTON_LEFT
49#define CB_RIGHT BUTTON_RIGHT 46#define CB_RIGHT BUTTON_RIGHT
50#define CB_PLAY BUTTON_PLAY 47#define CB_PLAY (BUTTON_SELECT | BUTTON_PLAY)
51#define CB_LEVEL BUTTON_MENU 48#define CB_LEVEL (BUTTON_SELECT | BUTTON_RIGHT)
52#define CB_QUIT BUTTON_REL 49#define CB_QUIT (BUTTON_SELECT | BUTTON_MENU)
53 50
54#elif CONFIG_KEYPAD == IAUDIO_X5_PAD 51#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
55#define CB_SELECT BUTTON_MENU 52#define CB_SELECT BUTTON_MENU
diff --git a/apps/plugins/chessbox/gnuchess.c b/apps/plugins/chessbox/gnuchess.c
index ed4a7f2a0f..45ca66e778 100644
--- a/apps/plugins/chessbox/gnuchess.c
+++ b/apps/plugins/chessbox/gnuchess.c
@@ -66,7 +66,7 @@
66#define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b])) 66#define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b]))
67 67
68/* ---- RockBox datatypes and variables */ 68/* ---- RockBox datatypes and variables */
69static struct plugin_api* rb; 69struct plugin_api* rb;
70 70
71/* ---- Chess datatypes and variables ---- */ 71/* ---- Chess datatypes and variables ---- */
72struct leaf 72struct leaf
@@ -332,8 +332,7 @@ short pscore[3];
332 xside = otherside[side]; 332 xside = otherside[side];
333 pscore[white] = pscore[black] = 0; 333 pscore[white] = pscore[black] = 0;
334 334
335 /* ok, I will yield here although this function will be called much more 335 /* ok, I will yield here for lower levels */
336 many times than needed I think */
337 rb->yield(); 336 rb->yield();
338 337
339 for (c1 = white; c1 <= black; c1++) 338 for (c1 = white; c1 <= black; c1++)
@@ -1238,6 +1237,9 @@ short xside,pbst,d,e,cf,score,rcnt;
1238unsigned short mv,nxtline[maxdepth]; 1237unsigned short mv,nxtline[maxdepth];
1239struct leaf *node,tmp; 1238struct leaf *node,tmp;
1240 1239
1240 /* ok, I will yield here for higher levels */
1241 rb->yield();
1242
1241 NodeCnt++; 1243 NodeCnt++;
1242 xside = otherside[side]; 1244 xside = otherside[side];
1243 1245
@@ -2353,7 +2355,7 @@ void GNUChess_Initialize ( void ) {
2353 /*ttable = (struct hashentry *)malloc(ttblsz * 2355 /*ttable = (struct hashentry *)malloc(ttblsz *
2354 (unsigned long)sizeof(struct hashentry));*/ 2356 (unsigned long)sizeof(struct hashentry));*/
2355 buffer_size = ttblsz * sizeof(struct hashentry); 2357 buffer_size = ttblsz * sizeof(struct hashentry);
2356 ttable = rb->plugin_get_buffer( &buffer_size ); 2358 ttable = (struct hashentry *)rb->plugin_get_buffer( &buffer_size );
2357 Level = 1; 2359 Level = 1;
2358 OperatorTime = 0; 2360 OperatorTime = 0;
2359 TCmoves = 60; 2361 TCmoves = 60;
diff --git a/apps/plugins/chessbox/gnuchess.h b/apps/plugins/chessbox/gnuchess.h
index 6ea77dc00b..68ef9f9a81 100644
--- a/apps/plugins/chessbox/gnuchess.h
+++ b/apps/plugins/chessbox/gnuchess.h
@@ -19,7 +19,7 @@
19#define valueQ 1100 19#define valueQ 1100
20#define valueK 1200 20#define valueK 1200
21 21
22 22/* ---- chess system global variables ---- */
23extern short mate,opponent,computer; 23extern short mate,opponent,computer;
24extern short locn[8][8]; 24extern short locn[8][8];
25extern short board[64]; 25extern short board[64];
@@ -27,7 +27,10 @@ extern short color[64];
27extern long Level; 27extern long Level;
28extern short TCflag,TCmoves,TCminutes; 28extern short TCflag,TCmoves,TCminutes;
29 29
30/* ---- RockBox integration ---- */
31extern struct plugin_api* rb;
30 32
33/* ---- The beginning of a GNUChess v2 APIfication ---- */
31void SetTimeControl(void); 34void SetTimeControl(void);
32void GNUChess_Initialize(void); 35void GNUChess_Initialize(void);
33int VerifyMove(char s[],short iop,unsigned short *mv); 36int VerifyMove(char s[],short iop,unsigned short *mv);