(uxnemu) Write arguments end in console device

This commit is contained in:
Devine Lu Linvega 2023-04-17 10:41:03 -07:00
parent 1bf0ffc5e5
commit 9a882a64c7
4 changed files with 7 additions and 3 deletions

View File

@ -102,6 +102,8 @@ uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr)
return 0;
}
/* Console */
int
console_input(Uxn *u, char c, int type)
{

View File

@ -20,4 +20,4 @@ int system_load(Uxn *u, char *filename);
void system_inspect(Uxn *u);
void system_deo(Uxn *u, Uint8 *d, Uint8 port);
int console_input(Uxn *u, char c, int type);
void console_deo(Uint8 *d, Uint8 port);
void console_deo(Uint8 *d, Uint8 port);

View File

@ -53,7 +53,7 @@ main(int argc, char **argv)
{
Uxn u;
int i = 1;
if(argc < 2)
if(i == argc)
return emu_error("Usage", "uxncli game.rom args");
if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8))))
return emu_error("Boot", "Failed");

View File

@ -500,9 +500,11 @@ main(int argc, char **argv)
set_zoom(argv[i++][1] - '0');
else if(SDL_GetCurrentDisplayMode(0, &DM) == 0)
set_zoom(DM.w / 1280);
/* load rom */
if(i == argc)
return error("usage", "uxnemu [-2x][-3x] file.rom");
/* load rom */
if(i == argc - 1)
u.dev[0x17] = CONSOLE_END;
if(!start(&u, argv[i]))
return error("Start", "Failed");
rom_path = argv[i++];