/* * Memory_Shutdown * * NOTE: Should be the last called function before shutdown! */ void Memory_Shutdown( void ) { mempool_t *pool, *next; if( !memory_initialized ) return; // set the cvar to NULL so nothing is printed to non-existing console developerMemory = NULL; Mem_CheckSentinelsGlobal(); Mem_FreePool( &zoneMemPool ); Mem_FreePool( &tempMemPool ); for( pool = poolChain; pool; pool = next ) { // do it here, because pool is to be freed // and the chain will be broken next = pool->next; #ifdef SHOW_NONFREED Com_Printf( "Warning: Memory pool %s was never freed\n", pool->name ); #endif Mem_FreePool( &pool ); } memory_initialized = qfalse; }
/** * @brief Reset and free the UI data hunk * @note Even called in case of an error when CL_Shutdown was called - maybe even * before CL_InitLocal (and thus UI_Init) was called * @sa CL_Shutdown * @sa UI_Init */ void UI_Shutdown (void) { /* MN is not yet initialized */ if (ui_global.adata == nullptr) return; const uiBehaviour_t* confunc = UI_GetNodeBehaviour("confunc"); /* remove all confunc commands */ uiNode_t** nodes[] = {ui_global.windows, ui_global.components}; for (int nodeType = 0; nodeType < 2; ++nodeType) { for (int i = 0; i < ui_global.numWindows; i++) { uiNode_t* node = nodes[nodeType][i]; while (node) { /* remove the command */ if (node->behaviour == confunc) { /* many nodes to one command is allowed */ if (Cmd_Exists(node->name)) { Cmd_RemoveCommand(node->name); } } /* recursive next */ if (node->firstChild != nullptr) { node = node->firstChild; continue; } while (node) { if (node->next != nullptr) { node = node->next; break; } node = node->parent; } } } } UI_ShutdownLua(); UI_FontShutdown(); UI_ResetInput(); UI_ResetTimers(); #ifdef DEBUG Cmd_RemoveCommand("debug_uimemory"); #endif Cmd_RemoveCommand("ui_restart"); Mem_Free(ui_global.adata); OBJZERO(ui_global); /* release pools */ Mem_FreePool(ui_sysPool); Mem_FreePool(ui_dynStringPool); Mem_FreePool(ui_dynPool); ui_sysPool = nullptr; ui_dynStringPool = nullptr; ui_dynPool = nullptr; }
/** * @brief Reset and free the UI data hunk * @note Even called in case of an error when CL_Shutdown was called - maybe even * before CL_InitLocal (and thus UI_Init) was called * @sa CL_Shutdown * @sa UI_Init */ void UI_Shutdown (void) { int i; const uiBehaviour_t *confunc; /* MN is not yet initialized */ if (ui_global.adata == NULL) return; confunc = UI_GetNodeBehaviour("confunc"); /* remove all confunc commands */ for (i = 0; i < ui_global.numWindows; i++) { uiNode_t *node = ui_global.windows[i]; while (node) { /* remove the command */ if (node->behaviour == confunc) { /* many nodes to one command is allowed */ if (Cmd_Exists(node->name)) Cmd_RemoveCommand(node->name); } /* recursive next */ if (node->firstChild != NULL) node = node->firstChild; else { while (node) { if (node->next != NULL) { node = node->next; break; } node = node->parent; } } } } if (ui_global.adataize) Mem_Free(ui_global.adata); ui_global.adata = NULL; ui_global.adataize = 0; /* release pools */ Mem_FreePool(ui_sysPool); Mem_FreePool(ui_dynStringPool); Mem_FreePool(ui_dynPool); ui_sysPool = NULL; ui_dynStringPool = NULL; ui_dynPool = NULL; }
void CL_ParseMessageIDs (void) { const char* type, *name, *text; numMsgIDs = 0; OBJZERO(msgIDHash); if (cl_msgidPool != nullptr) { Mem_FreePool(cl_msgidPool); } else { cl_msgidPool = Mem_CreatePool("msgids"); } msgIDText = Mem_PoolAllocTypeN(char, MSGIDSIZE, cl_msgidPool); Com_Printf("\n----------- parse msgids -----------\n"); Com_Printf("%i msgid files\n", FS_BuildFileList("ufos/msgid/*.ufo")); text = nullptr; FS_NextScriptHeader(nullptr, nullptr, nullptr); while ((type = FS_NextScriptHeader("ufos/msgid/*.ufo", &name, &text)) != nullptr) { if (Q_streq(type, "msgid")) CL_ParseMessageID(name, &text); } }
/* * CL_UIModule_Init */ void CL_UIModule_Init( void ) { int apiversion; ui_import_t import; void *( *builtinAPIfunc )(void *) = NULL; #ifdef UI_HARD_LINKED builtinAPIfunc = GetCGameAPI; #endif CL_UIModule_Shutdown(); ui_mempool = _Mem_AllocPool( NULL, "User Iterface", MEMPOOL_USERINTERFACE, __FILE__, __LINE__ ); CL_UIModule_InitImportStruct( import ); uie = (ui_export_t *)Com_LoadGameLibrary( "ui", "GetUIAPI", &module_handle, &import, builtinAPIfunc, cls.sv_pure, NULL ); if( !uie ) Com_Error( ERR_DROP, "Failed to load UI dll" ); apiversion = uie->API(); if( apiversion != UI_API_VERSION ) { Com_UnloadGameLibrary( &module_handle ); Mem_FreePool( &ui_mempool ); uie = NULL; Com_Error( ERR_FATAL, "UI version is %i, not %i", apiversion, UI_API_VERSION ); } uie->Init( viddef.width, viddef.height, APP_PROTOCOL_VERSION, cls.mediaRandomSeed ); }
void Com_ScriptModule_Init( void ) { angelwrap_import_t import; static const char *name = "angelwrap"; Com_ScriptModule_Shutdown(); //if( !com_angelscript->integer ) //{ // if( verbose ) // { // Com_Printf( "Not loading angel script module\n" ); // Com_Printf( "------------------------------------\n" ); // } // return; //} Com_Printf( "------- angel script initialization -------\n" ); com_scriptmodulepool = Mem_AllocPool( NULL, "Angel Script Module" ); import.Error = Com_ScriptModule_Error; import.Print = Com_ScriptModule_Print; import.Milliseconds = Sys_Milliseconds; import.Cvar_Get = Cvar_Get; import.Cvar_Set = Cvar_Set; import.Cvar_SetValue = Cvar_SetValue; import.Cvar_ForceSet = Cvar_ForceSet; import.Cvar_String = Cvar_String; import.Cvar_Value = Cvar_Value; import.Cmd_Argc = Cmd_Argc; import.Cmd_Argv = Cmd_Argv; import.Cmd_Args = Cmd_Args; import.Cmd_AddCommand = Cmd_AddCommand; import.Cmd_RemoveCommand = Cmd_RemoveCommand; import.Cmd_ExecuteText = Cbuf_ExecuteText; import.Mem_Alloc = Com_ScriptModule_MemAlloc; import.Mem_Free = Com_ScriptModule_MemFree; import.Mem_AllocPool = Com_ScriptModule_MemAllocPool; import.Mem_FreePool = Com_ScriptModule_MemFreePool; import.Mem_EmptyPool = Com_ScriptModule_MemEmptyPool; // load the actual library if( !Com_ScriptModule_Load( name, &import ) ) { Mem_FreePool( &com_scriptmodulepool ); ae = NULL; return; } // check memory integrity Mem_CheckSentinelsGlobal(); Com_Printf( "------------------------------------\n" ); }
/* * CM_Shutdown */ void CM_Shutdown( void ) { if( !cm_initialized ) return; Mem_FreePool( &cmap_mempool ); cm_initialized = qfalse; }
void Host_FreeCommon( void ) { Image_Shutdown(); Sound_Shutdown(); Netchan_Shutdown(); FS_Shutdown(); Mem_FreePool( &host.mempool ); }
/** * @brief Frees the model pool * @param complete If this is true the static mesh models are freed, too * @sa R_SwitchModelMemPoolTag */ void R_ShutdownModels (bool complete) { int i; const int start = complete ? 0 : r_numModelsStatic; /* free the vertex buffer - but not for the static models * the world, the submodels and all the misc_models are located in the * r_models array */ for (i = start; i < r_numModels; i++) { model_t *mod = &r_models[i]; mBspModel_t *bsp = &mod->bsp; if (bsp->vertex_buffer) qglDeleteBuffers(1, &bsp->vertex_buffer); if (bsp->texcoord_buffer) qglDeleteBuffers(1, &bsp->texcoord_buffer); if (bsp->lmtexcoord_buffer) qglDeleteBuffers(1, &bsp->lmtexcoord_buffer); if (bsp->normal_buffer) qglDeleteBuffers(1, &bsp->normal_buffer); if (bsp->tangent_buffer) qglDeleteBuffers(1, &bsp->tangent_buffer); if (bsp->index_buffer) qglDeleteBuffers(1, &bsp->index_buffer); } /* don't free the static models with the tag MEM_TAG_STATIC_MODELS */ if (complete) { if (vid_modelPool) Mem_FreePool(vid_modelPool); if (vid_lightPool) Mem_FreePool(vid_lightPool); r_numModels = 0; r_numModelsInline = 0; r_numMapTiles = 0; OBJZERO(r_models); } else { if (vid_modelPool) Mem_FreeTag(vid_modelPool, 0); if (vid_lightPool) Mem_FreeTag(vid_lightPool, 0); r_numModels = r_numModelsStatic; } }
void Cmd_Shutdown (void) { OBJZERO(cmd_functions_hash); cmd_functions = NULL; OBJZERO(cmd_argv); cmd_argc = 0; Mem_FreePool(com_cmdSysPool); }
/* * CL_UIModule_Shutdown */ void CL_UIModule_Shutdown( void ) { if( !uie ) return; uie->Shutdown(); Mem_FreePool( &ui_mempool ); Com_UnloadGameLibrary( &module_handle ); uie = NULL; }
/* * CL_SoundModule_Shutdown */ void CL_SoundModule_Shutdown( qboolean verbose ) { if( se && se->API() == SOUND_API_VERSION ) { se->Shutdown( verbose ); se = NULL; } Com_UnloadLibrary( &sound_library ); Mem_FreePool( &cl_soundmodulepool ); }
/* * SV_ShutdownGameProgs * * Called when either the entire server is being killed, or * it is changing to a different game directory. */ void SV_ShutdownGameProgs( void ) { if( !ge ) return; ge->Shutdown(); Mem_FreePool( &sv_gameprogspool ); Com_UnloadGameLibrary( &module_handle ); ge = NULL; }
/* * CL_SoundModule_Shutdown */ void CL_SoundModule_Shutdown( qboolean verbose ) { if( !se ) return; se->Shutdown( verbose ); Com_UnloadLibrary( &sound_library ); Mem_FreePool( &cl_soundmodulepool ); se = NULL; }
void Com_ScriptModule_Shutdown( void ) { if( !ae ) return; ae->Shutdown(); Com_UnloadScriptLibrary(); Mem_FreePool( &com_scriptmodulepool ); ae = NULL; }
/* * CL_GameModule_Shutdown */ void CL_GameModule_Shutdown( void ) { if( !cge ) return; cls.cgameActive = qfalse; cge->Shutdown(); Mem_FreePool( &cl_gamemodulepool ); Com_UnloadGameLibrary( &module_handle ); cge = NULL; }
/* ================ FS_Shutdown ================ */ void FileSystem::Shutdown() { // release gamedirs for(int i = 0; i < SI.numgames; ++i) if( SI.games[i] ) Mem_Free( SI.games[i] ); Q_memset( &SI, 0, sizeof( sysinfo_t )); FS_ClearSearchPath(); // release all wad files too Mem_FreePool( &fs_mempool ); };
void StatQuery_Shutdown( void ) { // remaining references? if( --sq_refcount > 0 ) return; memset( &sq_export, 0, sizeof( sq_export ) ); if( sq_mempool != NULL ) Mem_FreePool( &sq_mempool ); sq_mempool = NULL; }
static void SCR_ShutdownFonts( void ) { while( gs_muFonts ) { SCR_FreeFont( gs_muFonts ); } cls.fontSystemSmall = NULL; cls.fontSystemMedium = NULL; cls.fontSystemBig = NULL; Mem_FreePool( &fonts_mempool ); }
void wswcurl_cleanup( void ) { while( http_requests ) { wswcurl_delete( http_requests ); } if( curldummy ) { curl_easy_cleanup( curldummy ); curldummy = NULL; } Mem_FreePool( &wswcurl_mempool ); }
/* * L10n_Shutdown */ void L10n_Shutdown( void ) { podomain_t *podomain, *next; for( podomain = podomains_head; podomain; podomain = next ) { next = podomain->next; L10n_DestroyPODomain( podomain ); } Mem_FreePool( &pomempool ); podomains_head = NULL; }
/* * SV_Shutdown * * Called once when the program is shutting down */ void SV_Shutdown( const char *finalmsg ) { if( !sv_initialized ) return; ML_Shutdown(); SV_MM_Shutdown( qtrue ); SV_ShutdownGame( finalmsg, qfalse ); SV_ShutdownOperatorCommands(); Mem_FreePool( &sv_mempool ); sv_initialized = qfalse; }
/* * CL_SoundModule_Shutdown */ void CL_SoundModule_Shutdown( bool verbose ) { if( !s_loaded ) { return; } s_loaded = false; if( se && se->API() == SOUND_API_VERSION ) { se->Shutdown( verbose ); se = NULL; } Com_UnloadLibrary( &sound_library ); Mem_FreePool( &cl_soundmodulepool ); }
void wswcurl_cleanup( void ) { if( !wswcurl_mempool ) return; while( http_requests ) { wswcurl_delete( http_requests ); } if( curldummy ) { qcurl_easy_cleanup( curldummy ); curldummy = NULL; } if( curlmulti ) { qcurl_multi_cleanup( curlmulti ); curlmulti = NULL; } QMutex_Destroy( &curldummy_mutex ); QMutex_Destroy( &http_requests_mutex ); #ifdef USE_OPENSSL if( cryptoLibrary ) { qCRYPTO_set_locking_callback( NULL ); if( crypto_num_mutexes && crypto_mutexes ) { int mutex_num; for( mutex_num = 0; mutex_num < crypto_num_mutexes; mutex_num++ ) QMutex_Destroy( &crypto_mutexes[mutex_num] ); WFREE( crypto_mutexes ); crypto_mutexes = NULL; } crypto_num_mutexes = 0; } #endif if( curlLibrary ) { qcurl_global_cleanup(); } wswcurl_unloadlib(); Mem_FreePool( &wswcurl_mempool ); }
void wswcurl_cleanup( void ) { while( http_requests ) { wswcurl_delete( http_requests ); } if( curldummy ) { curl_easy_cleanup( curldummy ); curldummy = NULL; } curl_multi_cleanup( curlmulti ); curlmulti = NULL; QMutex_Destroy( &http_requests_mutex ); Mem_FreePool( &wswcurl_mempool ); }
/* * R_ShutdownSkinFiles */ void R_ShutdownSkinFiles( void ) { int i; skinfile_t *skinfile; if( !r_skinsPool ) return; for( i = 0, skinfile = r_skinfiles; i < r_numskinfiles; i++, skinfile++ ) { if( !skinfile->name ) { continue; } SkinFile_FreeSkinFile( skinfile ); } r_numskinfiles = 0; Mem_FreePool( &r_skinsPool ); }
void CL_MM_Shutdown( qboolean logout ) { if( !cl_mm_initialized ) return; if( logout && cl_mm_enabled ) // logout is always forced at this stage CL_MM_Logout( qtrue ); //Com_Printf("CL_MM_Shutdown..\n"); Cvar_ForceSet( cl_mm_session->name, "0" ); Cmd_RemoveCommand( "mm_login" ); Cmd_RemoveCommand( "mm_logout" ); cls.mm_session = 0; cls.mm_ticket = 0; cl_mm_loginHandle = 0; cl_mm_loginState = LOGIN_STATE_NONE; cl_mm_loginTime = 0; cl_mm_loginRetries = 0; Mem_FreePool( &cl_mm_mempool ); cl_mm_mempool = 0; cl_mm_errmsg = NULL; cl_mm_errmsg_size = 0; cl_mm_profie_url = NULL; cl_mm_profie_url_rml = NULL; StatQuery_Shutdown(); sq_api = NULL; cl_mm_initialized = qfalse; }
static void Irc_LoadLibrary( void ) { static irc_import_t import; dllfunc_t funcs[2]; GetIrcAPI_t GetIrcAPI_f; assert( !irc_libhandle ); import.Printf = Irc_Print; import.CL_GetKeyDest = CL_GetKeyDest; import.CL_GetClientState = CL_GetClientState; import.Key_DelegatePush = Key_DelegatePush; import.Key_DelegatePop = Key_DelegatePop; import.SCR_RegisterFont = SCR_RegisterFont; import.SCR_DrawString = SCR_DrawString; import.SCR_DrawStringWidth = SCR_DrawStringWidth; import.SCR_DrawRawChar = SCR_DrawRawChar; import.SCR_strHeight = SCR_FontHeight; import.SCR_strWidth = SCR_strWidth; import.SCR_StrlenForWidth = SCR_StrlenForWidth; import.SCR_GetScreenWidth = SCR_GetScreenWidth; import.SCR_GetScreenHeight = SCR_GetScreenHeight; import.R_RegisterPic = SCR_RegisterPic; import.R_DrawStretchPic = SCR_DrawStretchPic; import.Sys_Milliseconds = Sys_Milliseconds; import.Sys_Microseconds = Sys_Microseconds; import.Mem_AllocPool = Irc_MemAllocPool; import.Mem_Alloc = Irc_MemAlloc; import.Mem_Free = Irc_MemFree; import.Mem_FreePool = Irc_MemFreePool; import.Mem_EmptyPool = Irc_MemEmptyPool; import.Dynvar_Create = Dynvar_Create; import.Dynvar_Destroy = Dynvar_Destroy; import.Dynvar_Lookup = Dynvar_Lookup; import.Dynvar_GetName = Dynvar_GetName; import.Dynvar_GetValue = Dynvar_GetValue; import.Dynvar_SetValue = Dynvar_SetValue; import.Dynvar_CallListeners = Dynvar_CallListeners; import.Dynvar_AddListener = Dynvar_AddListener; import.Dynvar_RemoveListener = Dynvar_RemoveListener; import.DYNVAR_WRITEONLY = DYNVAR_WRITEONLY; import.DYNVAR_READONLY = DYNVAR_READONLY; import.Cvar_Get = Cvar_Get; import.Cvar_Set = Cvar_Set; import.Cvar_SetValue = Cvar_SetValue; import.Cvar_ForceSet = Cvar_ForceSet; import.Cvar_Integer = Cvar_Integer; import.Cvar_Value = Cvar_Value; import.Cvar_String = Cvar_String; import.Cmd_Argc = Cmd_Argc; import.Cmd_Argv = Cmd_Argv; import.Cmd_Args = Cmd_Args; import.Cmd_AddCommand = Cmd_AddCommand; import.Cmd_RemoveCommand = Cmd_RemoveCommand; import.Cmd_ExecuteString = Cmd_ExecuteString; import.Com_BeginRedirect = Com_BeginRedirect; import.Com_EndRedirect = Com_EndRedirect; import.Cmd_SetCompletionFunc = Cmd_SetCompletionFunc; import.Cbuf_AddText = Cbuf_AddText; import.Trie_Create = Trie_Create; import.Trie_Destroy = Trie_Destroy; import.Trie_Clear = Trie_Clear; import.Trie_GetSize = Trie_GetSize; import.Trie_Insert = Trie_Insert; import.Trie_Remove = Trie_Remove; import.Trie_Replace = Trie_Replace; import.Trie_Find = Trie_Find; import.Trie_FindIf = Trie_FindIf; import.Trie_NoOfMatches = Trie_NoOfMatches; import.Trie_NoOfMatchesIf = Trie_NoOfMatchesIf; import.Trie_Dump = Trie_Dump; import.Trie_DumpIf = Trie_DumpIf; import.Trie_FreeDump = Trie_FreeDump; // load dynamic library Com_Printf( "Loading IRC module... " ); funcs[0].name = "GetIrcAPI"; funcs[0].funcPointer = (void **) &GetIrcAPI_f; funcs[1].name = NULL; irc_libhandle = Com_LoadLibrary( LIB_DIRECTORY "/" LIB_PREFIX "irc_" ARCH LIB_SUFFIX, funcs ); if( irc_libhandle ) { // load succeeded int api_version; irc_export = GetIrcAPI_f( &import ); irc_pool = Mem_AllocPool( NULL, "IRC Module" ); api_version = irc_export->API(); if( api_version == IRC_API_VERSION ) { if( irc_export->Init() ) { dynvar_t *const quit = Dynvar_Lookup( "quit" ); if( quit ) Dynvar_AddListener( quit, Irc_Quit_f ); irc_initialized = true; Cmd_AddCommand( "irc_unload", Irc_UnloadLibrary ); Com_Printf( "Success.\n" ); } else { // initialization failed Mem_FreePool( &irc_pool ); Com_Printf( "Initialization failed.\n" ); Irc_UnloadLibrary(); } } else { // wrong version Mem_FreePool( &irc_pool ); Com_Printf( "Wrong version: %i, not %i.\n", api_version, IRC_API_VERSION ); Irc_UnloadLibrary(); } } else { Com_Printf( "Not found.\n" ); } Mem_DebugCheckSentinelsGlobal(); }
/* * CL_GameModule_Init */ void CL_GameModule_Init( void ) { int apiversion; unsigned int start; cgame_import_t import; void *( *builtinAPIfunc )(void *) = NULL; #ifdef CGAME_HARD_LINKED builtinAPIfunc = GetCGameAPI; #endif // stop all playing sounds CL_SoundModule_StopAllSounds( true, true ); CL_GameModule_Shutdown(); // disable reading of client game module chat cvars Cvar_ForceSet( "con_chatCGame", "0" ); cl_gamemodulepool = _Mem_AllocPool( NULL, "Client Game Progs", MEMPOOL_CLIENTGAME, __FILE__, __LINE__ ); import.Error = CL_GameModule_Error; import.Print = CL_GameModule_Print; import.PrintToLog = CL_GameModule_PrintToLog; import.Dynvar_Create = Dynvar_Create; import.Dynvar_Destroy = Dynvar_Destroy; import.Dynvar_Lookup = Dynvar_Lookup; import.Dynvar_GetName = Dynvar_GetName; import.Dynvar_GetValue = Dynvar_GetValue; import.Dynvar_SetValue = Dynvar_SetValue; import.Dynvar_AddListener = Dynvar_AddListener; import.Dynvar_RemoveListener = Dynvar_RemoveListener; import.Cvar_Get = Cvar_Get; import.Cvar_Set = Cvar_Set; import.Cvar_SetValue = Cvar_SetValue; import.Cvar_ForceSet = Cvar_ForceSet; import.Cvar_String = Cvar_String; import.Cvar_Value = Cvar_Value; import.Cmd_TokenizeString = Cmd_TokenizeString; import.Cmd_Argc = Cmd_Argc; import.Cmd_Argv = Cmd_Argv; import.Cmd_Args = Cmd_Args; import.Cmd_AddCommand = Cmd_AddCommand; import.Cmd_RemoveCommand = Cmd_RemoveCommand; import.Cmd_ExecuteText = Cbuf_ExecuteText; import.Cmd_Execute = Cbuf_Execute; import.Cmd_SetCompletionFunc = Cmd_SetCompletionFunc; import.FS_FOpenFile = FS_FOpenFile; import.FS_Read = FS_Read; import.FS_Write = FS_Write; import.FS_Print = FS_Print; import.FS_Tell = FS_Tell; import.FS_Seek = FS_Seek; import.FS_Eof = FS_Eof; import.FS_Flush = FS_Flush; import.FS_FCloseFile = FS_FCloseFile; import.FS_RemoveFile = FS_RemoveFile; import.FS_GetFileList = FS_GetFileList; import.FS_FirstExtension = FS_FirstExtension; import.FS_IsPureFile = FS_IsPureFile; import.FS_MoveFile = FS_MoveFile; import.FS_IsUrl = FS_IsUrl; import.FS_FileMTime = FS_BaseFileMTime; import.FS_RemoveDirectory = FS_RemoveDirectory; import.Key_GetBindingBuf = Key_GetBindingBuf; import.Key_KeynumToString = Key_KeynumToString; import.GetConfigString = CL_GameModule_GetConfigString; import.Milliseconds = Sys_Milliseconds; import.DownloadRequest = CL_DownloadRequest; import.NET_GetUserCmd = CL_GameModule_NET_GetUserCmd; import.NET_GetCurrentUserCmdNum = CL_GameModule_NET_GetCurrentUserCmdNum; import.NET_GetCurrentState = CL_GameModule_NET_GetCurrentState; import.RefreshMouseAngles = CL_GameModule_RefreshMouseAngles; import.R_UpdateScreen = SCR_UpdateScreen; import.R_GetClippedFragments = re.GetClippedFragments; import.R_ClearScene = re.ClearScene; import.R_AddEntityToScene = re.AddEntityToScene; import.R_AddLightToScene = re.AddLightToScene; import.R_AddPolyToScene = re.AddPolyToScene; import.R_AddLightStyleToScene = re.AddLightStyleToScene; import.R_RenderScene = re.RenderScene; import.R_SpeedsMessage = re.SpeedsMessage; import.R_RegisterWorldModel = CL_GameModule_R_RegisterWorldModel; import.R_ModelBounds = re.ModelBounds; import.R_ModelFrameBounds = re.ModelFrameBounds; import.R_RegisterModel = re.RegisterModel; import.R_RegisterPic = re.RegisterPic; import.R_RegisterRawPic = re.RegisterRawPic; import.R_RegisterLevelshot = re.RegisterLevelshot; import.R_RegisterSkin = re.RegisterSkin; import.R_RegisterSkinFile = re.RegisterSkinFile; import.R_LerpTag = re.LerpTag; import.R_LightForOrigin = re.LightForOrigin; import.R_SetCustomColor = re.SetCustomColor; import.R_DrawStretchPic = re.DrawStretchPic; import.R_DrawStretchPoly = re.DrawStretchPoly; import.R_DrawRotatedStretchPic = re.DrawRotatedStretchPic; import.R_Scissor = re.Scissor; import.R_GetScissor = re.GetScissor; import.R_ResetScissor = re.ResetScissor; import.R_GetShaderDimensions = re.GetShaderDimensions; import.R_TransformVectorToScreen = re.TransformVectorToScreen; import.R_SkeletalGetNumBones = re.SkeletalGetNumBones; import.R_SkeletalGetBoneInfo = re.SkeletalGetBoneInfo; import.R_SkeletalGetBonePose = re.SkeletalGetBonePose; import.R_GetShaderForOrigin = re.GetShaderForOrigin; import.R_GetShaderCinematic = re.GetShaderCinematic; import.VID_FlashWindow = VID_FlashWindow; import.CM_NumInlineModels = CL_GameModule_CM_NumInlineModels; import.CM_InlineModel = CL_GameModule_CM_InlineModel; import.CM_TransformedBoxTrace = CL_GameModule_CM_TransformedBoxTrace; import.CM_RoundUpToHullSize = CL_GameModule_CM_RoundUpToHullSize; import.CM_TransformedPointContents = CL_GameModule_CM_TransformedPointContents; import.CM_ModelForBBox = CL_GameModule_CM_ModelForBBox; import.CM_OctagonModelForBBox = CL_GameModule_CM_OctagonModelForBBox; import.CM_InlineModelBounds = CL_GameModule_CM_InlineModelBounds; import.CM_InPVS = CL_GameModule_CM_InPVS; import.S_RegisterSound = CL_SoundModule_RegisterSound; import.S_StartFixedSound = CL_SoundModule_StartFixedSound; import.S_StartRelativeSound = CL_SoundModule_StartRelativeSound; import.S_StartGlobalSound = CL_SoundModule_StartGlobalSound; import.S_Update = CL_GameModule_SoundUpdate; import.S_AddLoopSound = CL_SoundModule_AddLoopSound; import.S_StartBackgroundTrack = CL_SoundModule_StartBackgroundTrack; import.S_StopBackgroundTrack = CL_SoundModule_StopBackgroundTrack; import.S_RawSamples = CL_GameModule_S_RawSamples; import.S_PositionedRawSamples = CL_SoundModule_PositionedRawSamples; import.S_GetRawSamplesLength = CL_SoundModule_GetRawSamplesLength; import.S_GetPositionedRawSamplesLength = CL_SoundModule_GetPositionedRawSamplesLength; import.S_SetEntitySpatilization = CL_SoundModule_SetEntitySpatilization; import.SCR_RegisterFont = SCR_RegisterFont; import.SCR_RegisterSpecialFont = SCR_RegisterSpecialFont; import.SCR_DrawString = SCR_DrawString; import.SCR_DrawStringWidth = SCR_DrawStringWidth; import.SCR_DrawClampString = SCR_DrawClampString; import.SCR_DrawMultilineString = SCR_DrawMultilineString; import.SCR_DrawRawChar = SCR_DrawRawChar; import.SCR_DrawClampChar = SCR_DrawClampChar; import.SCR_FontSize = SCR_FontSize; import.SCR_FontHeight = SCR_FontHeight; import.SCR_FontUnderline = SCR_FontUnderline; import.SCR_FontAdvance = SCR_FontAdvance; import.SCR_FontXHeight = SCR_FontXHeight; import.SCR_SetDrawCharIntercept = SCR_SetDrawCharIntercept; import.SCR_strWidth = SCR_strWidth; import.SCR_StrlenForWidth = SCR_StrlenForWidth; import.AsyncStream_UrlEncode = AsyncStream_UrlEncode; import.AsyncStream_UrlDecode = AsyncStream_UrlDecode; import.AsyncStream_PerformRequest = CL_GameModule_AsyncStream_PerformRequest; import.GetBaseServerURL = CL_GetBaseServerURL; import.Mem_Alloc = CL_GameModule_MemAlloc; import.Mem_Free = CL_GameModule_MemFree; import.L10n_LoadLangPOFile = &CL_GameModule_L10n_LoadLangPOFile; import.L10n_TranslateString = &CL_GameModule_L10n_TranslateString; import.L10n_ClearDomain = &CL_GameModule_L10n_ClearDomain; import.CIN_AddRawSamplesListener = &CL_GameModule_AddRawSamplesListener; import.IN_GetThumbsticks = IN_GetThumbsticks; import.IN_IME_GetCandidates = IN_IME_GetCandidates; import.IN_SupportedDevices = IN_SupportedDevices; if( builtinAPIfunc ) { cge = builtinAPIfunc( &import ); } else { cge = (cgame_export_t *)Com_LoadGameLibrary( "cgame", "GetCGameAPI", &module_handle, &import, cls.sv_pure, NULL ); } if( !cge ) Com_Error( ERR_DROP, "Failed to load client game DLL" ); AC_LoadLibrary( (void *) &import, (void *) cge, ANTICHEAT_CLIENT ); // impulZ: Refire AC Init apiversion = cge->API(); if( apiversion != CGAME_API_VERSION ) { Com_UnloadGameLibrary( &module_handle ); Mem_FreePool( &cl_gamemodulepool ); cge = NULL; Com_Error( ERR_DROP, "Client game is version %i, not %i", apiversion, CGAME_API_VERSION ); } CL_GameModule_AsyncStream_Init(); start = Sys_Milliseconds(); cge->Init( cls.servername, cl.playernum, viddef.width, viddef.height, VID_GetPixelRatio(), cls.demo.playing, cls.demo.playing ? cls.demo.filename : "", cls.sv_pure, cl.snapFrameTime, APP_PROTOCOL_VERSION, APP_DEMO_EXTENSION_STR, cls.mediaRandomSeed, cl.gamestart ); Com_DPrintf( "CL_GameModule_Init: %.2f seconds\n", (float)( Sys_Milliseconds() - start ) * 0.001f ); cl.gamestart = false; cls.cgameActive = true; }
void Sound_Shutdown( void ) { Mem_Check(); // check for leaks Mem_FreePool( &host.soundpool ); }