]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Change update logic from missing-file-specific to version-specific
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 19 May 2023 09:55:16 +0000 (19:55 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 19 May 2023 09:55:16 +0000 (19:55 +1000)
qcsrc/common/mapinfo.qc
qcsrc/menu/xonotic/util.qc
xonotic-client.cfg

index c2b15729578d9353e82cd822b7005db7ebd4da1e..04c74d498b72d6128f9c8b5710d4889bc513c10f 100644 (file)
@@ -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)
index 86b0f5e87eb5feec570ee155f8fcacfd12a139de..2ddfd54e19a4ecaafd3120c4802e4117697e9685 100644 (file)
@@ -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()
index add42efd325acc0eca59a8606dbbc9b027c42305..b434fdafa68e4da629048a3955f1b0e962a3e9be 100644 (file)
@@ -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)"