commit 635f5e8

Devine Lu Linvega  ·  2025-05-16 16:54:52 +0000 UTC
parent e0a9562
(uxn11) Cleanup
2 files changed,  +15, -16
+14, -16
 1@@ -33,11 +33,11 @@ typedef struct {
 2 static XImage *ximage;
 3 static Display *display;
 4 static Window window;
 5+static Uint8 *ram, dev[0x100];
 6+static Stack wst, rst;
 7 
 8 Uint8 emu_dei(Uint8 addr);
 9 void emu_deo(Uint8 addr, Uint8 value);
10-static Uint8 *ram, dev[0x100];
11-static Stack wst, rst;
12 
13 /* clang-format off */
14 
15@@ -167,9 +167,7 @@ system_boot(char *rom_path, int has_args)
16 	ram = (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8));
17 	system_boot_path = rom_path;
18 	dev[0x17] = has_args;
19-	if(ram && system_load(rom_path))
20-		return uxn_eval(0x100);
21-	return 0;
22+	return ram && system_load(rom_path);
23 }
24 
25 static int
26@@ -179,9 +177,7 @@ system_reboot(int soft)
27 	for(i = 0x0; i < 0x100; i++) dev[i] = 0;
28 	for(i = soft ? 0x100 : 0; i < 0x10000; i++) ram[i] = 0;
29 	wst.ptr = rst.ptr = 0;
30-	if(system_load(system_boot_path))
31-		return uxn_eval(0x100);
32-	return 0;
33+	return system_load(system_boot_path);
34 }
35 
36 static void
37@@ -418,15 +414,14 @@ typedef struct UxnScreen {
38 
39 static unsigned int screen_vector;
40 static UxnScreen uxn_screen;
41-
42-void emu_resize(void);
43-
44 static Uint8 blending[4][16] = {
45 	{0, 0, 0, 0, 1, 0, 1, 1, 2, 2, 0, 2, 3, 3, 3, 0},
46 	{0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3},
47 	{1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1},
48 	{2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2}};
49 
50+void emu_resize(void);
51+
52 static int
53 screen_changed(void)
54 {
55@@ -1053,6 +1048,7 @@ emu_restart(int soft)
56 	console_close();
57 	screen_apply(WIDTH, HEIGHT);
58 	system_reboot(soft);
59+	uxn_eval(0x100);
60 }
61 
62 static void
63@@ -1231,11 +1227,13 @@ main(int argc, char **argv)
64 		return !fprintf(stdout, "Could not open display.\n");
65 	else if(!system_boot(argv[i++], argc > 2))
66 		return !fprintf(stdout, "Could not load %s.\n", argv[i - 1]);
67-	for(; i < argc; i++) {
68-		char *p = argv[i];
69-		while(*p)
70-			console_input(*p++, CONSOLE_ARG);
71-		console_input('\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
72+	if(uxn_eval(0x100) && console_vector) {
73+		for(; i < argc; i++) {
74+			char *p = argv[i];
75+			while(*p)
76+				console_input(*p++, CONSOLE_ARG);
77+			console_input('\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
78+		}
79 	}
80 	emu_run();
81 	console_close();
+1, -0
1@@ -26,6 +26,7 @@ typedef struct {
2 
3 static Uint8 *ram, dev[0x100];
4 static Stack wst, rst;
5+
6 Uint8 emu_dei(Uint8 addr);
7 void emu_deo(Uint8 addr, Uint8 value);
8