diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-02-24 00:51:37 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-02-24 00:51:37 +0000 |
commit | 40d99f434e50a1d3ad19750e663fead7cf08872e (patch) | |
tree | bdbf18247f4073292a41da0811fbf6e03872a551 /apps/plugins/chessbox | |
parent | 0b489779cee2297e66f999dc68261fa1df9f452f (diff) | |
download | rockbox-40d99f434e50a1d3ad19750e663fead7cf08872e.tar.gz rockbox-40d99f434e50a1d3ad19750e663fead7cf08872e.zip |
Made chessbox work on archos recorders and Ondios as an overlay. * Proper button handling for Ondio. * Some cleanup of the plugin SOURCES file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8822 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/chessbox')
-rw-r--r-- | apps/plugins/chessbox/Makefile | 15 | ||||
-rwxr-xr-x | apps/plugins/chessbox/archos.lds | 46 | ||||
-rw-r--r-- | apps/plugins/chessbox/chessbox.c | 22 |
3 files changed, 78 insertions, 5 deletions
diff --git a/apps/plugins/chessbox/Makefile b/apps/plugins/chessbox/Makefile index 05b6d8f6a7..7fe3e7115a 100644 --- a/apps/plugins/chessbox/Makefile +++ b/apps/plugins/chessbox/Makefile | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ | 10 | INCLUDES = -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) |
12 | CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ | 12 | CFLAGS = $(GCCOPTS) -O2 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ |
13 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN | 13 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN |
14 | 14 | ||
15 | ifdef APPEXTRA | 15 | ifdef APPEXTRA |
@@ -24,8 +24,17 @@ SOURCES = $(SRC) | |||
24 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) | 24 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) |
25 | DIRS = . | 25 | DIRS = . |
26 | 26 | ||
27 | LDS := ../plugin.lds | 27 | ifndef SIMVER |
28 | OUTPUT = $(OUTDIR)/chessbox.rock | 28 | ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET))))) |
29 | LDS := archos.lds | ||
30 | OUTPUT = $(OUTDIR)/chessbox.ovl | ||
31 | else ## iRiver target | ||
32 | LDS := ../plugin.lds | ||
33 | OUTPUT = $(OUTDIR)/chessbox.rock | ||
34 | endif | ||
35 | else ## simulators | ||
36 | OUTPUT = $(OUTDIR)/chessbox.rock | ||
37 | endif | ||
29 | 38 | ||
30 | all: $(OUTPUT) | 39 | all: $(OUTPUT) |
31 | 40 | ||
diff --git a/apps/plugins/chessbox/archos.lds b/apps/plugins/chessbox/archos.lds new file mode 100755 index 0000000000..693acd6335 --- /dev/null +++ b/apps/plugins/chessbox/archos.lds | |||
@@ -0,0 +1,46 @@ | |||
1 | #include "config.h" | ||
2 | |||
3 | /* linker script for rockboy as an overlay, | ||
4 | * only used/ necessary for SH-based archos targets */ | ||
5 | |||
6 | OUTPUT_FORMAT(elf32-sh) | ||
7 | |||
8 | #define DRAMORIG 0x09000000 | ||
9 | #define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE | ||
10 | |||
11 | #define OVERLAY_LENGTH 0x20000 | ||
12 | #define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH) | ||
13 | |||
14 | MEMORY | ||
15 | { | ||
16 | OVERLAY_RAM : ORIGIN = OVERLAY_ORIGIN, LENGTH = OVERLAY_LENGTH | ||
17 | } | ||
18 | |||
19 | SECTIONS | ||
20 | { | ||
21 | .header : { | ||
22 | _plugin_start_addr = .; | ||
23 | *(.header) | ||
24 | } > OVERLAY_RAM | ||
25 | |||
26 | .text : { | ||
27 | *(.text) | ||
28 | } > OVERLAY_RAM | ||
29 | |||
30 | .rodata : { | ||
31 | *(.rodata) | ||
32 | *(.rodata.str1.1) | ||
33 | *(.rodata.str1.4) | ||
34 | } > OVERLAY_RAM | ||
35 | |||
36 | .data : { | ||
37 | *(.data) | ||
38 | } > OVERLAY_RAM | ||
39 | |||
40 | .bss : { | ||
41 | *(.bss) | ||
42 | *(COMMON) | ||
43 | . = ALIGN(0x4); | ||
44 | _plugin_end_addr = .; | ||
45 | } > OVERLAY_RAM | ||
46 | } | ||
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c index 0d145ec00a..092de1825a 100644 --- a/apps/plugins/chessbox/chessbox.c +++ b/apps/plugins/chessbox/chessbox.c | |||
@@ -89,12 +89,14 @@ PLUGIN_HEADER | |||
89 | #define CB_QUIT BUTTON_OFF | 89 | #define CB_QUIT BUTTON_OFF |
90 | 90 | ||
91 | #elif CONFIG_KEYPAD == ONDIO_PAD | 91 | #elif CONFIG_KEYPAD == ONDIO_PAD |
92 | #define CB_SELECT_PRE BUTTON_MENU | ||
92 | #define CB_SELECT (BUTTON_MENU|BUTTON_REL) | 93 | #define CB_SELECT (BUTTON_MENU|BUTTON_REL) |
93 | #define CB_UP BUTTON_UP | 94 | #define CB_UP BUTTON_UP |
94 | #define CB_DOWN BUTTON_DOWN | 95 | #define CB_DOWN BUTTON_DOWN |
95 | #define CB_LEFT BUTTON_LEFT | 96 | #define CB_LEFT BUTTON_LEFT |
96 | #define CB_RIGHT BUTTON_RIGHT | 97 | #define CB_RIGHT BUTTON_RIGHT |
97 | #define CB_PLAY BUTTON_MENU | 98 | #define CB_PLAY_PRE BUTTON_MENU |
99 | #define CB_PLAY (BUTTON_MENU|BUTTON_REPEAT) | ||
98 | #define CB_LEVEL (BUTTON_MENU|BUTTON_OFF) | 100 | #define CB_LEVEL (BUTTON_MENU|BUTTON_OFF) |
99 | #define CB_QUIT BUTTON_OFF | 101 | #define CB_QUIT BUTTON_OFF |
100 | 102 | ||
@@ -133,6 +135,12 @@ PLUGIN_HEADER | |||
133 | /*#define COMMAND_RESTART 4*/ | 135 | /*#define COMMAND_RESTART 4*/ |
134 | #define COMMAND_QUIT 5 | 136 | #define COMMAND_QUIT 5 |
135 | 137 | ||
138 | /* GCC wants this to be present for some targets */ | ||
139 | void* memcpy(void* dst, const void* src, size_t size) | ||
140 | { | ||
141 | return rb->memcpy(dst, src, size); | ||
142 | } | ||
143 | |||
136 | /* ---- Get the board column and row (e2 f.e.) for a physical x y ---- */ | 144 | /* ---- Get the board column and row (e2 f.e.) for a physical x y ---- */ |
137 | void xy2cr ( short x, short y, short *c, short *r ) { | 145 | void xy2cr ( short x, short y, short *c, short *r ) { |
138 | if (computer == black ) { | 146 | if (computer == black ) { |
@@ -286,7 +294,7 @@ void cb_levelup ( void ) { | |||
286 | struct cb_command cb_getcommand (void) { | 294 | struct cb_command cb_getcommand (void) { |
287 | static short x = 4 , y = 4 ; | 295 | static short x = 4 , y = 4 ; |
288 | short c , r , l; | 296 | short c , r , l; |
289 | int button = BUTTON_NONE; | 297 | int button, lastbutton = BUTTON_NONE; |
290 | int marked = false , from_marked = false ; | 298 | int marked = false , from_marked = false ; |
291 | short marked_x = 0 , marked_y = 0 ; | 299 | short marked_x = 0 , marked_y = 0 ; |
292 | struct cb_command result = { 0, {0,0,0,0,0}, 0 }; | 300 | struct cb_command result = { 0, {0,0,0,0,0}, 0 }; |
@@ -306,6 +314,10 @@ struct cb_command cb_getcommand (void) { | |||
306 | result.type = COMMAND_LEVEL; | 314 | result.type = COMMAND_LEVEL; |
307 | return result; | 315 | return result; |
308 | case CB_PLAY: | 316 | case CB_PLAY: |
317 | #ifdef CB_PLAY_PRE | ||
318 | if (lastbutton != CB_PLAY_PRE) | ||
319 | break; | ||
320 | #endif | ||
309 | result.type = COMMAND_PLAY; | 321 | result.type = COMMAND_PLAY; |
310 | return result; | 322 | return result; |
311 | case CB_UP: | 323 | case CB_UP: |
@@ -369,6 +381,10 @@ struct cb_command cb_getcommand (void) { | |||
369 | } | 381 | } |
370 | break; | 382 | break; |
371 | case CB_SELECT: | 383 | case CB_SELECT: |
384 | #ifdef CB_SELECT_PRE | ||
385 | if (lastbutton != CB_SELECT_PRE) | ||
386 | break; | ||
387 | #endif | ||
372 | if ( !marked ) { | 388 | if ( !marked ) { |
373 | xy2cr ( x , y , &c , &r ); | 389 | xy2cr ( x , y , &c , &r ); |
374 | l = locn[r][c]; | 390 | l = locn[r][c]; |
@@ -396,6 +412,8 @@ struct cb_command cb_getcommand (void) { | |||
396 | } | 412 | } |
397 | break; | 413 | break; |
398 | } | 414 | } |
415 | if (button != BUTTON_NONE) | ||
416 | lastbutton = button; | ||
399 | } | 417 | } |
400 | 418 | ||
401 | } | 419 | } |