summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockboy/main.c')
-rw-r--r--apps/plugins/rockboy/main.c103
1 files changed, 25 insertions, 78 deletions
diff --git a/apps/plugins/rockboy/main.c b/apps/plugins/rockboy/main.c
index c9cbb76aaa..fc21ca0d58 100644
--- a/apps/plugins/rockboy/main.c
+++ b/apps/plugins/rockboy/main.c
@@ -3,95 +3,42 @@
3 3
4#include "rockmacros.h" 4#include "rockmacros.h"
5#include "input.h" 5#include "input.h"
6#include "rc.h"
7#include "exports.h"
8#include "emu.h" 6#include "emu.h"
9#include "loader.h" 7#include "loader.h"
10#include "hw.h" 8#include "hw.h"
11 9
12//#include "Version"
13
14
15static char *defaultconfig[] =
16{
17 "bind up +up",
18 "bind down +down",
19 "bind left +left",
20 "bind right +right",
21 "bind joy0 +b",
22 "bind joy1 +a",
23 "bind joy2 +select",
24 "bind joy3 +start",
25 "bind ins savestate",
26 "bind del loadstate",
27 NULL
28};
29
30
31void doevents() 10void doevents()
32{ 11{
33 event_t ev; 12 event_t ev;
34 int st; 13 int st;
35 14
36 ev_poll(); 15 ev_poll();
37 while (ev_getevent(&ev)) 16 while (ev_getevent(&ev))
38 { 17 {
39 if (ev.type != EV_PRESS && ev.type != EV_RELEASE) 18 if (ev.type != EV_PRESS && ev.type != EV_RELEASE)
40 continue; 19 continue;
41 st = (ev.type != EV_RELEASE); 20 st = (ev.type != EV_RELEASE);
42 pad_set(ev.code, st); 21 pad_set(ev.code, st);
43 } 22 }
44} 23}
45 24
46
47
48/* convenience macro for printing loading state */
49#define PUTS(str) do { \
50 rb->lcd_putsxy(1, y, (unsigned char *)str); \
51 rb->lcd_getstringsize((unsigned char *)str, &w, &h); \
52 y += h + 1; \
53} while (0)
54
55int gnuboy_main(char *rom) 25int gnuboy_main(char *rom)
56{ 26{
57 int i, w, h, y; 27 rb->lcd_puts(0,0,"Init video");
58 28 vid_init();
59 y = 1; 29 rb->lcd_puts(0,1,"Init sound");
60 // Avoid initializing video if we don't have to 30 pcm_init();
61 // If we have special perms, drop them ASAP! 31 rb->lcd_puts(0,2,"Loading rom");
62 PUTS("Init exports"); 32 loader_init(rom);
63 init_exports(); 33 if(shut)
64 34 return PLUGIN_ERROR;
65 PUTS("Loading default config"); 35 rb->lcd_puts(0,3,"Emu reset");
66 for (i = 0; defaultconfig[i]; i++) 36 emu_reset();
67 rc_command(defaultconfig[i]); 37 rb->lcd_puts(0,4,"Emu run");
68
69// sprintf(cmd, "source %s", rom);
70// s = strchr(cmd, '.');
71// if (s) *s = 0;
72// strcat(cmd, ".rc");
73// rc_command(cmd);
74
75 // FIXME - make interface modules responsible for atexit()
76 PUTS("Init video");
77 vid_init();
78 PUTS("Init sound");
79 pcm_init();
80 PUTS("Loading rom");
81 loader_init(rom);
82 if(shut)
83 return PLUGIN_ERROR;
84 PUTS("Emu reset");
85 emu_reset();
86 PUTS("Emu run");
87#if (LCD_HEIGHT > 144) || (LCD_WIDTH > 160)
88 rb->lcd_clear_display(); 38 rb->lcd_clear_display();
89// rb->lcd_drawrect((LCD_WIDTH-160)/2-1, (LCD_HEIGHT-144)/2-1, 162, 146);
90 rb->lcd_update(); 39 rb->lcd_update();
91#endif 40 emu_run();
92 emu_run();
93 41
94 // never reached 42 /* never reached */
95 return PLUGIN_OK; 43 return PLUGIN_OK;
96} 44}
97#undef PUTS