summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorMichiel Van Der Kolk <not.valid@email.address>2005-03-03 19:54:47 +0000
committerMichiel Van Der Kolk <not.valid@email.address>2005-03-03 19:54:47 +0000
commitcd040ddd7cfa2b68ee27639698e644c92f8fd5de (patch)
treeed40d36a5d354b564e3789d10eb0f0eec25e16eb /apps/plugins
parent3921e1aa6979163c2a07122dff49f6afef977a94 (diff)
downloadrockbox-cd040ddd7cfa2b68ee27639698e644c92f8fd5de.zip
rockbox-cd040ddd7cfa2b68ee27639698e644c92f8fd5de.tar.gz
rockbox-cd040ddd7cfa2b68ee27639698e644c92f8fd5de.tar.bz2
rockbox-cd040ddd7cfa2b68ee27639698e644c92f8fd5de.tar.xz
First stages of rockboy menu - press A/B mode to enter, contributed by pabs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6120 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/rockboy/Makefile2
-rw-r--r--apps/plugins/rockboy/main.c25
-rw-r--r--apps/plugins/rockboy/rockboy.c22
-rw-r--r--apps/plugins/rockboy/rockmacros.h10
-rw-r--r--apps/plugins/rockboy/sys_rockbox.c8
5 files changed, 33 insertions, 34 deletions
diff --git a/apps/plugins/rockboy/Makefile b/apps/plugins/rockboy/Makefile
index 4d17a59..c257f00 100644
--- a/apps/plugins/rockboy/Makefile
+++ b/apps/plugins/rockboy/Makefile
@@ -20,7 +20,7 @@ LINKFILE := $(OBJDIR)/link.lds
DEPFILE = $(OBJDIR)/dep-rockboy
SRC = cpu.c emu.c events.c exports.c fastmem.c hw.c lcd.c lcdc.c loader.c \
main.c mem.c nosound.c rccmds.c rcvars.c rtc.c save.c sound.c split.c \
- sys_rockbox.c rockboy.c
+ sys_rockbox.c rockboy.c menu.c
#CFLAGS += -DDYNAREC
#SRC += dynarec.c
diff --git a/apps/plugins/rockboy/main.c b/apps/plugins/rockboy/main.c
index ea5d628..77e9bc9 100644
--- a/apps/plugins/rockboy/main.c
+++ b/apps/plugins/rockboy/main.c
@@ -45,16 +45,24 @@ void doevents()
+/* convenience macro for printing loading state */
+#define PUTS(str) do { \
+ rb->lcd_putsxy(1, y, str); \
+ rb->lcd_getstringsize(str, &w, &h); \
+ y += h + 1; \
+} while (0)
+
int gnuboy_main(char *rom)
{
- int i;
+ int i, w, h, y;
+ y = 1;
// Avoid initializing video if we don't have to
// If we have special perms, drop them ASAP!
- rb->splash(HZ*1, true, "Init exports");
+ PUTS("Init exports");
init_exports();
- rb->splash(HZ*1, true, "Loading default config");
+ PUTS("Loading default config");
for (i = 0; defaultconfig[i]; i++)
rc_command(defaultconfig[i]);
@@ -65,19 +73,20 @@ int gnuboy_main(char *rom)
// rc_command(cmd);
// FIXME - make interface modules responsible for atexit()
- rb->splash(HZ*1, true, "Init video");
+ PUTS("Init video");
vid_init();
- rb->splash(HZ*1, true, "Init sound (nosound)");
+ PUTS("Init sound (nosound)");
pcm_init();
- rb->splash(HZ*1, true, "Loading rom");
+ PUTS("Loading rom");
loader_init(rom);
if(shut)
return PLUGIN_ERROR;
- rb->splash(HZ*1, true, "Emu reset");
+ PUTS("Emu reset");
emu_reset();
- rb->splash(HZ*1, true, "Emu run");
+ PUTS("Emu run");
emu_run();
// never reached
return PLUGIN_OK;
}
+#undef PUTS
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index ca48fc2..6c831d0 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -52,24 +52,6 @@ int shut,cleanshut;
char *errormsg;
int gnuboy_main(char *rom);
-/* libc functions */
-
-int isdigit(int c) {
- return c>='0' && c<= '9';
-}
-
-int isalpha(int c) {
- return (c>='a' && c<='z')||(c>='A' && c<='Z');
-}
-
-int isupper(int c) {
- return c>='A'&&c<='Z';
-}
-
-int isalnum(int c) {
- return isdigit(c)||isalpha(c);
-}
-
void die(char *message, ...)
{
shut=1;
@@ -129,8 +111,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
mp3_buffer_free=0;
/* now go ahead and have fun! */
- rb->splash(HZ*2, true, "Rockboy v0.3");
- rb->lcd_clear_display();
+ /* rb->splash(HZ*2, true, "Rockboy v0.3"); */
+ /* rb->lcd_clear_display(); */
gnuboy_main(parameter);
if(shut&&!cleanshut) {
diff --git a/apps/plugins/rockboy/rockmacros.h b/apps/plugins/rockboy/rockmacros.h
index d29d0a7..b14ba63 100644
--- a/apps/plugins/rockboy/rockmacros.h
+++ b/apps/plugins/rockboy/rockmacros.h
@@ -42,9 +42,15 @@ void sys_sleep(int us);
int pcm_submit(void);
void pcm_init(void);
void doevents(void);
-int isupper(int c);
-int isdigit(int c);
void ev_poll(void);
+int do_user_menu(void);
+#define USER_MENU_QUIT -2
+
+
+/* libc functions */
+#define isdigit(c) ((c) >= '0' && (c) <= '9')
+#define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z')))
+#define isalnum(c) (isdigit(c) || (isalpha(c)))
#ifdef SIMULATOR
#undef opendir
diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c
index 4adb0a3..6973a43 100644
--- a/apps/plugins/rockboy/sys_rockbox.c
+++ b/apps/plugins/rockboy/sys_rockbox.c
@@ -60,14 +60,14 @@ void joy_close(void)
#define ROCKBOY_PAD_B BUTTON_OFF
#define ROCKBOY_PAD_START BUTTON_REC
#define ROCKBOY_PAD_SELECT BUTTON_SELECT
-#define ROCKBOY_QUIT BUTTON_MODE
+#define ROCKBOY_MENU BUTTON_MODE
#elif CONFIG_KEYPAD == RECORDER_PAD
#define ROCKBOY_PAD_A BUTTON_F1
#define ROCKBOY_PAD_B BUTTON_F2
#define ROCKBOY_PAD_START BUTTON_F3
#define ROCKBOY_PAD_SELECT BUTTON_PLAY
-#define ROCKBOY_QUIT BUTTON_OFF
+#define ROCKBOY_MENU BUTTON_OFF
#endif
@@ -115,9 +115,11 @@ void ev_poll(void)
ev.code=PAD_SELECT;
ev_postevent(&ev);
}
- if(pressed & ROCKBOY_QUIT) {
+ if(pressed & ROCKBOY_MENU) {
+ if (do_user_menu() == USER_MENU_QUIT) {
die("");
cleanshut=1;
+ }
}
}