diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 53de6b5d69..1c9155b3a2 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -84,6 +84,7 @@ if(!isServer) then { ["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler); [FUNC(syncedEventPFH), 0.5, []] call cba_fnc_addPerFrameHandler; +call FUNC(checkFiles); /***************************************************************/ /***************************************************************/ @@ -250,14 +251,3 @@ if(isMultiplayer && { time > 0 || isNull player } ) then { }; }, 0, []] call cba_fnc_addPerFrameHandler; }; - -// check dlls -{ - if (_x callExtension "version" == "") then { - private "_errorMsg"; - _errorMsg = format ["Extension %1.dll not installed.", _x]; - - diag_log text format ["[ACE] ERROR: %1", _errorMsg]; - ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); - }; -} forEach getArray (configFile >> "ACE_Extensions" >> "extensions"); diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 54a5118cb0..5c2ad1e592 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -21,6 +21,7 @@ PREP(canInteract); PREP(canInteractWith); PREP(canUseWeapon); PREP(changeProjectileDirection); +PREP(checkFiles); PREP(checkPBOs); PREP(claim); PREP(closeDialogIfTargetMoves); diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf new file mode 100644 index 0000000000..868882151d --- /dev/null +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -0,0 +1,59 @@ +/* + * Author: commy2 + * + * Compares version numbers of PBOs and DLLs. + * + * Argument: + * 0: Mode (Number) + * + * Return value: + * None. + */ +#include "script_component.hpp" + +/////////////// +// check addons +/////////////// +private "_version"; +_version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); + +diag_log text format ["[ACE]: ACE is version %1", _version]; /////////////////////////////////////////////////////////////////////////// + +private ["_addons", "_index"]; + +_addons = activatedAddons; + +// speed up search. all ace pbos are loaded after ace_main. +_index = _addons find "ace_main"; +reverse _addons; +_addons resize (count _addons - _index); +_addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); + +{ + if (getText (configFile >> "CfgPatches" >> _x >> "versionStr") != _version) then { + private "_errorMsg"; + _errorMsg = format ["File %1.pbo is outdated.", _x]; + + diag_log text format ["[ACE] ERROR: %1", _errorMsg]; + + if (hasInterface) then { + ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); + }; + }; +} forEach _addons; + +/////////////// +// check dlls +/////////////// +{ + if (_x callExtension "version" == "") then { + private "_errorMsg"; + _errorMsg = format ["Extension %1.dll not installed.", _x]; + + diag_log text format ["[ACE] ERROR: %1", _errorMsg]; + + if (hasInterface) then { + ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); + }; + }; +} forEach getArray (configFile >> "ACE_Extensions" >> "extensions");