diff options
Diffstat (limited to 'apps/plugins/goban')
-rw-r--r-- | apps/plugins/goban/archos.lds | 43 | ||||
-rw-r--r-- | apps/plugins/goban/goban.c | 56 | ||||
-rw-r--r-- | apps/plugins/goban/goban.make | 40 | ||||
-rw-r--r-- | apps/plugins/goban/sgf_storage.c | 13 |
4 files changed, 121 insertions, 31 deletions
diff --git a/apps/plugins/goban/archos.lds b/apps/plugins/goban/archos.lds new file mode 100644 index 0000000000..c17346ff0b --- /dev/null +++ b/apps/plugins/goban/archos.lds | |||
@@ -0,0 +1,43 @@ | |||
1 | #include "config.h" | ||
2 | |||
3 | /* linker script for goban as an overlay */ | ||
4 | |||
5 | OUTPUT_FORMAT(elf32-sh) | ||
6 | |||
7 | #define DRAMORIG 0x09000000 | ||
8 | #define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE | ||
9 | |||
10 | #define OVERLAY_LENGTH 0x10000 | ||
11 | #define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH) | ||
12 | |||
13 | MEMORY | ||
14 | { | ||
15 | OVERLAY_RAM : ORIGIN = OVERLAY_ORIGIN, LENGTH = OVERLAY_LENGTH | ||
16 | } | ||
17 | |||
18 | SECTIONS | ||
19 | { | ||
20 | .header : { | ||
21 | _plugin_start_addr = .; | ||
22 | KEEP(*(.header)) | ||
23 | } > OVERLAY_RAM | ||
24 | |||
25 | .text : { | ||
26 | *(.text*) | ||
27 | } > OVERLAY_RAM | ||
28 | |||
29 | .rodata : { | ||
30 | *(.rodata*) | ||
31 | } > OVERLAY_RAM | ||
32 | |||
33 | .data : { | ||
34 | *(.data*) | ||
35 | } > OVERLAY_RAM | ||
36 | |||
37 | .bss : { | ||
38 | *(.bss*) | ||
39 | *(COMMON) | ||
40 | . = ALIGN(0x4); | ||
41 | _plugin_end_addr = .; | ||
42 | } > OVERLAY_RAM | ||
43 | } | ||
diff --git a/apps/plugins/goban/goban.c b/apps/plugins/goban/goban.c index 04b74b7f59..20cccd7e03 100644 --- a/apps/plugins/goban/goban.c +++ b/apps/plugins/goban/goban.c | |||
@@ -1,25 +1,37 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * __________ __ ___. | 2 | * __________ __ ___. |
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2007-2009 Joshua Simmons <mud at majidejima dot com> | 10 | * Copyright (C) 2007-2009 Joshua Simmons <mud at majidejima dot com> |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 13 | * modify it under the terms of the GNU General Public License |
14 | * as published by the Free Software Foundation; either version 2 | 14 | * as published by the Free Software Foundation; either version 2 |
15 | * of the License, or (at your option) any later version. | 15 | * of the License, or (at your option) any later version. |
16 | * | 16 | * |
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | #include "plugin.h" | |
22 | #include "plugin.h" | 22 | |
23 | #if PLUGIN_BUFFER_SIZE < 0x10000 && !defined(SIMULATOR) | ||
24 | |||
25 | #include "lib/overlay.h" | ||
26 | |||
27 | PLUGIN_HEADER | ||
28 | |||
29 | enum plugin_status plugin_start(const void* parameter) | ||
30 | { | ||
31 | return run_overlay(parameter, PLUGIN_GAMES_DIR "/goban.ovl", "Goban"); | ||
32 | } | ||
33 | #endif | ||
34 | |||
23 | #include "lib/playback_control.h" | 35 | #include "lib/playback_control.h" |
24 | #include "lib/configfile.h" | 36 | #include "lib/configfile.h" |
25 | 37 | ||
diff --git a/apps/plugins/goban/goban.make b/apps/plugins/goban/goban.make index f3f96ff5c6..b8866fbc4f 100644 --- a/apps/plugins/goban/goban.make +++ b/apps/plugins/goban/goban.make | |||
@@ -8,15 +8,41 @@ | |||
8 | # | 8 | # |
9 | 9 | ||
10 | 10 | ||
11 | GOBANSRCDIR := $(APPSDIR)/plugins/goban | 11 | GOBAN_SRCDIR := $(APPSDIR)/plugins/goban |
12 | GOBANBUILDDIR := $(BUILDDIR)/apps/plugins/goban | 12 | GOBAN_BUILDDIR := $(BUILDDIR)/apps/plugins/goban |
13 | 13 | ||
14 | ROCKS += $(GOBANBUILDDIR)/goban.rock | 14 | GOBAN_SRC := $(call preprocess, $(GOBAN_SRCDIR)/SOURCES) |
15 | |||
16 | |||
17 | GOBAN_SRC := $(call preprocess, $(GOBANSRCDIR)/SOURCES) | ||
18 | GOBAN_OBJ := $(call c2obj, $(GOBAN_SRC)) | 15 | GOBAN_OBJ := $(call c2obj, $(GOBAN_SRC)) |
19 | 16 | ||
20 | OTHER_SRC += $(GOBAN_SRC) | 17 | OTHER_SRC += $(GOBAN_SRC) |
21 | 18 | ||
22 | $(GOBANBUILDDIR)/goban.rock: $(GOBAN_OBJ) | 19 | ifndef SIMVER |
20 | ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET))))) | ||
21 | ### archos recorder targets | ||
22 | GOBAN_INLDS := $(GOBAN_SRCDIR)/archos.lds | ||
23 | ROCKS += $(GOBAN_BUILDDIR)/goban.ovl | ||
24 | else | ||
25 | ### all other targets | ||
26 | GOBAN_INLDS := $(APPSDIR)/plugins/plugin.lds | ||
27 | ROCKS += $(GOBAN_BUILDDIR)/goban.rock | ||
28 | endif | ||
29 | GOBAN_OVLFLAGS = -T$(GOBAN_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map | ||
30 | GOBAN_OUTLDS = $(GOBAN_BUILDDIR)/goban.lds | ||
31 | else | ||
32 | ### simulator | ||
33 | ROCKS += $(GOBAN_BUILDDIR)/goban.rock | ||
34 | GOBAN_OVLFLAGS = $(SHARED_FLAG) # <-- from Makefile | ||
35 | endif | ||
36 | |||
37 | $(GOBAN_OUTLDS): $(GOBAN_INLDS) $(GOBAN_OBJ) | ||
38 | $(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@) | ||
39 | |||
40 | $(GOBAN_BUILDDIR)/goban.rock: $(GOBAN_OBJ) $(GOBAN_OUTLDS) | ||
41 | |||
42 | $(GOBAN_BUILDDIR)/goban.ovl: $(GOBAN_OBJ) $(GOBAN_OUTLDS) | ||
43 | $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \ | ||
44 | $(filter %.o, $^) \ | ||
45 | $(filter %.a, $^) \ | ||
46 | -lgcc $(GOBAN_OVLFLAGS) | ||
47 | $(call PRINTS,LD $(@F))$(OC) -O binary $(basename $@).elf $@ | ||
48 | |||
diff --git a/apps/plugins/goban/sgf_storage.c b/apps/plugins/goban/sgf_storage.c index 8afc3ea80f..7ee0848543 100644 --- a/apps/plugins/goban/sgf_storage.c +++ b/apps/plugins/goban/sgf_storage.c | |||
@@ -326,7 +326,7 @@ setup_sgf (void) | |||
326 | 326 | ||
327 | if (total_storage_size < MIN_STORAGE_BUFFER_SIZE) | 327 | if (total_storage_size < MIN_STORAGE_BUFFER_SIZE) |
328 | { | 328 | { |
329 | rb->splash (2 * HZ, "Stopping music playback to get more space"); | 329 | rb->splash (1 * HZ, "Stopping music playback to get more space"); |
330 | DEBUGF ("storage_buffer_size < MIN!!: %d\n", (int) total_storage_size); | 330 | DEBUGF ("storage_buffer_size < MIN!!: %d\n", (int) total_storage_size); |
331 | 331 | ||
332 | temp_buffer = rb->plugin_get_audio_buffer (&size); | 332 | temp_buffer = rb->plugin_get_audio_buffer (&size); |
@@ -335,7 +335,7 @@ setup_sgf (void) | |||
335 | 335 | ||
336 | if (total_storage_size < MIN_STORAGE_BUFFER_SIZE) | 336 | if (total_storage_size < MIN_STORAGE_BUFFER_SIZE) |
337 | { | 337 | { |
338 | rb->splash (5 * HZ, "Low memory. Large files may not load."); | 338 | rb->splash (1 * HZ, "Low memory. Large files may not load."); |
339 | 339 | ||
340 | DEBUGF ("storage_buffer_size < MIN!!!!: %d\n", | 340 | DEBUGF ("storage_buffer_size < MIN!!!!: %d\n", |
341 | (int) total_storage_size); | 341 | (int) total_storage_size); |
@@ -387,6 +387,15 @@ setup_storage_buffer (char *temp_buffer, size_t size) | |||
387 | unsigned int index = 0; | 387 | unsigned int index = 0; |
388 | int temp; | 388 | int temp; |
389 | 389 | ||
390 | #if PLUGIN_BUFFER_SIZE < 0x10000 && !defined(SIMULATOR) | ||
391 | /* loaded as an overlay plugin, protect from overwriting ourselves */ | ||
392 | if (plugin_start_addr >= (unsigned char *) temp_buffer && | ||
393 | plugin_start_addr < (unsigned char *) temp_buffer + size) | ||
394 | { | ||
395 | size = plugin_start_addr - (unsigned char *) temp_buffer; | ||
396 | } | ||
397 | #endif | ||
398 | |||
390 | while (1) | 399 | while (1) |
391 | { | 400 | { |
392 | if (index >= sizeof (storage_initialized) / | 401 | if (index >= sizeof (storage_initialized) / |