Exemplo n.º 1
0
void systemShutdown(void)
{
	pie_ShutdownRadar();
	if (mod_list)
	{
		free(mod_list);
	}

	shutdownEffectsSystem();
	wzSceneEnd("Main menu loop");
	keyClearMappings();

	// free up all the load functions (all the data should already have been freed)
	resReleaseAll();

	if (!multiShutdown()) // ajl. init net stuff
	{
		debug(LOG_FATAL, "Unable to multiShutdown() cleanly!");
		abort();
	}

	debug(LOG_MAIN, "shutting down audio subsystems");

	debug(LOG_MAIN, "shutting down CD audio");
	cdAudio_Close();

	if ( audio_Disabled() == false && !audio_Shutdown() )
	{
		debug(LOG_FATAL, "Unable to audio_Shutdown() cleanly!");
		abort();
	}

	debug(LOG_MAIN, "shutting down graphics subsystem");
	levShutDown();
	widgShutDown();
	fpathShutdown();
	mapShutdown();
	debug(LOG_MAIN, "shutting down everything else");
	pal_ShutDown();		// currently unused stub
	frameShutDown();	// close screen / SDL / resources / cursors / trig
	screenShutDown();
	closeConfig();		// "registry" close
	cleanSearchPath();	// clean PHYSFS search paths
	debug_exit();		// cleanup debug routines
	PHYSFS_deinit();	// cleanup PHYSFS (If failure, state of PhysFS is undefined, and probably badly screwed up.)
	// NOTE: Exception handler is cleaned via atexit(ExchndlShutdown);
}
Exemplo n.º 2
0
int realmain(int argc, char **argv)
{
	wzMain(argc, argv);
	debug_init();
	debug_register_callback(debug_callback_stderr, NULL, NULL, NULL);
	pie_SetVideoBufferWidth(800);
	pie_SetVideoBufferHeight(600);
	if (!wzMainScreenSetup(0, false, true))
	{
		fprintf(stderr, "Failed to initialize graphics\n");
		return EXIT_FAILURE;
	}
	frameInitialise();
	screenInitialise();

	wzMainEventLoop(); // enter main loop

	frameShutDown();
	screenShutDown();
	wzShutdown();
	return EXIT_SUCCESS;
}