diff --git a/apps/plugins/rockboy/Makefile b/apps/plugins/rockboy/Makefile index 4d17a59009..c257f00dc5 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 ea5d628f04..77e9bc9ea0 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 ca48fc2b1a..6c831d075f 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 d29d0a7a46..b14ba63783 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 4adb0a345e..6973a43664 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; + } } }