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.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/apps/plugins/rockboy/main.c b/apps/plugins/rockboy/main.c
new file mode 100644
index 0000000000..ea5d628f04
--- /dev/null
+++ b/apps/plugins/rockboy/main.c
@@ -0,0 +1,83 @@
1#include <stdio.h>
2#include <string.h>
3
4#include "rockmacros.h"
5#include "input.h"
6#include "rc.h"
7#include "exports.h"
8#include "emu.h"
9#include "loader.h"
10#include "hw.h"
11
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()
32{
33 event_t ev;
34 int st;
35
36 ev_poll();
37 while (ev_getevent(&ev))
38 {
39 if (ev.type != EV_PRESS && ev.type != EV_RELEASE)
40 continue;
41 st = (ev.type != EV_RELEASE);
42 pad_set(ev.code, st);
43 }
44}
45
46
47
48int gnuboy_main(char *rom)
49{
50 int i;
51
52 // Avoid initializing video if we don't have to
53 // If we have special perms, drop them ASAP!
54 rb->splash(HZ*1, true, "Init exports");
55 init_exports();
56
57 rb->splash(HZ*1, true, "Loading default config");
58 for (i = 0; defaultconfig[i]; i++)
59 rc_command(defaultconfig[i]);
60
61// sprintf(cmd, "source %s", rom);
62// s = strchr(cmd, '.');
63// if (s) *s = 0;
64// strcat(cmd, ".rc");
65// rc_command(cmd);
66
67 // FIXME - make interface modules responsible for atexit()
68 rb->splash(HZ*1, true, "Init video");
69 vid_init();
70 rb->splash(HZ*1, true, "Init sound (nosound)");
71 pcm_init();
72 rb->splash(HZ*1, true, "Loading rom");
73 loader_init(rom);
74 if(shut)
75 return PLUGIN_ERROR;
76 rb->splash(HZ*1, true, "Emu reset");
77 emu_reset();
78 rb->splash(HZ*1, true, "Emu run");
79 emu_run();
80
81 // never reached
82 return PLUGIN_OK;
83}