From 771500d9f85ae3e3ac858568cef02753a4b9d6e1 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:21:55 +0100 Subject: [PATCH 01/14] Incorrect surf_styles param size for LightPlane. Most callee's already used MAXCPULIGHTMAPS as size, which the function expects. --- engine/client/render.h | 2 +- engine/gl/gl_heightmap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/client/render.h b/engine/client/render.h index 0ad014001..56b053eed 100644 --- a/engine/client/render.h +++ b/engine/client/render.h @@ -582,7 +582,7 @@ void Mod_SubmodelLoaded(struct model_s *mod, int state); #ifdef RUNTIMELIGHTING struct relight_ctx_s; struct llightinfo_s; -void LightPlane (struct relight_ctx_s *ctx, struct llightinfo_s *threadctx, lightstyleindex_t surf_styles[4], unsigned int *surf_expsamples, qbyte *surf_rgbsamples, qbyte *surf_deluxesamples, vec4_t surf_plane, vec4_t surf_texplanes[2], vec2_t exactmins, vec2_t exactmaxs, int texmins[2], int texsize[2], float lmscale); //special version that doesn't know what a face is or anything. +void LightPlane (struct relight_ctx_s *ctx, struct llightinfo_s *threadctx, lightstyleindex_t surf_styles[MAXCPULIGHTMAPS], unsigned int *surf_expsamples, qbyte *surf_rgbsamples, qbyte *surf_deluxesamples, vec4_t surf_plane, vec4_t surf_texplanes[2], vec2_t exactmins, vec2_t exactmaxs, int texmins[2], int texsize[2], float lmscale); //special version that doesn't know what a face is or anything. struct relight_ctx_s *LightStartup(struct relight_ctx_s *ctx, struct model_s *model, qboolean shadows, qboolean skiplit); void LightReloadEntities(struct relight_ctx_s *ctx, const char *entstring, qboolean ignorestyles); void LightShutdown(struct relight_ctx_s *ctx); diff --git a/engine/gl/gl_heightmap.c b/engine/gl/gl_heightmap.c index a8a41c270..f8d694f31 100644 --- a/engine/gl/gl_heightmap.c +++ b/engine/gl/gl_heightmap.c @@ -5738,7 +5738,7 @@ void Terr_Brush_Draw(heightmap_t *hm, batch_t **batches, entity_t *e) { if (br->faces[j].relight && dorelight) { - lightstyleindex_t styles[4] = {0,INVALID_LIGHTSTYLE,INVALID_LIGHTSTYLE,INVALID_LIGHTSTYLE}; + lightstyleindex_t styles[max(2,MAXCPULIGHTMAPS)] = {0,INVALID_LIGHTSTYLE}; int texsize[2] = {br->faces[j].lmextents[0]-1, br->faces[j].lmextents[1]-1}; vec2_t exactmins, exactmaxs; int m, k; From 9d6f5eb9cbfc71494f0f9df60a5858b5a4becf5f Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:30:43 +0100 Subject: [PATCH 02/14] Missing braces in SSL_LoadPrivateCert. Harmless as the NULL vars were set to NULL again, but ugly. --- engine/common/net_ssl_gnutls.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/engine/common/net_ssl_gnutls.c b/engine/common/net_ssl_gnutls.c index 3382c7fe0..d85e081eb 100644 --- a/engine/common/net_ssl_gnutls.c +++ b/engine/common/net_ssl_gnutls.c @@ -896,8 +896,16 @@ static qboolean SSL_LoadPrivateCert(gnutls_certificate_credentials_t cred) const char *errstr; gnutls_pk_algorithm_t privalgo = GNUTLS_PK_RSA; - if (privf)VFS_CLOSE(privf);privf=NULL; - if (pubf)VFS_CLOSE(pubf);pubf=NULL; + if (privf) + { + VFS_CLOSE(privf); + privf = NULL; + } + if (pubf) + { + VFS_CLOSE(pubf); + pubf = NULL; + } Con_Printf("Generating new GNUTLS key+cert...\n"); From 8813af0e40e36d75e3b25999b2b5b969480d4c2f Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:34:45 +0100 Subject: [PATCH 03/14] Match socket array param size with what's actually used. Harmless as unix sockets (idx 2) aren't accessed, but correct. Also updates IPv4 index access with its enum. --- fteqtv/netchan.c | 4 ++-- fteqtv/qtv.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fteqtv/netchan.c b/fteqtv/netchan.c index e2a649bc1..84487ae12 100644 --- a/fteqtv/netchan.c +++ b/fteqtv/netchan.c @@ -112,7 +112,7 @@ void NET_InitUDPSocket(cluster_t *cluster, int port, int socketid) Sys_Printf(cluster, "opened udp port %i\n", port); } -SOCKET NET_ChooseSocket(SOCKET sock[2], netadr_t *toadr, netadr_t ina) +SOCKET NET_ChooseSocket(SOCKET sock[SOCKETGROUPS], netadr_t *toadr, netadr_t ina) { #ifdef AF_INET6 if (((struct sockaddr *)ina.sockaddr)->sa_family == AF_INET6) @@ -120,7 +120,7 @@ SOCKET NET_ChooseSocket(SOCKET sock[2], netadr_t *toadr, netadr_t ina) *toadr = ina; return sock[SG_IPV6]; } - if (sock[0] == INVALID_SOCKET && sock[SG_IPV6] != INVALID_SOCKET) + if (sock[SG_IPV4] == INVALID_SOCKET && sock[SG_IPV6] != INVALID_SOCKET) { struct sockaddr_in6 *out = (struct sockaddr_in6*)toadr->sockaddr; struct sockaddr_in *in = (struct sockaddr_in*)ina.sockaddr; diff --git a/fteqtv/qtv.h b/fteqtv/qtv.h index 85a9c6061..1bf8b7956 100644 --- a/fteqtv/qtv.h +++ b/fteqtv/qtv.h @@ -947,7 +947,7 @@ void Netchan_OutOfBandPrint (cluster_t *cluster, netadr_t adr, char *format, ... //int Netchan_IsLocal (netadr_t adr); void NET_InitUDPSocket(cluster_t *cluster, int port, int socketid); void NET_SendPacket(cluster_t *cluster, SOCKET sock, int length, void *data, netadr_t adr); -SOCKET NET_ChooseSocket(SOCKET sock[], netadr_t *toadr, netadr_t in); +SOCKET NET_ChooseSocket(SOCKET sock[SOCKETGROUPS], netadr_t *toadr, netadr_t in); qboolean Net_CompareAddress(netadr_t *s1, netadr_t *s2, int qp1, int qp2); qboolean Netchan_Process (netchan_t *chan, netmsg_t *msg); qboolean NQNetchan_Process(cluster_t *cluster, netchan_t *chan, netmsg_t *msg); From 1c80a9f365b50b90102717ad40e8a1e2be53c236 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:37:23 +0100 Subject: [PATCH 04/14] Use sizeof for determining non-null terminated buffer size. --- fteqtv/forward.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fteqtv/forward.c b/fteqtv/forward.c index 676cc47d3..f5e882176 100644 --- a/fteqtv/forward.c +++ b/fteqtv/forward.c @@ -83,7 +83,7 @@ void SV_FindProxies(SOCKET sock, cluster_t *cluster, sv_t *defaultqtv) if (cluster->maxproxies >= 0 && cluster->numproxies >= cluster->maxproxies) { const char buffer[] = {dem_all, 1, 'P','r','o','x','y',' ','i','s',' ','f','u','l','l','.'}; - send(sock, buffer, strlen(buffer), 0); + send(sock, buffer, sizeof(buffer), 0); closesocket(sock); return; } From c9687bfd7bee7e0ad5ccab5914ed110c89435923 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:39:15 +0100 Subject: [PATCH 05/14] Use float[3] for MSG_ReadPos and MSG_WriteDir. vec3_t is not available in header, but float[3] matches better than float*. --- engine/common/common.c | 4 ++-- engine/common/common.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/common/common.c b/engine/common/common.c index cb096efd5..3fa2eb4f1 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -2423,7 +2423,7 @@ float MSG_ReadCoordFloat (void) return MSG_FromCoord(c, COORDTYPE_FLOAT_32); } -void MSG_ReadPos (vec3_t pos) +void MSG_ReadPos (float pos[3]) { pos[0] = MSG_ReadCoord(); pos[1] = MSG_ReadCoord(); @@ -2452,7 +2452,7 @@ void MSG_ReadDir (vec3_t dir) } #endif #if 1//def Q2SERVER -void MSG_WriteDir (sizebuf_t *sb, vec3_t dir) +void MSG_WriteDir (sizebuf_t *sb, float dir[3]) { int i, best; float d, bestd; diff --git a/engine/common/common.h b/engine/common/common.h index 3aa5aae13..12933d2c8 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -340,7 +340,7 @@ void MSG_WriteAngle16 (sizebuf_t *sb, float f); void MSGFTE_WriteDeltaUsercmd (sizebuf_t *buf, const short baseanges[3], const struct usercmd_s *from, const struct usercmd_s *cmd); void MSGQW_WriteDeltaUsercmd (sizebuf_t *sb, const struct usercmd_s *from, const struct usercmd_s *cmd); void MSGCL_WriteDeltaUsercmd (sizebuf_t *sb, const struct usercmd_s *from, const struct usercmd_s *cmd); -void MSG_WriteDir (sizebuf_t *sb, float *dir); +void MSG_WriteDir (sizebuf_t *sb, float dir[3]); extern qboolean msg_badread; // set if a read goes beyond end of message extern struct netprim_s msg_nullnetprim; @@ -371,7 +371,7 @@ char *MSG_ReadStringLine (void); float MSG_ReadCoord (void); float MSG_ReadCoordFloat (void); -void MSG_ReadPos (float *pos); +void MSG_ReadPos (float pos[3]); float MSG_ReadAngle (void); float MSG_ReadAngle16 (void); void MSGQW_ReadDeltaUsercmd (const struct usercmd_s *from, struct usercmd_s *cmd, int qwprotocolver); From a4cc899989ee55503360c0b4c9e99618d5118db3 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:40:06 +0100 Subject: [PATCH 06/14] Move variable decl to top of function as required by compiler flags. --- engine/qclib/qcc_pr_comp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index e196570ec..00e988801 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -2700,7 +2700,7 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_ char typea[256], typeb[256]; QCC_statement_t *statement; QCC_sref_t var_c=nullsref; - + pbool nan_eq_cond, sym_cmp; if (var_a.sym) { @@ -3618,7 +3618,8 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_ // self-comparison that is impacted when NaN // e.g. NaN == NaN, NaN != NaN, [NaN, 0, 0] == [NaN, 0, 0], etc. - pbool nan_eq_cond = false; + nan_eq_cond = false; + switch (op - pr_opcodes) { case OP_STATE: @@ -3840,7 +3841,7 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_ QCC_PR_ParseWarning(WARN_STRICTTYPEMISMATCH, "'%s' type mismatch: %s with %s", op->name, typea, typeb); } - pbool sym_cmp = !nan_eq_cond && var_a.sym == var_b.sym && var_a.ofs == var_b.ofs; + sym_cmp = !nan_eq_cond && var_a.sym == var_b.sym && var_a.ofs == var_b.ofs; if ((var_a.sym->constant && var_b.sym->constant && !var_a.sym->temp && !var_b.sym->temp) || sym_cmp) { From c95a739208ed0a23f32e7bd0c3a7ffecd2c54c53 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:43:03 +0100 Subject: [PATCH 07/14] Match Master_SetSortField decl with its implementation. Second parameter is a bit field, not a boolean. --- engine/client/cl_master.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/client/cl_master.h b/engine/client/cl_master.h index 67d6f2023..17d9a35e1 100644 --- a/engine/client/cl_master.h +++ b/engine/client/cl_master.h @@ -244,7 +244,7 @@ float Master_ReadKeyFloat(serverinfo_t *server, unsigned int keynum); char *Master_ReadKeyString(serverinfo_t *server, unsigned int keynum); int Master_SortServers(void); -void Master_SetSortField(hostcachekey_t field, qboolean descending); +void Master_SetSortField(hostcachekey_t field, unsigned int sortflags); hostcachekey_t Master_GetSortField(void); qboolean Master_GetSortDescending(void); From 21d3080fbea21753ec6e3b10b5c671a0a5fe2ca5 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:48:42 +0100 Subject: [PATCH 08/14] Avoid dangling &m pointer warning in BE_GenTempMeshVBO. meshes and meshcount are always updated after the function call, so the assignments had no effect. Also make the function void as it always returns true. --- engine/gl/gl_backend.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index 08b016ba7..c48101417 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -2289,7 +2289,7 @@ static void colourgen(const shaderpass_t *pass, int cnt, vec4_t *src, vec4_t *ds } #endif -static qboolean BE_GenTempMeshVBO(vbo_t **vbo, mesh_t *m); +static void BE_GenTempMeshVBO(vbo_t **vbo, mesh_t *m); static void DeformGen_Text(int stringid, int cnt, vecV_t *src, vecV_t *dst, const mesh_t *mesh) { #define maxlen 32 @@ -2361,8 +2361,8 @@ static void DeformGen_Text(int stringid, int cnt, vecV_t *src, vecV_t *dst, cons textmesh.numindexes = i*6; textmesh.numvertexes = i*4; - if (!BE_GenTempMeshVBO(&shaderstate.sourcevbo, &textmesh)) - return; + BE_GenTempMeshVBO(&shaderstate.sourcevbo, &textmesh); + shaderstate.meshcount = 1; shaderstate.meshes = &meshptr; #undef maxlen @@ -4908,7 +4908,7 @@ static void DrawMeshes(void) } } -static qboolean BE_GenTempMeshVBO(vbo_t **vbo, mesh_t *m) +static void BE_GenTempMeshVBO(vbo_t **vbo, mesh_t *m) { *vbo = &shaderstate.dummyvbo; @@ -5093,10 +5093,6 @@ static qboolean BE_GenTempMeshVBO(vbo_t **vbo, mesh_t *m) } shaderstate.dummyvbo.bones = m->bones; shaderstate.dummyvbo.numbones = m->numbones; - shaderstate.meshcount = 1; - shaderstate.meshes = &m; - - return true; } void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_t *vbo, texnums_t *texnums, unsigned int beflags) @@ -5123,8 +5119,7 @@ void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_ { m = *meshlist++; - if (!BE_GenTempMeshVBO(&shaderstate.sourcevbo, m)) - continue; + BE_GenTempMeshVBO(&shaderstate.sourcevbo, m); shaderstate.meshcount = 1; shaderstate.meshes = &m; @@ -5172,8 +5167,7 @@ void GLBE_SubmitBatch(batch_t *batch) else { //we're only allowed one mesh per batch if there's no vbo info. - if (!BE_GenTempMeshVBO(&shaderstate.sourcevbo, batch->mesh[0])) - return; + BE_GenTempMeshVBO(&shaderstate.sourcevbo, batch->mesh[0]); } sh = batch->shader; From c7eb4fb3b01741d8192aeb091d03c68a424dee53 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:51:51 +0100 Subject: [PATCH 09/14] keydown is a bitmask, not a qboolean. --- engine/client/cl_plugin.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/client/cl_plugin.inc b/engine/client/cl_plugin.inc index 64fc4fc26..afa9cb04e 100644 --- a/engine/client/cl_plugin.inc +++ b/engine/client/cl_plugin.inc @@ -105,7 +105,7 @@ static unsigned int IN_GetKeyDest(void) qboolean QDECL Plug_Input_IsKeyDown(int key) { - extern qboolean keydown[K_MAX]; + extern unsigned int keydown[K_MAX]; if (key >= 0 && key < K_MAX) return !!keydown[key]; return false; From bdb5df93a9dc3c7ea23072700143f2471d24db23 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:52:19 +0100 Subject: [PATCH 10/14] No need to NULL check statically declared array entries. --- engine/client/keys.c | 3 +-- engine/client/pr_csqc.c | 2 +- engine/client/sbar.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engine/client/keys.c b/engine/client/keys.c index 180a32aff..a2840a77f 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -2553,8 +2553,7 @@ void Key_Unbindall_f (void) int i; for (i=0 ; i Date: Fri, 22 Dec 2023 10:56:58 +0100 Subject: [PATCH 11/14] Pass origin point to CM_BoxLeafnums. Used to pass uninitialized mins and maxs. Renames p to point for readability. --- engine/common/gl_q2bsp.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 2401e8bdc..412e34411 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -60,7 +60,7 @@ extern void BuildLightMapGammaTable (float g, float c); #if defined(Q2BSPS) || defined(Q3BSPS) static qboolean CM_NativeTrace(model_t *model, int forcehullnum, const framestate_t *framestate, const vec3_t axis[3], const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, qboolean capsule, unsigned int contents, trace_t *trace); -static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, const framestate_t *framestate, const vec3_t axis[3], const vec3_t p, const vec3_t mins, const vec3_t maxs); +static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, const framestate_t *framestate, const vec3_t axis[3], const vec3_t point, const vec3_t mins, const vec3_t maxs); static unsigned int Q2BSP_PointContents(model_t *mod, const vec3_t axis[3], const vec3_t p); static int CM_PointCluster (model_t *mod, const vec3_t p, int *area); static void CM_InfoForPoint (struct model_s *mod, vec3_t pos, int *area, int *cluster, unsigned int *contentbits); @@ -5504,12 +5504,12 @@ static int CM_PointContents (model_t *mod, const vec3_t p) return contents; } -static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, const framestate_t *framestate, const vec3_t axis[3], const vec3_t p, const vec3_t mins, const vec3_t maxs) +static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, const framestate_t *framestate, const vec3_t axis[3], const vec3_t point, const vec3_t mins, const vec3_t maxs) { cminfo_t *prv = (cminfo_t*)model->meshinfo; int contents; if (!DotProduct(mins, mins) && !DotProduct(maxs, maxs)) - return CM_PointContents(model, p); + return CM_PointContents(model, point); if (!model) // map not loaded return 0; @@ -5520,11 +5520,10 @@ static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, c mleaf_t *leaf; q2cbrush_t *brush; q2cbrushside_t *brushside; - vec3_t absmin, absmax; int leaflist[64]; - k = CM_BoxLeafnums (model, absmin, absmax, leaflist, 64, NULL); + k = CM_BoxLeafnums (model, point, point, leaflist, 64, NULL); contents = 0; for (k--; k >= 0; k--) @@ -5544,7 +5543,7 @@ static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, c brushside = brush->brushside; for ( j = 0; j < brush->numsides; j++, brushside++ ) { - if ( PlaneDiff (p, brushside->plane) > 0 ) + if (PlaneDiff (point, brushside->plane) > 0 ) break; } From 317ca00298255f1e92f03ee3b3e83e78076cf6f3 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:58:37 +0100 Subject: [PATCH 12/14] Use snprintf and a larger buffer for file size. In practice it would likely never overflow, but if you happen to have an implausible large demo in folder it could. --- fteqtv/qw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fteqtv/qw.c b/fteqtv/qw.c index c3799f480..4c761041e 100644 --- a/fteqtv/qw.c +++ b/fteqtv/qw.c @@ -2728,7 +2728,7 @@ I've removed the following from this function as it covered the menu (~Moodles): else if (!strcmp(command, "guidemos")) { int maxshowndemos; - char sizestr[7]; + char sizestr[11]; int start; int i; @@ -2776,13 +2776,13 @@ I've removed the following from this function as it covered the menu (~Moodles): if (i >= cluster->availdemoscount) break; if (cluster->availdemos[i].size < 1024) - sprintf(sizestr, "%4ib", cluster->availdemos[i].size); + snprintf(sizestr, sizeof(sizestr), "%4ib", cluster->availdemos[i].size); else if (cluster->availdemos[i].size < 1024*1024) - sprintf(sizestr, "%4ikb", cluster->availdemos[i].size/1024); + snprintf(sizestr, sizeof(sizestr), "%4ikb", cluster->availdemos[i].size/1024); else if (cluster->availdemos[i].size < 1024*1024*1024) - sprintf(sizestr, "%4imb", cluster->availdemos[i].size/(1024*1024)); + snprintf(sizestr, sizeof(sizestr), "%4imb", cluster->availdemos[i].size/(1024*1024)); else// if (cluster->availdemos[i].size < 1024*1024*1024*1024) - sprintf(sizestr, "%4igb", cluster->availdemos[i].size/(1024*1024*1024)); + snprintf(sizestr, sizeof(sizestr), "%4igb", cluster->availdemos[i].size/(1024*1024*1024)); // else // *sizestr = 0; QW_StuffcmdToViewer(v, "menutext 32 %i \"%6s %-30s\" \"demo %s\"\n", (i-start)*8 + 52+16, sizestr, cluster->availdemos[i].name, cluster->availdemos[i].name); From ab1e8d321a179bfb97801d900be69b5dc5762267 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 11:02:03 +0100 Subject: [PATCH 13/14] Fix indentation in ezhud to avoid confusing the compiler. --- plugins/ezhud/hud_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/ezhud/hud_common.c b/plugins/ezhud/hud_common.c index 589f987f6..875e70e78 100644 --- a/plugins/ezhud/hud_common.c +++ b/plugins/ezhud/hud_common.c @@ -7969,8 +7969,8 @@ static void SCR_HUD_DrawNotImplemented(hud_t *hud) width = 8 * strlen(line1); height = 8; - if (!HUD_PrepareDraw(hud, width, height, &x, &y)) - return; + if (!HUD_PrepareDraw(hud, width, height, &x, &y)) + return; Draw_SString(x, y, line1, 1); } From 3b6cd9aac08f1e7588f208cb5ce98c55bc5a669e Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Sun, 24 Dec 2023 15:30:17 +0100 Subject: [PATCH 14/14] Add GitHub Actions workflow. --- .github/workflows/main.yml | 98 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..537519acf --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,98 @@ +name: main + +on: [ push, pull_request, workflow_dispatch ] + +jobs: + cmake: + strategy: + matrix: + os: [ ubuntu-latest ] + profile: [ "Debug", "Release" ] + + runs-on: ${{ matrix.os }} + + steps: + - name: Get number of CPU cores + uses: SimenB/github-actions-cpu-cores@v1 + id: cpu-cores + + - uses: actions/checkout@v4 + + - name: "Install Dependencies" + run: | + sudo apt-get -qq update + sudo apt-get -qq install --no-install-recommends \ + gettext \ + libasound2-dev \ + libbullet-dev \ + libgnutls28-dev \ + libopenxr-dev \ + libqscintilla2-qt5-dev \ + libsdl2-dev \ + libvorbis-dev \ + libvulkan-dev \ + libwayland-dev \ + libxcursor-dev \ + libxkbcommon-dev \ + libxrandr-dev \ + qtbase5-dev + + # Disabled due to warnings that break the debug build with -Werror + # libode-dev + # libavcodec-dev libavformat-dev libavutil-dev libswscale-dev + + - name: "Configure: ${{ matrix.profile }}" + run: | + cmake -B build_${{ matrix.profile }} -DCMAKE_BUILD_TYPE=${{ matrix.profile }} + + - name: "Build: ${{ matrix.profile }}" + run: | + cmake --build build_${{ matrix.profile }} --parallel ${{ steps.cpu-cores.outputs.count }} + + wasm: + strategy: + # Concurrent builds currently broken: + # https://github.com/mymindstorm/setup-emsdk/issues/20 + matrix: + emsdk: [ "2.0.12" ] #, "3.1.8", "3.1.51" ] + profile: [ "rel" ] #, "dbg" ] + + runs-on: ubuntu-latest + + steps: + - name: Get number of CPU cores + uses: SimenB/github-actions-cpu-cores@v1 + id: cpu-cores + + - uses: actions/checkout@v4 + + - uses: mymindstorm/setup-emsdk@v13 + with: + version: ${{ matrix.emsdk }} + actions-cache-folder: "emsdk-cache-${{ matrix.emsdk }}" + + - name: Verify emscripten + run: emcc -v + + - name: Build dependencies + working-directory: engine + run: | + make -j ${{ steps.cpu-cores.outputs.count }} makelibs FTE_TARGET=web + + - name: Build wasm + working-directory: engine + run: | + # Currently fails to build + sed -r -i '/define Q3(CLIENT|SERVER)/d' common/config_fteqw.h + + make -j ${{ steps.cpu-cores.outputs.count }} FTE_TARGET=web web-${{ matrix.profile }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: fteqw-web-${{ matrix.profile }}-em${{ matrix.emsdk }} + path: | + engine/*/ftewebgl.js + engine/*/ftewebgl.html + engine/*/ftewebgl.wasm + compression-level: 9