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 | |
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
-rw-r--r-- | apps/plugins/SOURCES | 65 | ||||
-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 |
4 files changed, 110 insertions, 38 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 190d625829..a3bfa07296 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -4,9 +4,11 @@ battery_test.c | |||
4 | chessclock.c | 4 | chessclock.c |
5 | credits.c | 5 | credits.c |
6 | cube.c | 6 | cube.c |
7 | dict.c | ||
7 | favorites.c | 8 | favorites.c |
8 | firmware_flash.c | 9 | firmware_flash.c |
9 | logo.c | 10 | logo.c |
11 | metronome.c | ||
10 | mosaique.c | 12 | mosaique.c |
11 | rockbox_flash.c | 13 | rockbox_flash.c |
12 | search.c | 14 | search.c |
@@ -16,23 +18,20 @@ stats.c | |||
16 | stopwatch.c | 18 | stopwatch.c |
17 | vbrfix.c | 19 | vbrfix.c |
18 | viewer.c | 20 | viewer.c |
19 | dict.c | ||
20 | metronome.c | ||
21 | 21 | ||
22 | #ifndef IRIVER_IFP7XX_SERIES /* Temporarily disable plugins for iFP7xx */ | 22 | #ifndef IRIVER_IFP7XX_SERIES /* Temporarily disable plugins for iFP7xx */ |
23 | #ifdef HAVE_LCD_BITMAP /* Recorder/Ondio models only */ | 23 | #ifdef HAVE_LCD_BITMAP /* Not for the Player */ |
24 | 24 | ||
25 | /* Plugins needing the grayscale lib */ | 25 | #if CONFIG_LCD != LCD_IPOD2BPP /* Plugins needing the grayscale lib */ |
26 | #if CONFIG_LCD != LCD_IPOD2BPP | ||
27 | #ifndef HAVE_LCD_COLOR | 26 | #ifndef HAVE_LCD_COLOR |
27 | grayscale.c | ||
28 | fire.c | 28 | fire.c |
29 | #endif | 29 | #endif |
30 | plasma.c | ||
31 | jpeg.c | 30 | jpeg.c |
32 | mandelbrot.c | 31 | mandelbrot.c |
32 | plasma.c | ||
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | solitaire.c | ||
36 | bejeweled.c | 35 | bejeweled.c |
37 | bounce.c | 36 | bounce.c |
38 | #if (LCD_WIDTH != 138) && (LCD_WIDTH != 128) | 37 | #if (LCD_WIDTH != 138) && (LCD_WIDTH != 128) |
@@ -43,19 +42,15 @@ calculator.c | |||
43 | chip8.c | 42 | chip8.c |
44 | demystify.c | 43 | demystify.c |
45 | flipit.c | 44 | flipit.c |
46 | grayscale.c | ||
47 | minesweeper.c | 45 | minesweeper.c |
48 | oscillograph.c | 46 | oscillograph.c |
49 | oscilloscope.c | 47 | oscilloscope.c |
50 | pong.c | 48 | pong.c |
51 | rockblox.c | 49 | rockblox.c |
52 | #if (CONFIG_KEYPAD == RECORDER_PAD) && !defined(SIMULATOR) | ||
53 | /* loader, only needed for Archos */ | ||
54 | rockboy.c | ||
55 | #endif | ||
56 | sliding_puzzle.c | 50 | sliding_puzzle.c |
57 | snake.c | 51 | snake.c |
58 | snake2.c | 52 | snake2.c |
53 | solitaire.c | ||
59 | sokoban.c | 54 | sokoban.c |
60 | star.c | 55 | star.c |
61 | starfield.c | 56 | starfield.c |
@@ -67,38 +62,42 @@ sudoku.c | |||
67 | video.c | 62 | video.c |
68 | #endif | 63 | #endif |
69 | vu_meter.c | 64 | vu_meter.c |
65 | #if CONFIG_KEYPAD == RECORDER_PAD /* Recorder models only for now */ | ||
66 | wormlet.c | ||
67 | #endif | ||
70 | 68 | ||
71 | #ifdef CONFIG_RTC | 69 | #ifdef CONFIG_RTC |
72 | #if CONFIG_KEYPAD == RECORDER_PAD | 70 | #if CONFIG_KEYPAD == RECORDER_PAD /* Recorder models only for now */ |
73 | /* Recorder models only for now */ | ||
74 | calendar.c | 71 | calendar.c |
75 | clock.c | 72 | clock.c |
76 | #endif | 73 | #endif |
77 | #endif /* #ifdef CONFIG_RTC */ | 74 | #endif /* CONFIG_RTC */ |
78 | 75 | ||
79 | #if CONFIG_KEYPAD != ONDIO_PAD | 76 | #if (MEM <= 8) && !defined(SIMULATOR) /* loaders, only needed for Archos */ |
80 | /* gradually bring in the ones not working yet */ | 77 | chessbox.c |
81 | wormlet.c | 78 | #if CONFIG_KEYPAD == RECORDER_PAD |
82 | #endif /* #if CONFIG_KEYPAD != ONDIO_PAD */ | 79 | rockboy.c |
83 | #endif /*#ifdef HAVE_LCD_BITMAP */ | 80 | #endif |
81 | #endif | ||
84 | 82 | ||
85 | #ifdef HAVE_LCD_CHARCELLS /* Player model only */ | 83 | #endif /* HAVE_LCD_BITMAP */ |
84 | |||
85 | #ifdef HAVE_LCD_CHARCELLS /* Player model only */ | ||
86 | euroconverter.c | 86 | euroconverter.c |
87 | jackpot.c | 87 | jackpot.c |
88 | nim.c | 88 | nim.c |
89 | #endif /* #ifdef HAVE_LCD_CHARCELLS */ | 89 | #endif /* HAVE_LCD_CHARCELLS */ |
90 | |||
91 | #ifndef HAVE_MMC | ||
92 | /* not for Ondio, has no remote control pin */ | ||
93 | alpine_cdc.c | ||
94 | #endif | ||
95 | 90 | ||
96 | #if CONFIG_CODEC == SWCODEC /* software codec platforms */ | 91 | #if CONFIG_CODEC == SWCODEC /* software codec platforms */ |
97 | mp3_encoder.c | ||
98 | iriverify.c | 92 | iriverify.c |
99 | wav2wv.c | 93 | mp3_encoder.c |
100 | midi2wav.c | 94 | midi2wav.c |
101 | #else | 95 | wav2wv.c |
96 | #else /* hardware codec platforms */ | ||
97 | #ifndef HAVE_MMC /* not for Ondio, has no remote control pin */ | ||
98 | alpine_cdc.c | ||
99 | #endif | ||
102 | splitedit.c | 100 | splitedit.c |
101 | #endif /* CONFIG_CODEC */ | ||
102 | |||
103 | #endif /* iFP7xx */ | 103 | #endif /* iFP7xx */ |
104 | #endif | ||
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 | } |