From 2d3b03ac4803c3c4a0bbfc55aa9a882a9e1f29f9 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 16 Jul 2016 13:21:23 +0000 Subject: [PATCH] adhere to filesystem priorities as specified by fmf files, and obey the order from pak.lst even when file extensions differ. try to fix nacl builds. added a 'mapper' positive penalty instead of using vip (which might be dangerous if modders are not aware of it). fix menu.dat's graphics presets not loading configs properly. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5002 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/sys_win.c | 2 +- engine/common/fs.c | 137 ++++++++++++++++++++------------- engine/common/net_wins.c | 6 +- engine/gl/gl_heightmap.c | 8 +- engine/server/server.h | 5 +- engine/server/sv_ccmds.c | 1 + engine/server/sv_user.c | 5 ++ quakec/menusys/menu/presets.qc | 2 +- 8 files changed, 102 insertions(+), 64 deletions(-) diff --git a/engine/client/sys_win.c b/engine/client/sys_win.c index 44426ed8c..7ad88d89e 100644 --- a/engine/client/sys_win.c +++ b/engine/client/sys_win.c @@ -3014,7 +3014,7 @@ typedef struct qIApplicationAssociationRegistrationUI } *lpVtbl; } qIApplicationAssociationRegistrationUI; -void Sys_DoFileAssociations(qboolean elevated) +void Sys_DoFileAssociations(int elevated) { char command[1024]; qboolean ok = true; diff --git a/engine/common/fs.c b/engine/common/fs.c index 53580361e..8499b3364 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -2266,27 +2266,32 @@ static void FS_AddManifestPackages(searchpath_t **oldpaths, const char *purepath if (!oldp) { handle = FS_GetOldPath(oldpaths, lname2, &keptflags); - if (!handle) - handle = FS_GetOldPath(oldpaths, lname, &keptflags); - if (!handle) + if (handle) + snprintf (lname, sizeof(lname), "%s", lname2); + else { - vfs = NULL; - if (search) - { - if (search->handle->FindFile(search->handle, &loc, pname+ptlen+1, NULL)) - vfs = search->handle->OpenVFS(search->handle, &loc, "r"); - } - else - { - vfs = FS_OpenVFS(fs_manifest->package[i].path, "rb", FS_ROOT); - if (vfs) - snprintf (lname, sizeof(lname), "%s", lname2); - else - vfs = FS_OpenVFS(pname, "rb", FS_ROOT); - } + handle = FS_GetOldPath(oldpaths, lname, &keptflags); - if (vfs) - handle = OpenNew (vfs, lname, fs_manifest->package[i].prefix?fs_manifest->package[i].prefix:""); + if (!handle) + { + vfs = NULL; + if (search) + { + if (search->handle->FindFile(search->handle, &loc, pname+ptlen+1, NULL)) + vfs = search->handle->OpenVFS(search->handle, &loc, "r"); + } + else + { + vfs = FS_OpenVFS(fs_manifest->package[i].path, "rb", FS_ROOT); + if (vfs) + snprintf (lname, sizeof(lname), "%s", lname2); + else + vfs = FS_OpenVFS(pname, "rb", FS_ROOT); + } + + if (vfs) + handle = OpenNew (vfs, lname, fs_manifest->package[i].prefix?fs_manifest->package[i].prefix:""); + } } if (handle && fs_manifest->package[i].crcknown) { @@ -2326,6 +2331,7 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const { //search is the parent int i, j; + searchpath_t *existing; searchpathfuncs_t *handle; char pakfile[MAX_OSPATH]; char logicalpaths[MAX_OSPATH]; //with a slash @@ -2342,40 +2348,6 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const wp.oldpaths = oldpaths; wp.inheritflags = pflags; - for (j = 0; j < sizeof(searchpathformats)/sizeof(searchpathformats[0]); j++) - { - if (!searchpathformats[j].extension || !searchpathformats[j].OpenNew || !searchpathformats[j].loadscan) - continue; - if (loadstuff & (1<handle->FindFile(search->handle, &loc, pakfile, NULL)) - break; //not found.. - - snprintf (pakfile, sizeof(pakfile), "%spak%i.%s", logicalpaths, i, extension); - snprintf (purefile, sizeof(purefile), "%s/pak%i.%s", purepath, i, extension); - - handle = FS_GetOldPath(oldpaths, pakfile, &keptflags); - if (!handle) - { - vfs = search->handle->OpenVFS(search->handle, &loc, "r"); - if (!vfs) - break; - handle = searchpathformats[j].OpenNew (vfs, pakfile, ""); - if (!handle) - break; - } - FS_AddPathHandle(oldpaths, purefile, pakfile, handle, "", SPF_COPYPROTECTED|pflags|keptflags, (unsigned int)-1); - } - } - } - //read pak.lst to get some sort of official ordering of pak files if (search->handle->FindFile(search->handle, &loc, "pak.lst", NULL) == FF_FOUND) { @@ -2413,6 +2385,62 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const BZ_Free(buffer); } + for (j = 0; j < sizeof(searchpathformats)/sizeof(searchpathformats[0]); j++) + { + if (!searchpathformats[j].extension || !searchpathformats[j].OpenNew || !searchpathformats[j].loadscan) + continue; + if (loadstuff & (1<handle->FindFile(search->handle, &loc, pakfile, NULL)) + break; //not found.. + + snprintf (pakfile, sizeof(pakfile), "%spak%i.%s", logicalpaths, i, extension); + snprintf (purefile, sizeof(purefile), "%s/pak%i.%s", purepath, i, extension); + + for (existing = com_searchpaths; existing; existing = existing->next) + { + if (!Q_strcasecmp(existing->logicalpath, pakfile)) //assumption: first member of structure is a char array + break; //already loaded (base paths?) + } + if (!existing) + { + handle = FS_GetOldPath(oldpaths, pakfile, &keptflags); + if (!handle) + { + vfs = search->handle->OpenVFS(search->handle, &loc, "r"); + if (!vfs) + break; + handle = searchpathformats[j].OpenNew (vfs, pakfile, ""); + if (!handle) + break; + } + FS_AddPathHandle(oldpaths, purefile, pakfile, handle, "", SPF_COPYPROTECTED|pflags|keptflags, (unsigned int)-1); + } + } + } + } + + //now load ones from the manifest + for (j = 0; j < sizeof(searchpathformats)/sizeof(searchpathformats[0]); j++) + { + if (!searchpathformats[j].extension || !searchpathformats[j].OpenNew || !searchpathformats[j].loadscan) + continue; + if (loadstuff & (1<handle->EnumerateFiles(search->handle, pakfile, FS_AddWildDataFiles, &wp); - - FS_AddManifestPackages(oldpaths, purepath, logicalpaths, search, extension, wp.OpenNew); } } } diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index 5fd11a9f3..48a2a0eff 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -4841,19 +4841,17 @@ static neterr_t FTENET_NaClWebSocket_SendPacket(ftenet_generic_connection_t *gco } /*nacl websockets implementation...*/ -static ftenet_generic_connection_t *FTENET_WebSocket_EstablishConnection(qboolean isserver, const char *address) +static ftenet_generic_connection_t *FTENET_WebSocket_EstablishConnection(qboolean isserver, const char *address, netadr_t adr) { ftenet_websocket_connection_t *newcon; - netadr_t adr; PP_Resource newsocket; if (isserver || !ppb_websocket_interface) { return NULL; } - if (!NET_StringToAdr(address, 80, &adr)) - return NULL; //couldn't resolve the name + newcon = Z_Malloc(sizeof(*newcon)); if (newcon) { diff --git a/engine/gl/gl_heightmap.c b/engine/gl/gl_heightmap.c index e84375b09..315333cea 100644 --- a/engine/gl/gl_heightmap.c +++ b/engine/gl/gl_heightmap.c @@ -6145,7 +6145,7 @@ qboolean SV_Prespawn_Brushes(sizebuf_t *msg, unsigned int *modelindex, unsigned } qboolean SV_Parse_BrushEdit(void) { - qboolean authorise = SV_MayCheat() || (host_client->penalties & BAN_VIP); + qboolean authorise = (host_client->penalties & BAN_MAPPER) || (host_client->netchan.remote_address.type == NA_LOOPBACK); unsigned int modelindex = MSG_ReadShort(); int cmd = MSG_ReadByte(); model_t *mod = (modelindexprespawn_stage++; client->prespawn_idx = 0; + client->prespawn_idx2 = 0; break; } client->prespawn_idx++; @@ -1530,6 +1531,8 @@ void SV_SendClientPrespawnInfo(client_t *client) ClientReliableWrite_String(client, cmd); } client->prespawn_stage++; + client->prespawn_idx = 0; + client->prespawn_idx2 = 0; } //this is extra stuff that will happen after we're on the server @@ -1538,7 +1541,9 @@ void SV_SendClientPrespawnInfo(client_t *client) { //when brush editing, connecting clients need a copy of all the brushes. while (client->netchan.message.cursize < maxsize) { +#ifdef TERRAIN if (!SV_Prespawn_Brushes(&client->netchan.message, &client->prespawn_idx, &client->prespawn_idx2)) +#endif { client->prespawn_stage++; client->prespawn_idx = 0; diff --git a/quakec/menusys/menu/presets.qc b/quakec/menusys/menu/presets.qc index 7d287a6fd..601bd97d8 100644 --- a/quakec/menusys/menu/presets.qc +++ b/quakec/menusys/menu/presets.qc @@ -71,7 +71,7 @@ nonstatic void(mitem_desktop desktop) M_Preset = string fname = search_getfilename(fs, i); string iname = substring(fname, 15, -5); string dname = GetFirstLineComment(fname, iname); - iname = sprintf("exec \"%s\";vid_reload", iname); + iname = sprintf("exec \"configs/preset_%s.cfg\";vid_reload", iname); if (dname && !fr.findchildcmd(iname)) { fr.add(spawn(mitem_text, item_text:dname, item_command:iname, item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, y], '100 16');