commit ad8f9c1

Devie Lu Linvega  ·  2025-12-26 19:07:13 +0000 UTC
parent 3d48d61
Do not start display if exits reset vector with halt port
1 files changed,  +16, -15
+16, -15
 1@@ -1131,17 +1131,6 @@ display_floating(void)
 2 	XMapWindow(display, window);
 3 }
 4 
 5-static unsigned int
 6-emu_init(void)
 7-{
 8-	display = XOpenDisplay(NULL);
 9-	if(!display) return !fprintf(stderr, "Display: failed\n");
10-	display_center();
11-	display_hidecursor();
12-	display_floating();
13-	return 1;
14-}
15-
16 static void
17 emu_event(void)
18 {
19@@ -1196,6 +1185,17 @@ emu_event(void)
20 	}
21 }
22 
23+static int
24+emu_init(void)
25+{
26+	display = XOpenDisplay(NULL);
27+	if(!display) return !fprintf(stderr, "Display: failed\n");
28+	display_center();
29+	display_hidecursor();
30+	display_floating();
31+	return 1;
32+}
33+
34 static void
35 emu_run(void)
36 {
37@@ -1256,9 +1256,10 @@ main(int argc, char **argv)
38 			console_input('\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
39 		}
40 	}
41-	/* Run */
42-	if(!emu_init())
43-		return !fprintf(stdout, "Could not initialize %s.\n", argv[0]);
44-	emu_run();
45+	if(!dev[0x0f]) {
46+		if(!emu_init())
47+			return !fprintf(stdout, "Could not initialize %s.\n", argv[0]);
48+		emu_run();
49+	}
50 	return dev[0x0f] & 0x7f;
51 }