diff options
Diffstat (limited to 'apps/plugins/rockboy/rccmds.c')
-rw-r--r-- | apps/plugins/rockboy/rccmds.c | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/apps/plugins/rockboy/rccmds.c b/apps/plugins/rockboy/rccmds.c deleted file mode 100644 index c9375b69b5..0000000000 --- a/apps/plugins/rockboy/rccmds.c +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | |||
2 | |||
3 | |||
4 | |||
5 | #include "rockmacros.h" | ||
6 | |||
7 | #include "defs.h" | ||
8 | #include "rc.h" | ||
9 | #include "hw.h" | ||
10 | #include "emu.h" | ||
11 | #include "save.h" | ||
12 | #include "split.h" | ||
13 | |||
14 | /* | ||
15 | * the set command is used to set rc-exported variables. | ||
16 | */ | ||
17 | |||
18 | static int cmd_set(int argc, char **argv) | ||
19 | { | ||
20 | if (argc < 3) | ||
21 | return -1; | ||
22 | return rc_setvar(argv[1], argc-2, argv+2); | ||
23 | } | ||
24 | |||
25 | |||
26 | |||
27 | /* | ||
28 | * the following commands allow keys to be bound to perform rc commands. | ||
29 | */ | ||
30 | |||
31 | static int cmd_reset(int argc, char **argv) | ||
32 | { | ||
33 | (void)argc; | ||
34 | (void)argv; | ||
35 | emu_reset(); | ||
36 | return 0; | ||
37 | } | ||
38 | |||
39 | static int cmd_savestate(int argc, char **argv) | ||
40 | { | ||
41 | state_save(argc > 1 ? atoi(argv[1]) : -1); | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | static int cmd_loadstate(int argc, char **argv) | ||
46 | { | ||
47 | state_load(argc > 1 ? atoi(argv[1]) : -1); | ||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | |||
52 | |||
53 | /* | ||
54 | * table of command names and the corresponding functions to be called | ||
55 | */ | ||
56 | |||
57 | rccmd_t rccmds[] = | ||
58 | { | ||
59 | RCC("set", cmd_set), | ||
60 | RCC("reset", cmd_reset), | ||
61 | RCC("savestate", cmd_savestate), | ||
62 | RCC("loadstate", cmd_loadstate), | ||
63 | RCC_END | ||
64 | }; | ||
65 | |||
66 | |||
67 | |||
68 | |||
69 | |||
70 | int rc_command(char *line) | ||
71 | { | ||
72 | int i, argc, ret; | ||
73 | char *argv[128], linecopy[500]; | ||
74 | |||
75 | // linecopy = malloc(strlen(line)+1); | ||
76 | strcpy(linecopy, line); | ||
77 | |||
78 | argc = splitline(argv, (sizeof argv)/(sizeof argv[0]), linecopy); | ||
79 | if (!argc) | ||
80 | { | ||
81 | // free(linecopy); | ||
82 | return -1; | ||
83 | } | ||
84 | |||
85 | for (i = 0; rccmds[i].name; i++) | ||
86 | { | ||
87 | if (!strcmp(argv[0], rccmds[i].name)) | ||
88 | { | ||
89 | ret = rccmds[i].func(argc, argv); | ||
90 | // free(linecopy); | ||
91 | return ret; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | /* printf("unknown command: %s\n", argv[0]); */ | ||
96 | // free(linecopy); | ||
97 | |||
98 | return -1; | ||
99 | } | ||
100 | |||
101 | |||
102 | |||
103 | |||
104 | |||
105 | |||
106 | |||
107 | |||
108 | |||
109 | |||
110 | |||
111 | |||
112 | |||
113 | |||
114 | |||
115 | |||
116 | |||
117 | |||
118 | |||
119 | |||
120 | |||
121 | |||
122 | |||