Made a console_listen function
This commit is contained in:
parent
8d4074b372
commit
4d7ce3e893
|
@ -24,6 +24,16 @@ console_input(Uxn *u, char c, int type)
|
|||
return uxn_eval(u, PEEK2(d));
|
||||
}
|
||||
|
||||
void
|
||||
console_listen(Uxn *u, int i, int argc, char **argv)
|
||||
{
|
||||
for(; i < argc; i++) {
|
||||
char *p = argv[i];
|
||||
while(*p) console_input(u, *p++, CONSOLE_ARG);
|
||||
console_input(u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
console_deo(Uint8 *d, Uint8 port)
|
||||
{
|
||||
|
|
|
@ -19,4 +19,5 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
#define CONSOLE_END 0x4
|
||||
|
||||
int console_input(Uxn *u, char c, int type);
|
||||
void console_listen(Uxn *u, int i, int argc, char **argv);
|
||||
void console_deo(Uint8 *d, Uint8 port);
|
||||
|
|
|
@ -62,11 +62,7 @@ main(int argc, char **argv)
|
|||
/* Game Loop */
|
||||
u.dev[0x17] = argc - i;
|
||||
if(uxn_eval(&u, PAGE_PROGRAM)) {
|
||||
for(; i < argc; i++) {
|
||||
char *p = argv[i];
|
||||
while(*p) console_input(&u, *p++, CONSOLE_ARG);
|
||||
console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
|
||||
}
|
||||
console_listen(&u, i, argc, argv);
|
||||
while(!u.dev[0x0f]) {
|
||||
int c = fgetc(stdin);
|
||||
if(c == EOF) break;
|
||||
|
|
|
@ -549,11 +549,7 @@ main(int argc, char **argv)
|
|||
if(!emu_start(&u, rom_path))
|
||||
return system_error("Start", "Failed");
|
||||
/* read arguments */
|
||||
for(; i < argc; i++) {
|
||||
char *p = argv[i];
|
||||
while(*p) console_input(&u, *p++, CONSOLE_ARG);
|
||||
console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
|
||||
}
|
||||
console_listen(&u, i, argc, argv);
|
||||
/* start rom */
|
||||
run(&u, rom_path);
|
||||
/* finished */
|
||||
|
|
Loading…
Reference in New Issue