Browse code

(uxnemu) Write arguments end in console device

Devine Lu Linvega authored on 17/04/2023 17:41:03
Showing 4 changed files
... ...
@@ -102,6 +102,8 @@ uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr)
102 102
 	return 0;
103 103
 }
104 104
 
105
+/* Console */
106
+
105 107
 int
106 108
 console_input(Uxn *u, char c, int type)
107 109
 {
... ...
@@ -20,4 +20,4 @@ int system_load(Uxn *u, char *filename);
20 20
 void system_inspect(Uxn *u);
21 21
 void system_deo(Uxn *u, Uint8 *d, Uint8 port);
22 22
 int console_input(Uxn *u, char c, int type);
23
-void console_deo(Uint8 *d, Uint8 port);
24 23
\ No newline at end of file
24
+void console_deo(Uint8 *d, Uint8 port);
... ...
@@ -53,7 +53,7 @@ main(int argc, char **argv)
53 53
 {
54 54
 	Uxn u;
55 55
 	int i = 1;
56
-	if(argc < 2)
56
+	if(i == argc)
57 57
 		return emu_error("Usage", "uxncli game.rom args");
58 58
 	if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8))))
59 59
 		return emu_error("Boot", "Failed");
... ...
@@ -500,9 +500,11 @@ main(int argc, char **argv)
500 500
 		set_zoom(argv[i++][1] - '0');
501 501
 	else if(SDL_GetCurrentDisplayMode(0, &DM) == 0)
502 502
 		set_zoom(DM.w / 1280);
503
+	/* load rom */
503 504
 	if(i == argc)
504 505
 		return error("usage", "uxnemu [-2x][-3x] file.rom");
505
-	/* load rom */
506
+	if(i == argc - 1)
507
+		u.dev[0x17] = CONSOLE_END;
506 508
 	if(!start(&u, argv[i]))
507 509
 		return error("Start", "Failed");
508 510
 	rom_path = argv[i++];