mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 07:02:12 +00:00
fix some valgrind issues.
linux port now finally reports detected ip addresses. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4899 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
c07f7ef10c
commit
3a4200f0ee
12 changed files with 108 additions and 84 deletions
|
@ -5639,14 +5639,15 @@ void CSQC_Shutdown(void)
|
||||||
CSQC_ForgetThreads();
|
CSQC_ForgetThreads();
|
||||||
PR_ReleaseFonts(kdm_game);
|
PR_ReleaseFonts(kdm_game);
|
||||||
PR_Common_Shutdown(csqcprogs, false);
|
PR_Common_Shutdown(csqcprogs, false);
|
||||||
|
World_Destroy(&csqc_world);
|
||||||
csqcprogs->CloseProgs(csqcprogs);
|
csqcprogs->CloseProgs(csqcprogs);
|
||||||
}
|
|
||||||
csqc_world.progs = csqcprogs = NULL;
|
csqc_world.progs = csqcprogs = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
World_Destroy(&csqc_world);
|
||||||
|
|
||||||
Cmd_RemoveCommands(CS_ConsoleCommand_f);
|
Cmd_RemoveCommands(CS_ConsoleCommand_f);
|
||||||
|
|
||||||
if (csqc_world.rbe)
|
|
||||||
csqc_world.rbe->End(&csqc_world);
|
|
||||||
|
|
||||||
Z_Free(csqcdelta_pack_new.e);
|
Z_Free(csqcdelta_pack_new.e);
|
||||||
memset(&csqcdelta_pack_new, 0, sizeof(csqcdelta_pack_new));
|
memset(&csqcdelta_pack_new, 0, sizeof(csqcdelta_pack_new));
|
||||||
|
|
|
@ -89,7 +89,7 @@ void FS_UnRegisterFileSystemModule(void *module)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
qboolean found = false;
|
qboolean found = false;
|
||||||
if (Sys_LockMutex(fs_thread_mutex))
|
if (!fs_thread_mutex || Sys_LockMutex(fs_thread_mutex))
|
||||||
{
|
{
|
||||||
for (i = 0; i < sizeof(searchpathformats)/sizeof(searchpathformats[0]); i++)
|
for (i = 0; i < sizeof(searchpathformats)/sizeof(searchpathformats[0]); i++)
|
||||||
{
|
{
|
||||||
|
@ -100,6 +100,8 @@ void FS_UnRegisterFileSystemModule(void *module)
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fs_thread_mutex)
|
||||||
|
{
|
||||||
Sys_UnlockMutex(fs_thread_mutex);
|
Sys_UnlockMutex(fs_thread_mutex);
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
|
@ -107,6 +109,7 @@ void FS_UnRegisterFileSystemModule(void *module)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char *VFS_GETS(vfsfile_t *vf, char *buffer, int buflen)
|
char *VFS_GETS(vfsfile_t *vf, char *buffer, int buflen)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct sockaddr;
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
#include "netinc.h"
|
#include "netinc.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(__linux__) && !defined(ANDROID)
|
||||||
#define USE_GETHOSTNAME_LOCALLISTING
|
#define USE_GETHOSTNAME_LOCALLISTING
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2256,7 +2256,7 @@ int FTENET_GetLocalAddress(int port, qboolean ipx, qboolean ipv4, qboolean ipv6,
|
||||||
//in linux, looking up our own hostname to retrieve a list of local interface addresses will give no indication that other systems are able to do the same thing and is thus not supported.
|
//in linux, looking up our own hostname to retrieve a list of local interface addresses will give no indication that other systems are able to do the same thing and is thus not supported.
|
||||||
//there's some special api instead
|
//there's some special api instead
|
||||||
//glibc 2.3.
|
//glibc 2.3.
|
||||||
//also available with certain bsds.
|
//also available with certain bsds, I'm but unsure which preprocessor we can use.
|
||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
|
|
||||||
static struct ifaddrs *iflist;
|
static struct ifaddrs *iflist;
|
||||||
|
@ -2290,7 +2290,7 @@ int FTENET_GetLocalAddress(int port, qboolean ipx, qboolean ipv4, qboolean ipv6,
|
||||||
#ifdef HAVE_IPV4
|
#ifdef HAVE_IPV4
|
||||||
(fam == AF_INET && ipv4) ||
|
(fam == AF_INET && ipv4) ||
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_IPV6
|
#ifdef IPPROTO_IPV6
|
||||||
(fam == AF_INET6 && ipv6) ||
|
(fam == AF_INET6 && ipv6) ||
|
||||||
#endif
|
#endif
|
||||||
#ifdef USEIPX
|
#ifdef USEIPX
|
||||||
|
@ -2298,7 +2298,7 @@ int FTENET_GetLocalAddress(int port, qboolean ipx, qboolean ipv4, qboolean ipv6,
|
||||||
#endif
|
#endif
|
||||||
0)
|
0)
|
||||||
{
|
{
|
||||||
SockadrToNetadr((struct sockaddr_qstorage*)&ifa->ifa_addr, &addresses[idx]);
|
SockadrToNetadr((struct sockaddr_qstorage*)ifa->ifa_addr, &addresses[idx]);
|
||||||
addresses[idx].port = port;
|
addresses[idx].port = port;
|
||||||
adrflags[idx] = 0;
|
adrflags[idx] = 0;
|
||||||
idx++;
|
idx++;
|
||||||
|
@ -5013,66 +5013,53 @@ void NET_PrintAddresses(ftenet_connections_t *collection)
|
||||||
{
|
{
|
||||||
if (addr[i].type != NA_INVALID)
|
if (addr[i].type != NA_INVALID)
|
||||||
{
|
{
|
||||||
warn = false;
|
char *scope = "net";
|
||||||
|
char *desc = NULL;
|
||||||
if (addr[i].type == NA_LOOPBACK)
|
if (addr[i].type == NA_LOOPBACK)
|
||||||
{
|
{
|
||||||
//we don't list 127.0.0.1 or ::1, so don't bother with this either. its not interesting.
|
//we don't list 127.0.0.1 or ::1, so don't bother with this either. its not interesting.
|
||||||
// Con_Printf("internal address (%s): %s\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
scope = NULL/*"internal"*/, desc = "internal";
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (addr[i].type == NA_IPV6)
|
else if (addr[i].type == NA_IPV6)
|
||||||
{
|
{
|
||||||
if ((*(int*)addr[i].address.ip6&BigLong(0xffc00000)) == BigLong(0xfe800000)) //fe80::/10
|
if ((*(int*)addr[i].address.ip6&BigLong(0xffc00000)) == BigLong(0xfe800000)) //fe80::/10
|
||||||
{
|
scope = "lan", desc = "link-local";
|
||||||
Con_Printf("lan address (%s): %s (link-local)\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
else if ((*(int*)addr[i].address.ip6&BigLong(0xfe000000)) == BigLong(0xfc00000)) //fc::/7
|
||||||
continue;
|
scope = "lan", desc = "ULA/private";
|
||||||
|
else if (*(int*)addr[i].address.ip6 == BigLong(0x20010000)) //2001::/32
|
||||||
|
scope = "net", desc = "toredo";
|
||||||
|
else if ((*(int*)addr[i].address.ip6&BigLong(0xffff0000)) == BigLong(0x20020000)) //2002::/16
|
||||||
|
scope = "net", desc = "6to4";
|
||||||
|
else if (memcmp(addr[i].address.ip6, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1", 16) == 0) //::1
|
||||||
|
scope = "local", desc = "localhost";
|
||||||
|
else if (memcmp(addr[i].address.ip6, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) == 0) //::
|
||||||
|
scope = "net", desc = "any";
|
||||||
}
|
}
|
||||||
if ((*(int*)addr[i].address.ip6&BigLong(0xfe000000)) == BigLong(0xfc00000)) //fc::/7
|
else if (addr[i].type == NA_IP)
|
||||||
{
|
|
||||||
Con_Printf("lan address (%s): %s (ULA/private)\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (*(int*)addr[i].address.ip6 == BigLong(0x20010000)) //2001::/32
|
|
||||||
{
|
|
||||||
Con_Printf("net address (%s): %s (toredo)\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((*(int*)addr[i].address.ip6&BigLong(0xffff0000)) == BigLong(0x20020000)) //2002::/16
|
|
||||||
{
|
|
||||||
Con_Printf("net address (%s): %s (6to4)\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (addr[i].type == NA_IP)
|
|
||||||
{
|
{
|
||||||
if ((*(int*)addr[i].address.ip&BigLong(0xffff0000)) == BigLong(0xA9FE0000)) //169.254.x.x/16
|
if ((*(int*)addr[i].address.ip&BigLong(0xffff0000)) == BigLong(0xA9FE0000)) //169.254.x.x/16
|
||||||
|
scope = "lan", desc = "link-local";
|
||||||
|
else if ((*(int*)addr[i].address.ip&BigLong(0xff000000)) == BigLong(0x0a000000)) //10.x.x.x/8
|
||||||
|
scope = "lan", desc = "private";
|
||||||
|
else if ((*(int*)addr[i].address.ip&BigLong(0xff000000)) == BigLong(0x7f000000)) //127.x.x.x/8
|
||||||
|
scope = "local", desc = "localhost";
|
||||||
|
else if ((*(int*)addr[i].address.ip&BigLong(0xfff00000)) == BigLong(0xac100000)) //172.16.x.x/12
|
||||||
|
scope = "lan", desc = "private";
|
||||||
|
else if ((*(int*)addr[i].address.ip&BigLong(0xffff0000)) == BigLong(0xc0a80000)) //192.168.x.x/16
|
||||||
|
scope = "lan", desc = "private";
|
||||||
|
else if ((*(int*)addr[i].address.ip&BigLong(0xffc00000)) == BigLong(0x64400000)) //10.64.x.x/10
|
||||||
|
scope = "lan", desc = "CGNAT";
|
||||||
|
else if (*(int*)addr[i].address.ip == BigLong(0x00000000)) //0.0.0.0/32
|
||||||
|
scope = "lan", desc = "any";
|
||||||
|
}
|
||||||
|
if (scope)
|
||||||
{
|
{
|
||||||
Con_Printf("lan address (%s): %s (link-local)\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
warn = false;
|
||||||
continue;
|
if (desc)
|
||||||
|
Con_Printf("%s address (%s): %s (%s)\n", scope, con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]), desc);
|
||||||
|
else
|
||||||
|
Con_Printf("%s address (%s): %s\n", scope, con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
||||||
}
|
}
|
||||||
if ((*(int*)addr[i].address.ip&BigLong(0xff000000)) == BigLong(0x0a000000)) //10.x.x.x/8
|
|
||||||
{
|
|
||||||
Con_Printf("lan address (%s): %s (private)\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((*(int*)addr[i].address.ip&BigLong(0xfff00000)) == BigLong(0xac100000)) //172.16.x.x/12
|
|
||||||
{
|
|
||||||
Con_Printf("lan address (%s): %s (private)\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((*(int*)addr[i].address.ip&BigLong(0xffff0000)) == BigLong(0xc0a80000)) //192.168.x.x/16
|
|
||||||
{
|
|
||||||
Con_Printf("lan address (%s): %s (private)\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((*(int*)addr[i].address.ip&BigLong(0xffc00000)) == BigLong(0x64400000)) //10.64.x.x/10
|
|
||||||
{
|
|
||||||
Con_Printf("lan address (%s): %s (CGNAT)\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Con_Printf("net address (%s): %s\n", con[i]->name, NET_AdrToString(adrbuf, sizeof(adrbuf), &addr[i]));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1884,7 +1884,7 @@ void Plug_Shutdown(qboolean preliminary)
|
||||||
if ((*p)->blockcloses)
|
if ((*p)->blockcloses)
|
||||||
p = &(*p)->next;
|
p = &(*p)->next;
|
||||||
else
|
else
|
||||||
Plug_Close(plugs);
|
Plug_Close(*p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -251,7 +251,7 @@ void QDECL World_ReleaseCollisionMesh(wedict_t *ed);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void World_Destroy (world_t *w);
|
||||||
void World_RBE_Start(world_t *world);
|
void World_RBE_Start(world_t *world);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,6 @@ void Mod_UpdateLightmap(int snum)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SERVERONLY
|
|
||||||
static void Mod_MemList_f(void)
|
static void Mod_MemList_f(void)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
|
@ -123,7 +122,7 @@ static void Mod_MemList_f(void)
|
||||||
}
|
}
|
||||||
Con_Printf("Total: %i bytes\n", total);
|
Con_Printf("Total: %i bytes\n", total);
|
||||||
}
|
}
|
||||||
|
#ifndef SERVERONLY
|
||||||
static void Mod_BatchList_f(void)
|
static void Mod_BatchList_f(void)
|
||||||
{
|
{
|
||||||
int m, i;
|
int m, i;
|
||||||
|
@ -535,6 +534,7 @@ Mod_Init
|
||||||
*/
|
*/
|
||||||
void Mod_Init (qboolean initial)
|
void Mod_Init (qboolean initial)
|
||||||
{
|
{
|
||||||
|
if (!mod_known)
|
||||||
mod_known = malloc(MAX_MOD_KNOWN * sizeof(*mod_known));
|
mod_known = malloc(MAX_MOD_KNOWN * sizeof(*mod_known));
|
||||||
if (!initial)
|
if (!initial)
|
||||||
{
|
{
|
||||||
|
@ -543,8 +543,8 @@ void Mod_Init (qboolean initial)
|
||||||
mod_numknown = 0;
|
mod_numknown = 0;
|
||||||
Q1BSP_Init();
|
Q1BSP_Init();
|
||||||
|
|
||||||
#ifndef SERVERONLY
|
|
||||||
Cmd_AddCommand("mod_memlist", Mod_MemList_f);
|
Cmd_AddCommand("mod_memlist", Mod_MemList_f);
|
||||||
|
#ifndef SERVERONLY
|
||||||
Cmd_AddCommand("mod_batchlist", Mod_BatchList_f);
|
Cmd_AddCommand("mod_batchlist", Mod_BatchList_f);
|
||||||
Cmd_AddCommand("mod_texturelist", Mod_TextureList_f);
|
Cmd_AddCommand("mod_texturelist", Mod_TextureList_f);
|
||||||
Cmd_AddCommand("mod_usetexture", Mod_BlockTextureColour_f);
|
Cmd_AddCommand("mod_usetexture", Mod_BlockTextureColour_f);
|
||||||
|
@ -603,6 +603,9 @@ void Mod_Shutdown (qboolean final)
|
||||||
{
|
{
|
||||||
if (final)
|
if (final)
|
||||||
{
|
{
|
||||||
|
Mod_ClearAll();
|
||||||
|
Mod_Purge(MP_RESET);
|
||||||
|
|
||||||
Mod_UnRegisterAllModelFormats(NULL);
|
Mod_UnRegisterAllModelFormats(NULL);
|
||||||
#ifdef Q2BSPS
|
#ifdef Q2BSPS
|
||||||
CM_Shutdown();
|
CM_Shutdown();
|
||||||
|
|
|
@ -80,9 +80,13 @@ void PRAddressableRelocate(progfuncs_t *progfuncs, char *oldb, char *newb, int o
|
||||||
//for 64bit systems. :)
|
//for 64bit systems. :)
|
||||||
//addressable memory is memory available to the vm itself for writing.
|
//addressable memory is memory available to the vm itself for writing.
|
||||||
//once allocated, it cannot be freed for the lifetime of the VM.
|
//once allocated, it cannot be freed for the lifetime of the VM.
|
||||||
void *PRAddressableExtend(progfuncs_t *progfuncs, int ammount)
|
//if src is null, data srcsize is left uninitialised for speed.
|
||||||
|
//pad is always 0-filled.
|
||||||
|
void *PRAddressableExtend(progfuncs_t *progfuncs, void *src, size_t srcsize, int pad)
|
||||||
{
|
{
|
||||||
ammount = (ammount + 4)&~3; //round up to 4
|
char *ptr;
|
||||||
|
int ammount = (srcsize+pad + 4)&~3; //round up to 4
|
||||||
|
pad = ammount - srcsize;
|
||||||
if (prinst.addressableused + ammount > prinst.addressablesize)
|
if (prinst.addressableused + ammount > prinst.addressablesize)
|
||||||
{
|
{
|
||||||
/*only do this if the caller states that it can cope with addressable-block relocations/resizes*/
|
/*only do this if the caller states that it can cope with addressable-block relocations/resizes*/
|
||||||
|
@ -133,6 +137,10 @@ void *PRAddressableExtend(progfuncs_t *progfuncs, int ammount)
|
||||||
Sys_Error("VirtualAlloc failed. Blame windows.");
|
Sys_Error("VirtualAlloc failed. Blame windows.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ptr = &prinst.addressablehunk[prinst.addressableused-ammount];
|
||||||
|
if (src)
|
||||||
|
memcpy(ptr, src, srcsize);
|
||||||
|
memset(ptr+srcsize, 0, pad);
|
||||||
return &prinst.addressablehunk[prinst.addressableused-ammount];
|
return &prinst.addressablehunk[prinst.addressableused-ammount];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,13 +273,14 @@ static void *PDECL PR_memalloc (pubprogfuncs_t *ppf, unsigned int size)
|
||||||
/*assign more space*/
|
/*assign more space*/
|
||||||
if (!ub)
|
if (!ub)
|
||||||
{
|
{
|
||||||
ub = PRAddressableExtend(progfuncs, size);
|
ub = PRAddressableExtend(progfuncs, NULL, size, 0);
|
||||||
if (!ub)
|
if (!ub)
|
||||||
{
|
{
|
||||||
printf("PF_memalloc: memory exausted\n");
|
printf("PF_memalloc: memory exausted\n");
|
||||||
PR_StackTrace(&progfuncs->funcs, false);
|
PR_StackTrace(&progfuncs->funcs, false);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
//FIXME: merge with previous block
|
||||||
}
|
}
|
||||||
memset(ub, 0, size);
|
memset(ub, 0, size);
|
||||||
ub->marker = MARKER;
|
ub->marker = MARKER;
|
||||||
|
@ -441,7 +450,7 @@ int PDECL PR_InitEnts(pubprogfuncs_t *ppf, int max_ents)
|
||||||
prinst.edicttable = PRHunkAlloc(progfuncs, maxedicts*sizeof(struct edicts_s *), "edicttable");
|
prinst.edicttable = PRHunkAlloc(progfuncs, maxedicts*sizeof(struct edicts_s *), "edicttable");
|
||||||
sv_edicts = PRHunkAlloc(progfuncs, externs->edictsize, "edict0");
|
sv_edicts = PRHunkAlloc(progfuncs, externs->edictsize, "edict0");
|
||||||
prinst.edicttable[0] = sv_edicts;
|
prinst.edicttable[0] = sv_edicts;
|
||||||
((edictrun_t*)prinst.edicttable[0])->fields = PRAddressableExtend(progfuncs, max_fields_size);
|
((edictrun_t*)prinst.edicttable[0])->fields = PRAddressableExtend(progfuncs, NULL, fields_size, max_fields_size-fields_size);
|
||||||
QC_ClearEdict(&progfuncs->funcs, sv_edicts);
|
QC_ClearEdict(&progfuncs->funcs, sv_edicts);
|
||||||
sv_num_edicts = 1;
|
sv_num_edicts = 1;
|
||||||
|
|
||||||
|
@ -498,6 +507,9 @@ static void PDECL PR_Configure (pubprogfuncs_t *ppf, size_t addressable_size, in
|
||||||
maxprogs = max_progs;
|
maxprogs = max_progs;
|
||||||
pr_typecurrent=-1;
|
pr_typecurrent=-1;
|
||||||
|
|
||||||
|
prinst.nexttempstring = 0;
|
||||||
|
prinst.maxtempstrings = 0;
|
||||||
|
|
||||||
prinst.reorganisefields = false;
|
prinst.reorganisefields = false;
|
||||||
|
|
||||||
prinst.profiling = profiling;
|
prinst.profiling = profiling;
|
||||||
|
|
|
@ -35,7 +35,7 @@ edictrun_t *ED_AllocIntoTable (progfuncs_t *progfuncs, int num)
|
||||||
|
|
||||||
prinst.edicttable[num] = *(struct edict_s **)&e = (void*)externs->memalloc(externs->edictsize);
|
prinst.edicttable[num] = *(struct edict_s **)&e = (void*)externs->memalloc(externs->edictsize);
|
||||||
memset(e, 0, externs->edictsize);
|
memset(e, 0, externs->edictsize);
|
||||||
e->fields = PRAddressableExtend(progfuncs, fields_size);
|
e->fields = PRAddressableExtend(progfuncs, NULL, fields_size, 0);
|
||||||
e->entnum = num;
|
e->entnum = num;
|
||||||
QC_ClearEdict(&progfuncs->funcs, (struct edict_s*)e);
|
QC_ClearEdict(&progfuncs->funcs, (struct edict_s*)e);
|
||||||
|
|
||||||
|
@ -2883,13 +2883,11 @@ retry:
|
||||||
}
|
}
|
||||||
|
|
||||||
len=sizeof(char)*pr_progs->numstrings;
|
len=sizeof(char)*pr_progs->numstrings;
|
||||||
s = PRAddressableExtend(progfuncs, len);
|
s = PRAddressableExtend(progfuncs, pr_strings, len, 0);
|
||||||
memcpy(s, pr_strings, len);
|
|
||||||
pr_strings = (char *)s;
|
pr_strings = (char *)s;
|
||||||
|
|
||||||
len=sizeof(float)*pr_progs->numglobals;
|
len=sizeof(float)*pr_progs->numglobals;
|
||||||
s = PRAddressableExtend(progfuncs, len + sizeof(float)*2);
|
s = PRAddressableExtend(progfuncs, pr_globals, len, sizeof(float)*2);
|
||||||
memcpy(s, pr_globals, len);
|
|
||||||
glob = pr_globals = (float *)s;
|
glob = pr_globals = (float *)s;
|
||||||
|
|
||||||
if (progfuncs->funcs.stringtable)
|
if (progfuncs->funcs.stringtable)
|
||||||
|
|
|
@ -224,7 +224,7 @@ extern QCC_opcode_t pr_opcodes[]; // sized by initialization
|
||||||
int PRHunkMark(progfuncs_t *progfuncs);
|
int PRHunkMark(progfuncs_t *progfuncs);
|
||||||
void PRHunkFree(progfuncs_t *progfuncs, int mark);
|
void PRHunkFree(progfuncs_t *progfuncs, int mark);
|
||||||
void *PRHunkAlloc(progfuncs_t *progfuncs, int size, char *name);
|
void *PRHunkAlloc(progfuncs_t *progfuncs, int size, char *name);
|
||||||
void *PRAddressableExtend(progfuncs_t *progfuncs, int ammount);
|
void *PRAddressableExtend(progfuncs_t *progfuncs, void *src, size_t srcsize, int pad);
|
||||||
|
|
||||||
#ifdef printf
|
#ifdef printf
|
||||||
#undef LIKEPRINTF
|
#undef LIKEPRINTF
|
||||||
|
|
|
@ -623,6 +623,7 @@ void PR_Deinit(void)
|
||||||
if (svprogfuncs)
|
if (svprogfuncs)
|
||||||
{
|
{
|
||||||
PR_Common_Shutdown(svprogfuncs, false);
|
PR_Common_Shutdown(svprogfuncs, false);
|
||||||
|
World_Destroy(&sv.world);
|
||||||
if (svprogfuncs->CloseProgs)
|
if (svprogfuncs->CloseProgs)
|
||||||
svprogfuncs->CloseProgs(svprogfuncs);
|
svprogfuncs->CloseProgs(svprogfuncs);
|
||||||
sv.world.progs = NULL;
|
sv.world.progs = NULL;
|
||||||
|
@ -641,8 +642,7 @@ void PR_Deinit(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sv.world.rbe)
|
World_Destroy(&sv.world);
|
||||||
sv.world.rbe->End(&sv.world);
|
|
||||||
|
|
||||||
#ifdef SQL
|
#ifdef SQL
|
||||||
SQL_KillServers();
|
SQL_KillServers();
|
||||||
|
|
|
@ -253,13 +253,20 @@ void SV_Shutdown (void)
|
||||||
|
|
||||||
NET_Shutdown ();
|
NET_Shutdown ();
|
||||||
|
|
||||||
|
Plug_Shutdown(true);
|
||||||
|
Mod_Shutdown(true);
|
||||||
COM_DestroyWorkerThread();
|
COM_DestroyWorkerThread();
|
||||||
|
FS_Shutdown();
|
||||||
|
Plug_Shutdown(false);
|
||||||
|
Cvar_Shutdown();
|
||||||
|
Cmd_Shutdown();
|
||||||
|
|
||||||
#ifdef WEBSERVER
|
#ifdef WEBSERVER
|
||||||
IWebShutdown();
|
IWebShutdown();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
COM_BiDi_Shutdown();
|
COM_BiDi_Shutdown();
|
||||||
|
TL_Shutdown();
|
||||||
Memory_DeInit();
|
Memory_DeInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2097,19 +2097,22 @@ qboolean QDECL World_RegisterPhysicsEngine(const char *enginename, void(QDECL*st
|
||||||
world_current_physics_engine = startupfunc;
|
world_current_physics_engine = startupfunc;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void QDECL World_ShutdownPhysics(world_t *world)
|
static void World_ShutdownPhysics(world_t *world)
|
||||||
{
|
{
|
||||||
unsigned int u;
|
unsigned int u;
|
||||||
wedict_t *ed;
|
wedict_t *ed;
|
||||||
if (!world->rbe)
|
if (!world->rbe)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (world->progs)
|
||||||
|
{
|
||||||
for (u = 0; u < world->num_edicts; u++)
|
for (u = 0; u < world->num_edicts; u++)
|
||||||
{
|
{
|
||||||
ed = WEDICT_NUM(world->progs, u);
|
ed = WEDICT_NUM(world->progs, u);
|
||||||
world->rbe->RemoveJointFromEntity(world, ed);
|
world->rbe->RemoveJointFromEntity(world, ed);
|
||||||
world->rbe->RemoveFromEntity(world, ed);
|
world->rbe->RemoveFromEntity(world, ed);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
world->rbe->End(world);
|
world->rbe->End(world);
|
||||||
}
|
}
|
||||||
void QDECL World_UnregisterPhysicsEngine(const char *enginename)
|
void QDECL World_UnregisterPhysicsEngine(const char *enginename)
|
||||||
|
@ -2136,6 +2139,16 @@ void World_RBE_Start(world_t *world)
|
||||||
world_current_physics_engine(world);
|
world_current_physics_engine(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World_Destroy(world_t *world)
|
||||||
|
{
|
||||||
|
World_ShutdownPhysics(world);
|
||||||
|
|
||||||
|
Z_Free(world->areanodes);
|
||||||
|
world->areanodes = NULL;
|
||||||
|
world->areanodedepth = 0;
|
||||||
|
|
||||||
|
memset(world, 0, sizeof(*world));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USERBE
|
#ifdef USERBE
|
||||||
static qboolean GenerateCollisionMesh_BSP(world_t *world, model_t *mod, wedict_t *ed, vec3_t geomcenter)
|
static qboolean GenerateCollisionMesh_BSP(world_t *world, model_t *mod, wedict_t *ed, vec3_t geomcenter)
|
||||||
|
|
Loading…
Reference in a new issue