diff options
author | Michiel Van Der Kolk <not.valid@email.address> | 2005-03-03 19:54:47 +0000 |
---|---|---|
committer | Michiel Van Der Kolk <not.valid@email.address> | 2005-03-03 19:54:47 +0000 |
commit | cd040ddd7cfa2b68ee27639698e644c92f8fd5de (patch) | |
tree | ed40d36a5d354b564e3789d10eb0f0eec25e16eb | |
parent | 3921e1aa6979163c2a07122dff49f6afef977a94 (diff) | |
download | rockbox-cd040ddd7cfa2b68ee27639698e644c92f8fd5de.tar.gz rockbox-cd040ddd7cfa2b68ee27639698e644c92f8fd5de.zip |
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
-rw-r--r-- | apps/plugins/rockboy/Makefile | 2 | ||||
-rw-r--r-- | apps/plugins/rockboy/main.c | 25 | ||||
-rw-r--r-- | apps/plugins/rockboy/rockboy.c | 22 | ||||
-rw-r--r-- | apps/plugins/rockboy/rockmacros.h | 10 | ||||
-rw-r--r-- | apps/plugins/rockboy/sys_rockbox.c | 8 |
5 files changed, 33 insertions, 34 deletions
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 | |||
20 | DEPFILE = $(OBJDIR)/dep-rockboy | 20 | DEPFILE = $(OBJDIR)/dep-rockboy |
21 | SRC = cpu.c emu.c events.c exports.c fastmem.c hw.c lcd.c lcdc.c loader.c \ | 21 | SRC = cpu.c emu.c events.c exports.c fastmem.c hw.c lcd.c lcdc.c loader.c \ |
22 | main.c mem.c nosound.c rccmds.c rcvars.c rtc.c save.c sound.c split.c \ | 22 | main.c mem.c nosound.c rccmds.c rcvars.c rtc.c save.c sound.c split.c \ |
23 | sys_rockbox.c rockboy.c | 23 | sys_rockbox.c rockboy.c menu.c |
24 | 24 | ||
25 | #CFLAGS += -DDYNAREC | 25 | #CFLAGS += -DDYNAREC |
26 | #SRC += dynarec.c | 26 | #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() | |||
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | /* convenience macro for printing loading state */ | ||
49 | #define PUTS(str) do { \ | ||
50 | rb->lcd_putsxy(1, y, str); \ | ||
51 | rb->lcd_getstringsize(str, &w, &h); \ | ||
52 | y += h + 1; \ | ||
53 | } while (0) | ||
54 | |||
48 | int gnuboy_main(char *rom) | 55 | int gnuboy_main(char *rom) |
49 | { | 56 | { |
50 | int i; | 57 | int i, w, h, y; |
51 | 58 | ||
59 | y = 1; | ||
52 | // Avoid initializing video if we don't have to | 60 | // Avoid initializing video if we don't have to |
53 | // If we have special perms, drop them ASAP! | 61 | // If we have special perms, drop them ASAP! |
54 | rb->splash(HZ*1, true, "Init exports"); | 62 | PUTS("Init exports"); |
55 | init_exports(); | 63 | init_exports(); |
56 | 64 | ||
57 | rb->splash(HZ*1, true, "Loading default config"); | 65 | PUTS("Loading default config"); |
58 | for (i = 0; defaultconfig[i]; i++) | 66 | for (i = 0; defaultconfig[i]; i++) |
59 | rc_command(defaultconfig[i]); | 67 | rc_command(defaultconfig[i]); |
60 | 68 | ||
@@ -65,19 +73,20 @@ int gnuboy_main(char *rom) | |||
65 | // rc_command(cmd); | 73 | // rc_command(cmd); |
66 | 74 | ||
67 | // FIXME - make interface modules responsible for atexit() | 75 | // FIXME - make interface modules responsible for atexit() |
68 | rb->splash(HZ*1, true, "Init video"); | 76 | PUTS("Init video"); |
69 | vid_init(); | 77 | vid_init(); |
70 | rb->splash(HZ*1, true, "Init sound (nosound)"); | 78 | PUTS("Init sound (nosound)"); |
71 | pcm_init(); | 79 | pcm_init(); |
72 | rb->splash(HZ*1, true, "Loading rom"); | 80 | PUTS("Loading rom"); |
73 | loader_init(rom); | 81 | loader_init(rom); |
74 | if(shut) | 82 | if(shut) |
75 | return PLUGIN_ERROR; | 83 | return PLUGIN_ERROR; |
76 | rb->splash(HZ*1, true, "Emu reset"); | 84 | PUTS("Emu reset"); |
77 | emu_reset(); | 85 | emu_reset(); |
78 | rb->splash(HZ*1, true, "Emu run"); | 86 | PUTS("Emu run"); |
79 | emu_run(); | 87 | emu_run(); |
80 | 88 | ||
81 | // never reached | 89 | // never reached |
82 | return PLUGIN_OK; | 90 | return PLUGIN_OK; |
83 | } | 91 | } |
92 | #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; | |||
52 | char *errormsg; | 52 | char *errormsg; |
53 | int gnuboy_main(char *rom); | 53 | int gnuboy_main(char *rom); |
54 | 54 | ||
55 | /* libc functions */ | ||
56 | |||
57 | int isdigit(int c) { | ||
58 | return c>='0' && c<= '9'; | ||
59 | } | ||
60 | |||
61 | int isalpha(int c) { | ||
62 | return (c>='a' && c<='z')||(c>='A' && c<='Z'); | ||
63 | } | ||
64 | |||
65 | int isupper(int c) { | ||
66 | return c>='A'&&c<='Z'; | ||
67 | } | ||
68 | |||
69 | int isalnum(int c) { | ||
70 | return isdigit(c)||isalpha(c); | ||
71 | } | ||
72 | |||
73 | void die(char *message, ...) | 55 | void die(char *message, ...) |
74 | { | 56 | { |
75 | shut=1; | 57 | shut=1; |
@@ -129,8 +111,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
129 | mp3_buffer_free=0; | 111 | mp3_buffer_free=0; |
130 | 112 | ||
131 | /* now go ahead and have fun! */ | 113 | /* now go ahead and have fun! */ |
132 | rb->splash(HZ*2, true, "Rockboy v0.3"); | 114 | /* rb->splash(HZ*2, true, "Rockboy v0.3"); */ |
133 | rb->lcd_clear_display(); | 115 | /* rb->lcd_clear_display(); */ |
134 | gnuboy_main(parameter); | 116 | gnuboy_main(parameter); |
135 | 117 | ||
136 | if(shut&&!cleanshut) { | 118 | 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); | |||
42 | int pcm_submit(void); | 42 | int pcm_submit(void); |
43 | void pcm_init(void); | 43 | void pcm_init(void); |
44 | void doevents(void); | 44 | void doevents(void); |
45 | int isupper(int c); | ||
46 | int isdigit(int c); | ||
47 | void ev_poll(void); | 45 | void ev_poll(void); |
46 | int do_user_menu(void); | ||
47 | #define USER_MENU_QUIT -2 | ||
48 | |||
49 | |||
50 | /* libc functions */ | ||
51 | #define isdigit(c) ((c) >= '0' && (c) <= '9') | ||
52 | #define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z'))) | ||
53 | #define isalnum(c) (isdigit(c) || (isalpha(c))) | ||
48 | 54 | ||
49 | #ifdef SIMULATOR | 55 | #ifdef SIMULATOR |
50 | #undef opendir | 56 | #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) | |||
60 | #define ROCKBOY_PAD_B BUTTON_OFF | 60 | #define ROCKBOY_PAD_B BUTTON_OFF |
61 | #define ROCKBOY_PAD_START BUTTON_REC | 61 | #define ROCKBOY_PAD_START BUTTON_REC |
62 | #define ROCKBOY_PAD_SELECT BUTTON_SELECT | 62 | #define ROCKBOY_PAD_SELECT BUTTON_SELECT |
63 | #define ROCKBOY_QUIT BUTTON_MODE | 63 | #define ROCKBOY_MENU BUTTON_MODE |
64 | 64 | ||
65 | #elif CONFIG_KEYPAD == RECORDER_PAD | 65 | #elif CONFIG_KEYPAD == RECORDER_PAD |
66 | #define ROCKBOY_PAD_A BUTTON_F1 | 66 | #define ROCKBOY_PAD_A BUTTON_F1 |
67 | #define ROCKBOY_PAD_B BUTTON_F2 | 67 | #define ROCKBOY_PAD_B BUTTON_F2 |
68 | #define ROCKBOY_PAD_START BUTTON_F3 | 68 | #define ROCKBOY_PAD_START BUTTON_F3 |
69 | #define ROCKBOY_PAD_SELECT BUTTON_PLAY | 69 | #define ROCKBOY_PAD_SELECT BUTTON_PLAY |
70 | #define ROCKBOY_QUIT BUTTON_OFF | 70 | #define ROCKBOY_MENU BUTTON_OFF |
71 | 71 | ||
72 | #endif | 72 | #endif |
73 | 73 | ||
@@ -115,9 +115,11 @@ void ev_poll(void) | |||
115 | ev.code=PAD_SELECT; | 115 | ev.code=PAD_SELECT; |
116 | ev_postevent(&ev); | 116 | ev_postevent(&ev); |
117 | } | 117 | } |
118 | if(pressed & ROCKBOY_QUIT) { | 118 | if(pressed & ROCKBOY_MENU) { |
119 | if (do_user_menu() == USER_MENU_QUIT) { | ||
119 | die(""); | 120 | die(""); |
120 | cleanshut=1; | 121 | cleanshut=1; |
122 | } | ||
121 | } | 123 | } |
122 | } | 124 | } |
123 | 125 | ||