From 9140cccb9fb28a0b7ca0cc8ab232a4bc8642a175 Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 7 Feb 2014 09:36:04 +0000 Subject: [PATCH] Fix a couple of bugs that I didn't catch. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4597 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/fs_zip.c | 4 +++- engine/common/net_wins.c | 17 ++++++++--------- engine/gl/gl_vidsdl.c | 2 +- engine/gl/shader.h | 35 ++++++++++++++++++----------------- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/engine/common/fs_zip.c b/engine/common/fs_zip.c index 52c518a95..aba430775 100644 --- a/engine/common/fs_zip.c +++ b/engine/common/fs_zip.c @@ -761,7 +761,9 @@ struct ziplocalentry #define SIZE_LOCALENTRY 30 #define SIZE_ENDOFCENTRALDIRECTORY 22 -#define SIZE_ZIP64ENDOFCENTRALDIRECTORY 56 +#define SIZE_ZIP64ENDOFCENTRALDIRECTORY_V1 56 +#define SIZE_ZIP64ENDOFCENTRALDIRECTORY_V2 84 +#define SIZE_ZIP64ENDOFCENTRALDIRECTORY SIZE_ZIP64ENDOFCENTRALDIRECTORY_V2 #define SIZE_ZIP64ENDOFCENTRALDIRECTORYLOCATOR 20 //check the local header and determine the place the data actually starts. diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index 7d0342332..209224a04 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -2157,11 +2157,11 @@ int FTENET_GetLocalAddress(int port, qboolean ipx, qboolean ipv4, qboolean ipv6, static struct ifaddrs *iflist; unsigned int iftime; //requery sometimes. -int FTENET_GetLocalAddress(netadr_t *out, int port, int count, qboolean ipx, qboolean ipv4, qboolean ipv6) +int FTENET_GetLocalAddress(int port, qboolean ipx, qboolean ipv4, qboolean ipv6, unsigned int *adrflags, netadr_t *addresses, int maxaddresses) { struct ifaddrs *ifa; int fam; - int idx; + int idx = 0; unsigned int time = Sys_Milliseconds(); if (time - iftime > 1000 && iflist) { @@ -2174,7 +2174,7 @@ int FTENET_GetLocalAddress(netadr_t *out, int port, int count, qboolean ipx, qbo getifaddrs(&iflist); } - for (ifa = iflist; ifa; ifa = ifa->ifa_next) + for (ifa = iflist; ifa && idx < maxaddresses; ifa = ifa->ifa_next) { //can happen if the interface is not bound. if (ifa->ifa_addr == NULL) @@ -2194,17 +2194,16 @@ int FTENET_GetLocalAddress(netadr_t *out, int port, int count, qboolean ipx, qbo #endif 0) { - if (idx++ == count) - { - SockadrToNetadr(&ifa->ifa_addr, out); - out->port = port; - } + SockadrToNetadr(&ifa->ifa_addr, addresses[idx]); + addresses[idx]->port = port; + adrflags[idx] = 0; + idx++; } } return idx; } #else -int FTENET_GetLocalAddress(netadr_t *out, int count) +int FTENET_GetLocalAddress(int port, qboolean ipx, qboolean ipv4, qboolean ipv6, unsigned int *adrflags, netadr_t *addresses, int maxaddresses) { return 0; } diff --git a/engine/gl/gl_vidsdl.c b/engine/gl/gl_vidsdl.c index b9c8c0644..3aeca465e 100644 --- a/engine/gl/gl_vidsdl.c +++ b/engine/gl/gl_vidsdl.c @@ -221,10 +221,10 @@ void GLVID_DeInit (void) SDL_SetWindowGammaRamp(sdlwindow, NULL, NULL, NULL); SDL_GL_DeleteContext(sdlcontext); SDL_DestroyWindow(sdlwindow); + sdlwindow = NULL; #else SDL_SetGammaRamp (intitialgammaramps[0], intitialgammaramps[1], intitialgammaramps[2]); #endif - sdlwindow = NULL; SDL_QuitSubSystem(SDL_INIT_VIDEO); } diff --git a/engine/gl/shader.h b/engine/gl/shader.h index a818fcfe8..8dc93c498 100644 --- a/engine/gl/shader.h +++ b/engine/gl/shader.h @@ -586,6 +586,24 @@ mfog_t *CM_FogForOrigin(vec3_t org); #define BEF_FORCECOLOURMOD 256 //q3 shaders default to 'rgbgen identity', and ignore ent colours. this forces ent colours to be considered #define BEF_LINES 512 //draw line pairs instead of triangles. +typedef struct +{ + int fbo; + int rb_size[2]; + int rb_depth; + int rb_stencil; + int rb_depthstencil; + texid_t colour; + unsigned int enables; +} fbostate_t; +#define FBO_RB_COLOUR 1 +#define FBO_RB_DEPTH 2 +#define FBO_RB_STENCIL 4 +#define FBO_RESET 8 //resize all renderbuffers / free any that are not active. implied if the sizes differ +#define FBO_TEX_COLOUR 16 //internal +#define FBO_TEX_DEPTH 32 //internal +#define FBO_TEX_STENCIL 64 //internal + #ifdef GLQUAKE void GLBE_Init(void); void GLBE_Shutdown(void); @@ -610,23 +628,6 @@ void GLBE_VBO_Data(vbobctx_t *ctx, void *data, unsigned int size, vboarray_t *va void GLBE_VBO_Finish(vbobctx_t *ctx, void *edata, unsigned int esize, vboarray_t *earray); void GLBE_VBO_Destroy(vboarray_t *vearray); -typedef struct -{ - int fbo; - int rb_size[2]; - int rb_depth; - int rb_stencil; - int rb_depthstencil; - texid_t colour; - unsigned int enables; -} fbostate_t; -#define FBO_RB_COLOUR 1 -#define FBO_RB_DEPTH 2 -#define FBO_RB_STENCIL 4 -#define FBO_RESET 8 //resize all renderbuffers / free any that are not active. implied if the sizes differ -#define FBO_TEX_COLOUR 16 //internal -#define FBO_TEX_DEPTH 32 //internal -#define FBO_TEX_STENCIL 64 //internal void GLBE_FBO_Sources(texid_t sourcecolour, texid_t sourcedepth); int GLBE_FBO_Push(fbostate_t *state); void GLBE_FBO_Pop(int oldfbo);