Esempio n. 1
0
void shutdown_sdl(void)
{
	if (guarded_exit) {
		audio_close();
		printer_close();
#ifdef CONFIG_W5300_SUPPORT
		w5300_shutdown();
#endif
#ifdef CONFIG_EXDOS_SUPPORT
		wd_detach_disk_image();
#endif
		if (sram_ready)
			sram_save_all_segments();
		DEBUGPRINT("Shutdown callback, return." NL);
	}
	if (sdl_win) {
#ifdef __EMSCRIPTEN__
		// This is used, because window title would remain as Emu would run after exit, which is not the case ...
		SDL_SetWindowTitle(sdl_win, WINDOW_TITLE " v" VERSION " - EXITED");
#endif
		SDL_DestroyWindow(sdl_win);
	}
	console_close_window_on_exit();
	/* last stuff! */
	if (debug_fp) {
		DEBUGPRINT("Closing debug messages log file on exit." NL);
		fclose(debug_fp);
		debug_fp = NULL;
	}
	SDL_Quit();
}
Esempio n. 2
0
void printer_open_file(const char *filename) {
	printer_close();
	if (stream_dest) free(stream_dest);
	stream_dest = xstrdup(filename);
	is_pipe = 0;
	busy = 0;
	bp_add_list(coco_print_breakpoint);
}
Esempio n. 3
0
void printer_open_pipe(const char *command) {
	printer_close();
	if (stream_dest) free(stream_dest);
	stream_dest = xstrdup(command);
	is_pipe = 1;
	busy = 0;
	bp_add_list(coco_print_breakpoint);
}
Esempio n. 4
0
static void open_stream(void) {
	if (!stream_dest) return;
	if (is_pipe) {
		stream = popen(stream_dest, "w");
	} else {
		stream = fopen(stream_dest, "ab");
	}
	if (stream) {
		busy = 0;
	} else {
		printer_close();
	}
}