From cf14b6c2417438d1f29a3020a56181fb67547e72 Mon Sep 17 00:00:00 2001 From: LinkIsGrim <69561145+LinkIsGrim@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:57:41 -0300 Subject: [PATCH] Common - Improve file checking error messages --- addons/common/functions/fnc_checkFiles.sqf | 38 +++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf index 185ec7e5d1a..32ef13e73b6 100644 --- a/addons/common/functions/fnc_checkFiles.sqf +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -75,11 +75,18 @@ private _oldCompats = []; if (_oldAddons isNotEqualTo []) then { _oldAddons = _oldAddons apply {format ["%1.pbo", _x]}; + private _extraSources = _oldSources select {_x != _mainSource}; + private _allSources = [_mainSource] + _extraSources; private _errorMsg = if (count _oldAddons > 3) then { - format ["The following files are outdated: %1, and %2 more.
ACE Main version is %3 from %4.
Loaded mods with outdated ACE files: %5", (_oldAddons select [0, 3]) joinString ", ", (count _oldAddons) - 3, _mainVersion, _mainSource, _oldSources joinString ", "]; + format ["The following files are outdated: %1, and %2 more.
ACE Main version is %3 from %4.

All mods with ACE files: %5", (_oldAddons select [0, 3]) joinString ", ", (count _oldAddons) - 3, _mainVersion, _mainSource, _allSources joinString ", "]; } else { - format ["The following files are outdated: %1.
ACE Main version is %2 from %3.
Loaded mods with outdated ACE files: %4", _oldAddons joinString ", ", _mainVersion, _mainSource, _oldSources joinString ", "]; + format ["The following files are outdated: %1.
ACE Main version is %2 from %3.

All mods with ACE files: %4", _oldAddons joinString ", ", _mainVersion, _mainSource, _allSources joinString ", "]; + }; + if (_extraSources isNotEqualTo []) then { + _errorMsg = _errorMsg + "

Reason: Conflicting ACE installations (see list above).

Fix: Make sure to only load one version of ACE."; + } else { + _errorMsg = _errorMsg + "

Reason: Mismatched addon versions within the same installation, it is likely corrupted.

Fix: Repair ACE or update your repack."; }; if (hasInterface) then { @@ -149,7 +156,7 @@ if (isMultiplayer) then { private _fnc_check = { if (GVAR(clientVersion) != GVAR(serverVersion)) then { - private _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2. Server modDir: %3", GVAR(serverVersion), GVAR(clientVersion), GVAR(serverSource)]; + private _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.
Server modDir: %3

Reason: Either client or server is outdated.

Fix: Make sure versions and distribution of both match.", GVAR(serverVersion), GVAR(clientVersion), GVAR(serverSource)]; // Check ACE install call FUNC(checkFiles_diagnoseACE); @@ -164,7 +171,30 @@ if (isMultiplayer) then { private _addons = GVAR(clientAddons) - GVAR(serverAddons); if (_addons isNotEqualTo []) then { - private _errorMsg = format ["Client/Server Addon Mismatch. Client has additional addons: %1. Server modDir: %2", _addons, GVAR(serverSource)]; + private _errorMsg = if (count _addons > 3) then { + format ["Client/Server Addon Mismatch. Client has additional addons: %1, and %2 more.
Server modDir: %3", (_addons select [0, 3]) joinString ", ", (count _addons) - 3, GVAR(serverSource)]; + } else { + format ["Client/Server Addon Mismatch. Client has additional addons: %1.
Server modDir: %2", _addons joinString ", ", GVAR(serverSource)]; + }; + private _additionalCompats = _addons select {(_x select [0, 10]) == "ace_compat"}; + private _additionalComponents = _addons - _additionalCompats; + if (_additionalCompats isNotEqualTo []) then { // CDLC/content mod is loaded when it shouldn't be + private _loadedModsInfo = getLoadedModsInfo; + private _defaultModDirs = [_mainSource] + (_loadedModsInfo select {_x select 2} apply {_x select 1}); + private _additionalMods = []; + { // O(n^fuckyou) loop. If you hit this then you're not going to play anyway. Suffer the stutter. Fix your mods. Stop using HostHavoc. + { + private _sourceModDir = configSourceMod (_cfgPatches >> _x); + if !(_sourceModDir in _defaultModDirs) then { + _additionalMods pushBackUnique (_loadedModsInfo select {_x select 1 == _sourceModDir} select 0 select 0); + }; + } forEach (getArray (_cfgPatches >> _x >> "requiredAddons")); + } forEach _additionalCompats; + _errorMsg = _errorMsg + format ["

Additional compatibility is being loaded for: %1", _additionalMods joinString ", "]; + _errorMsg = _errorMsg + "

Reason: Client has extra mods requiring compats loaded (see list above).

Fix: Make sure your mod list matches. Check your server files if you're the administrator."; + } else { // Different ACE installation + _errorMsg = _errorMsg + "

Reason: Client and Server have different ACE distributions.

Fix: Make sure you're using the same distribution."; + }; // Check ACE install call FUNC(checkFiles_diagnoseACE);