Browse code

Use rom name for window title

neauoire authored on 28/10/2021 16:27:39
Showing 1 changed files
... ...
@@ -243,7 +243,7 @@ quit(void)
243 243
 }
244 244
 
245 245
 static int
246
-init(void)
246
+init(char *filepath)
247 247
 {
248 248
 	SDL_AudioSpec as;
249 249
 	SDL_zero(as);
... ...
@@ -262,7 +262,7 @@ init(void)
262 262
 		if(!audio_id)
263 263
 			error("sdl_audio", SDL_GetError());
264 264
 	}
265
-	gWindow = SDL_CreateWindow("Uxn", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (WIDTH + PAD * 2) * zoom, (HEIGHT + PAD * 2) * zoom, SDL_WINDOW_SHOWN);
265
+	gWindow = SDL_CreateWindow(filepath, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (WIDTH + PAD * 2) * zoom, (HEIGHT + PAD * 2) * zoom, SDL_WINDOW_SHOWN);
266 266
 	if(gWindow == NULL)
267 267
 		return error("sdl_window", SDL_GetError());
268 268
 	gRenderer = SDL_CreateRenderer(gWindow, -1, 0);
... ...
@@ -603,7 +603,7 @@ main(int argc, char **argv)
603 603
 		} else if(!loaded++) {
604 604
 			if(!load(&u, argv[i]))
605 605
 				return error("Load", "Failed to open rom.");
606
-			if(!init())
606
+			if(!init(argv[i]))
607 607
 				return error("Init", "Failed to initialize emulator.");
608 608
 			if(!set_size(WIDTH, HEIGHT, 0))
609 609
 				return error("Window", "Failed to set window size.");