Пример #1
0
/*
===============
Host_Shutdown

FIXME: this is a callback from Sys_Quit and Sys_Error.  It would be better
to run quit through here before the final handoff to the sys code.
===============
*/
void Host_Shutdown(void)
{
	static qboolean isdown = false;

	if (isdown)
	{
		Con_Print("recursive shutdown\n");
		return;
	}
	if (setjmp(host_abortframe))
	{
		Con_Print("aborted the quitting frame?!?\n");
		return;
	}
	isdown = true;

	// be quiet while shutting down
	S_StopAllSounds();

	// disconnect client from server if active
	CL_Disconnect();

	// shut down local server if active
	Host_ShutdownServer ();

	// Shutdown menu
	if(MR_Shutdown)
		MR_Shutdown();

	// AK shutdown PRVM
	// AK hmm, no PRVM_Shutdown(); yet

	CL_Gecko_Shutdown();
	CL_Video_Shutdown();

	Host_SaveConfig();

	CDAudio_Shutdown ();
	S_Terminate ();
	Curl_Shutdown ();
	NetConn_Shutdown ();
	//PR_Shutdown ();

	if (cls.state != ca_dedicated)
	{
		R_Modules_Shutdown();
		VID_Shutdown();
		Thread_Shutdown();
	}

	Cmd_Shutdown();
	Key_Shutdown();
	CL_Shutdown();
	Sys_Shutdown();
	Log_Close();
	Crypto_Shutdown();
	FS_Shutdown();
	Con_Shutdown();
	Memory_Shutdown();
}
Пример #2
0
/**
 * @brief Teardown fixture.
 */
void teardown(void) {

	Cmd_Shutdown();

	Fs_Shutdown();

	Mem_Shutdown();
}
Пример #3
0
/**
 * @brief
 * @sa Qcommon_Init
 * @sa Sys_Quit
 * @note Don't call anything that depends on cvars, command system, or any other
 * subsystem that is allocated in the mem pools and maybe already freed
 */
void Qcommon_Shutdown (void)
{
	HTTP_Cleanup();

	FS_Shutdown();
	Cvar_Shutdown();
	Cmd_Shutdown();
	NET_Shutdown();
	Mem_Shutdown();
	Com_Shutdown();
}
Пример #4
0
/*
* Qcommon_Shutdown
*/
void Qcommon_Shutdown( void )
{
	static qboolean isdown = qfalse;

	if( isdown )
	{
		printf( "Recursive shutdown\n" );
		return;
	}
	isdown = qtrue;

	Com_ScriptModule_Shutdown();
	CM_Shutdown();
	Netchan_Shutdown();
	NET_Shutdown();
	Key_Shutdown();

	Steam_UnloadLibrary();

	Qcommon_ShutdownCommands();
	Memory_ShutdownCommands();

	if( log_stats_file )
	{
		FS_FCloseFile( log_stats_file );
		log_stats_file = 0;
	}
	if( log_file )
	{
		FS_FCloseFile( log_file );
		log_file = 0;
	}
	logconsole = NULL;
	FS_Shutdown();

	wswcurl_cleanup();

	Dynvar_Shutdown();
	dynvars_initialized = qfalse;
	Cvar_Shutdown();
	Cmd_Shutdown();
	Cbuf_Shutdown();
	Memory_Shutdown();
	
	QMutex_Destroy( &com_print_mutex );

	QThreads_Shutdown();
}
Пример #5
0
void TEST_Shutdown (void)
{
	SV_Shutdown("test shutdown", qfalse);
	FS_Shutdown();
	Cmd_Shutdown();
	Cvar_Shutdown();
	Mem_Shutdown();
	Com_Shutdown();
	Cbuf_Shutdown();
	NET_Shutdown();

	com_aliasSysPool = NULL;
	com_cmdSysPool = NULL;
	com_cmodelSysPool = NULL;
	com_cvarSysPool = NULL;
	com_fileSysPool = NULL;
	com_genericPool = NULL;
}
Пример #6
0
/*
=================
Host_Shutdown
=================
*/
void EXPORT Host_Shutdown( void )
{
	if( host.shutdown_issued ) return;
	host.shutdown_issued = true;


	switch( host.state )
	{
	case HOST_INIT:
	case HOST_CRASHED:
	case HOST_ERR_FATAL:
		if( host.type == HOST_NORMAL )
			MsgDev( D_WARN, "Not shutting down normally (%d), skipping config save!\n", host.state );
		if( host.state != HOST_ERR_FATAL)
			host.state = HOST_SHUTDOWN;
		break;
	default:
		if( host.type == HOST_NORMAL )
		{
			Host_WriteConfig();
			IN_TouchWriteConfig();
		}
		host.state = HOST_SHUTDOWN; // prepare host to normal shutdown
	}

	if( !host.change_game )
		Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg ));

	Log_Printf( "Server shutdown\n" );
	Log_Close();

	SV_Shutdown( false );
	CL_Shutdown();

	Mod_Shutdown();
	NET_Shutdown();
	HTTP_Shutdown();
	Cmd_Shutdown();
	Host_FreeCommon();
	Con_DestroyConsole();
	Sys_RestoreCrashHandler();
}
Пример #7
0
void TEST_Shutdown (void)
{
	PTL_InitStartup();
	R_ShutdownImages();
	SV_Shutdown("test shutdown", false);
	FS_Shutdown();
	UI_Shutdown();
	Cmd_Shutdown();
	developer = nullptr;
	Cvar_Shutdown();
	Mem_Shutdown();
	Com_Shutdown();
	Cbuf_Shutdown();
	NET_Shutdown();

	com_aliasSysPool = nullptr;
	com_cmdSysPool = nullptr;
	com_cmodelSysPool = nullptr;
	com_cvarSysPool = nullptr;
	com_fileSysPool = nullptr;
	com_genericPool = nullptr;
}
Пример #8
0
/**
 * @brief Cleans up all game engine subsystems.
 */
static void Shutdown(const char *msg) {

	Com_Print("%s", msg);

	Sv_Shutdown(msg);

	Cl_Shutdown();

	Netchan_Shutdown();

	Thread_Shutdown();

	Con_Shutdown();

	Cvar_Shutdown();

	Cmd_Shutdown();

	Fs_Shutdown();

	Mem_Shutdown();

	SDL_Quit();
}
Пример #9
0
/*
===============
Host_Shutdown

FIXME: this is a callback from Sys_Quit and Sys_Error.  It would be better
to run quit through here before the final handoff to the sys code.
===============
*/
void Host_Shutdown(void)
{
	static qboolean isdown = false;

	if (isdown)
	{
		Con_Print("recursive shutdown\n");
		return;
	}
	if (setjmp(host_abortframe))
	{
		Con_Print("aborted the quitting frame?!?\n");
		return;
	}
	isdown = true;

	// be quiet while shutting down
	S_StopAllSounds();

	// end the server thread
	if (svs.threaded)
		SV_StopThread();

	// disconnect client from server if active
	CL_Disconnect();

	// shut down local server if active
	SV_LockThreadMutex();
	Host_ShutdownServer ();
	SV_UnlockThreadMutex();

#ifdef CONFIG_MENU
	// Shutdown menu
	if(MR_Shutdown)
		MR_Shutdown();
#endif

	// AK shutdown PRVM
	// AK hmm, no PRVM_Shutdown(); yet

	CL_Video_Shutdown();

    IRC_Shutdown();
	Host_SaveConfig();

#ifdef CONFIG_CD
	CDAudio_Shutdown ();
#endif
	S_Terminate ();
	Curl_Shutdown ();
	NetConn_Shutdown ();
	//PR_Shutdown ();

	if (cls.state != ca_dedicated)
	{
		R_Modules_Shutdown();
		VID_Shutdown();
	}

	SV_StopThread();
	Thread_Shutdown();
	Cmd_Shutdown();
	Key_Shutdown();
	CL_Shutdown();
	Sys_Shutdown();
	Log_Close();
	Crypto_Shutdown();

	Host_UnlockSession();

	S_Shutdown();
	Con_Shutdown();
	Memory_Shutdown();
}