From 40d99f434e50a1d3ad19750e663fead7cf08872e Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 24 Feb 2006 00:51:37 +0000 Subject: 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 --- apps/plugins/SOURCES | 65 ++++++++++++++++++++-------------------- apps/plugins/chessbox/Makefile | 15 ++++++++-- apps/plugins/chessbox/archos.lds | 46 ++++++++++++++++++++++++++++ apps/plugins/chessbox/chessbox.c | 22 ++++++++++++-- 4 files changed, 110 insertions(+), 38 deletions(-) create mode 100755 apps/plugins/chessbox/archos.lds 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 chessclock.c credits.c cube.c +dict.c favorites.c firmware_flash.c logo.c +metronome.c mosaique.c rockbox_flash.c search.c @@ -16,23 +18,20 @@ stats.c stopwatch.c vbrfix.c viewer.c -dict.c -metronome.c -#ifndef IRIVER_IFP7XX_SERIES /* Temporarily disable plugins for iFP7xx */ -#ifdef HAVE_LCD_BITMAP /* Recorder/Ondio models only */ +#ifndef IRIVER_IFP7XX_SERIES /* Temporarily disable plugins for iFP7xx */ +#ifdef HAVE_LCD_BITMAP /* Not for the Player */ -/* Plugins needing the grayscale lib */ -#if CONFIG_LCD != LCD_IPOD2BPP +#if CONFIG_LCD != LCD_IPOD2BPP /* Plugins needing the grayscale lib */ #ifndef HAVE_LCD_COLOR +grayscale.c fire.c #endif -plasma.c jpeg.c mandelbrot.c +plasma.c #endif -solitaire.c bejeweled.c bounce.c #if (LCD_WIDTH != 138) && (LCD_WIDTH != 128) @@ -43,19 +42,15 @@ calculator.c chip8.c demystify.c flipit.c -grayscale.c minesweeper.c oscillograph.c oscilloscope.c pong.c rockblox.c -#if (CONFIG_KEYPAD == RECORDER_PAD) && !defined(SIMULATOR) -/* loader, only needed for Archos */ -rockboy.c -#endif sliding_puzzle.c snake.c snake2.c +solitaire.c sokoban.c star.c starfield.c @@ -67,38 +62,42 @@ sudoku.c video.c #endif vu_meter.c +#if CONFIG_KEYPAD == RECORDER_PAD /* Recorder models only for now */ +wormlet.c +#endif #ifdef CONFIG_RTC -#if CONFIG_KEYPAD == RECORDER_PAD -/* Recorder models only for now */ +#if CONFIG_KEYPAD == RECORDER_PAD /* Recorder models only for now */ calendar.c clock.c #endif -#endif /* #ifdef CONFIG_RTC */ +#endif /* CONFIG_RTC */ -#if CONFIG_KEYPAD != ONDIO_PAD -/* gradually bring in the ones not working yet */ -wormlet.c -#endif /* #if CONFIG_KEYPAD != ONDIO_PAD */ -#endif /*#ifdef HAVE_LCD_BITMAP */ +#if (MEM <= 8) && !defined(SIMULATOR) /* loaders, only needed for Archos */ +chessbox.c +#if CONFIG_KEYPAD == RECORDER_PAD +rockboy.c +#endif +#endif -#ifdef HAVE_LCD_CHARCELLS /* Player model only */ +#endif /* HAVE_LCD_BITMAP */ + +#ifdef HAVE_LCD_CHARCELLS /* Player model only */ euroconverter.c jackpot.c nim.c -#endif /* #ifdef HAVE_LCD_CHARCELLS */ - -#ifndef HAVE_MMC -/* not for Ondio, has no remote control pin */ -alpine_cdc.c -#endif +#endif /* HAVE_LCD_CHARCELLS */ -#if CONFIG_CODEC == SWCODEC /* software codec platforms */ -mp3_encoder.c +#if CONFIG_CODEC == SWCODEC /* software codec platforms */ iriverify.c -wav2wv.c +mp3_encoder.c midi2wav.c -#else +wav2wv.c +#else /* hardware codec platforms */ +#ifndef HAVE_MMC /* not for Ondio, has no remote control pin */ +alpine_cdc.c +#endif splitedit.c +#endif /* CONFIG_CODEC */ + #endif /* iFP7xx */ -#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 @@ INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) -CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ +CFLAGS = $(GCCOPTS) -O2 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN ifdef APPEXTRA @@ -24,8 +24,17 @@ SOURCES = $(SRC) OBJS := $(SRC:%.c=$(OBJDIR)/%.o) DIRS = . -LDS := ../plugin.lds -OUTPUT = $(OUTDIR)/chessbox.rock +ifndef SIMVER +ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET))))) + LDS := archos.lds + OUTPUT = $(OUTDIR)/chessbox.ovl +else ## iRiver target + LDS := ../plugin.lds + OUTPUT = $(OUTDIR)/chessbox.rock +endif +else ## simulators + OUTPUT = $(OUTDIR)/chessbox.rock +endif all: $(OUTPUT) 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 @@ +#include "config.h" + +/* linker script for rockboy as an overlay, + * only used/ necessary for SH-based archos targets */ + +OUTPUT_FORMAT(elf32-sh) + +#define DRAMORIG 0x09000000 +#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE + +#define OVERLAY_LENGTH 0x20000 +#define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH) + +MEMORY +{ + OVERLAY_RAM : ORIGIN = OVERLAY_ORIGIN, LENGTH = OVERLAY_LENGTH +} + +SECTIONS +{ + .header : { + _plugin_start_addr = .; + *(.header) + } > OVERLAY_RAM + + .text : { + *(.text) + } > OVERLAY_RAM + + .rodata : { + *(.rodata) + *(.rodata.str1.1) + *(.rodata.str1.4) + } > OVERLAY_RAM + + .data : { + *(.data) + } > OVERLAY_RAM + + .bss : { + *(.bss) + *(COMMON) + . = ALIGN(0x4); + _plugin_end_addr = .; + } > OVERLAY_RAM +} 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 #define CB_QUIT BUTTON_OFF #elif CONFIG_KEYPAD == ONDIO_PAD +#define CB_SELECT_PRE BUTTON_MENU #define CB_SELECT (BUTTON_MENU|BUTTON_REL) #define CB_UP BUTTON_UP #define CB_DOWN BUTTON_DOWN #define CB_LEFT BUTTON_LEFT #define CB_RIGHT BUTTON_RIGHT -#define CB_PLAY BUTTON_MENU +#define CB_PLAY_PRE BUTTON_MENU +#define CB_PLAY (BUTTON_MENU|BUTTON_REPEAT) #define CB_LEVEL (BUTTON_MENU|BUTTON_OFF) #define CB_QUIT BUTTON_OFF @@ -133,6 +135,12 @@ PLUGIN_HEADER /*#define COMMAND_RESTART 4*/ #define COMMAND_QUIT 5 +/* GCC wants this to be present for some targets */ +void* memcpy(void* dst, const void* src, size_t size) +{ + return rb->memcpy(dst, src, size); +} + /* ---- Get the board column and row (e2 f.e.) for a physical x y ---- */ void xy2cr ( short x, short y, short *c, short *r ) { if (computer == black ) { @@ -286,7 +294,7 @@ void cb_levelup ( void ) { struct cb_command cb_getcommand (void) { static short x = 4 , y = 4 ; short c , r , l; - int button = BUTTON_NONE; + int button, lastbutton = BUTTON_NONE; int marked = false , from_marked = false ; short marked_x = 0 , marked_y = 0 ; struct cb_command result = { 0, {0,0,0,0,0}, 0 }; @@ -306,6 +314,10 @@ struct cb_command cb_getcommand (void) { result.type = COMMAND_LEVEL; return result; case CB_PLAY: +#ifdef CB_PLAY_PRE + if (lastbutton != CB_PLAY_PRE) + break; +#endif result.type = COMMAND_PLAY; return result; case CB_UP: @@ -369,6 +381,10 @@ struct cb_command cb_getcommand (void) { } break; case CB_SELECT: +#ifdef CB_SELECT_PRE + if (lastbutton != CB_SELECT_PRE) + break; +#endif if ( !marked ) { xy2cr ( x , y , &c , &r ); l = locn[r][c]; @@ -396,6 +412,8 @@ struct cb_command cb_getcommand (void) { } break; } + if (button != BUTTON_NONE) + lastbutton = button; } } -- cgit v1.2.3