From 377361b5e6b50a8be034bc6b3c47b1f054873311 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Fri, 19 May 2023 19:55:16 +1000 Subject: [PATCH] Change update logic from missing-file-specific to version-specific --- qcsrc/common/mapinfo.qc | 2 +- qcsrc/menu/xonotic/util.qc | 22 ++++++++++++++++------ xonotic-client.cfg | 2 -- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index c2b157295..04c74d498 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -935,7 +935,7 @@ bool _MapInfo_ParseArena(string arena_filename, int fh, string pFilename, Gamety return false; } -#if defined(CSQC) || defined(MENUQC) +#if defined(CSQC) string(string filename) whichpack = #503; #endif string _MapInfo_CheckArenaFile(string pFilename, string pMapname) diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 86b0f5e87..2ddfd54e1 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -393,10 +393,11 @@ void UpdateNotification_URI_Get_Callback(float id, float status, string data) APPEND_TO_STRING(un_bannedservers, " ", s); break; } - case "E": + case "H": { - if(cvar("menu_updatecheck_getpacks")) - APPEND_TO_STRING(un_emergency_pk3s, " ", s); + // Hotfix (version-specific pk3 supported in >= 0.8.6) + // replaces "E" (missing-file-specific pk3 supported in <= 0.8.5) + APPEND_TO_STRING(un_emergency_pk3s, " ", s); break; } case "P": @@ -452,6 +453,7 @@ void UpdateNotification_URI_Get_Callback(float id, float status, string data) // END OF URI SYSTEM //////////////////////////////////////////////////////// +string(string filename) whichpack = #503; void updateCheck() { if(!_Nex_ExtResponseSystem_Queried) @@ -469,8 +471,16 @@ void updateCheck() allgood = true; for(i = 0; i+1 < n; i += 2) { - if(fexists(argv(i+1))) + if(strcmp(argv(i+1), cvar_string("g_xonoticversion"))) // these aren't the versions we're looking for continue; + string packfn = whichpack("hotfix-autoexec.cfg"); + if(packfn) // we have the cfg we're looking for in some pk3 + { + if(!strncmp(packfn, "dlcache/", 8)) // it's in dlcache + packfn = substring(packfn, 8, strlen(packfn)); // strip prefix "dlcache/" + if(strstrofs(argv(i), packfn, strlen(argv(i)) - strlen(packfn)) > 0) // last chars of url == packfn + continue; // the pk3 we're looking for already provides the cfg we're looking for + } allgood = false; if(_Nex_ExtResponseSystem_PacksStep == 1) // first run localcmd("\ncurl --pak \"", argv(i), "\"\n"); @@ -482,14 +492,14 @@ void updateCheck() if(!Menu_Active) cvar_set("_menu_initialized", "0"); // HACK: cause m_hide call on next start - localcmd("\nmenu_restart\n"); + //localcmd("\nmenu_restart\n"); // <= 0.8.5 + localcmd("\nexec hotfix-autoexec.cfg\n"); } _Nex_ExtResponseSystem_PacksStep = 0; } else _Nex_ExtResponseSystem_PacksStep = 2; } - } float preMenuInit() diff --git a/xonotic-client.cfg b/xonotic-client.cfg index add42efd3..b434fdafa 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -731,8 +731,6 @@ set cl_effects_lightningarc_drift_end 0.1 set cl_effects_lightningarc_branchfactor_start 0.25 set cl_effects_lightningarc_branchfactor_add 0.1 -set menu_updatecheck_getpacks 1 "get update packs from update server" - seta cl_loddistance1 1024 seta cl_loddistance2 3072 seta cl_playerdetailreduction 4 "the higher, the less detailed player models are displayed (LOD)" -- 2.39.2