Send zero byte and EOF on stdin
This commit is contained in:
parent
f63b25e118
commit
d439d0a45d
|
@ -6,7 +6,6 @@
|
|||
#include "devices/console.h"
|
||||
#include "devices/file.h"
|
||||
#include "devices/datetime.h"
|
||||
#include "devices/link.h"
|
||||
|
||||
/*
|
||||
Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick
|
||||
|
@ -25,7 +24,6 @@ emu_dei(Uxn *u, Uint8 addr)
|
|||
switch(addr & 0xf0) {
|
||||
case 0x00: return system_dei(u, addr);
|
||||
case 0xc0: return datetime_dei(u, addr);
|
||||
case 0xf0: return link_dei(u, addr);
|
||||
}
|
||||
return u->dev[addr];
|
||||
}
|
||||
|
@ -39,7 +37,6 @@ emu_deo(Uxn *u, Uint8 addr)
|
|||
case 0x10: console_deo(&u->dev[d], p); break;
|
||||
case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break;
|
||||
case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break;
|
||||
case 0xf0: link_deo(u->ram, &u->dev[d], p); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +45,7 @@ emu_run(Uxn *u)
|
|||
{
|
||||
while(!u->dev[0x0f]) {
|
||||
int c = fgetc(stdin);
|
||||
if(c == EOF) break;
|
||||
if(c == EOF) { console_input(u, 0x00, CONSOLE_END); break; }
|
||||
console_input(u, (Uint8)c, CONSOLE_STD);
|
||||
}
|
||||
}
|
||||
|
@ -73,10 +70,9 @@ main(int argc, char **argv)
|
|||
system_connect(0xa, FILE_VERSION, FILE_DEIMASK, FILE_DEOMASK);
|
||||
system_connect(0xb, FILE_VERSION, FILE_DEIMASK, FILE_DEOMASK);
|
||||
system_connect(0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK);
|
||||
system_connect(0xf, LINK_VERSION, LINK_DEIMASK, LINK_DEOMASK);
|
||||
/* Read flags */
|
||||
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
||||
return system_version("Uxncli - Console Varvara Emulator", "2 Sep 2023");
|
||||
return system_version("Uxncli - Console Varvara Emulator", "5 Sep 2023");
|
||||
if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
||||
return system_error("Init", "Failed to initialize uxn.");
|
||||
/* Game Loop */
|
||||
|
|
Loading…
Reference in New Issue