mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1076 from acemod/checkfiles
check for outdated pbo files
This commit is contained in:
commit
4dc0b41c4b
@ -64,8 +64,6 @@ if (_currentVersion != _previousVersion) then {
|
|||||||
profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion];
|
profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion];
|
||||||
};
|
};
|
||||||
|
|
||||||
0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber);
|
|
||||||
|
|
||||||
// ACE events
|
// ACE events
|
||||||
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
||||||
"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
||||||
@ -84,6 +82,7 @@ if(!isServer) then {
|
|||||||
["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler);
|
["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler);
|
||||||
[FUNC(syncedEventPFH), 0.5, []] call cba_fnc_addPerFrameHandler;
|
[FUNC(syncedEventPFH), 0.5, []] call cba_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
call FUNC(checkFiles);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
@ -250,14 +249,3 @@ if(isMultiplayer && { time > 0 || isNull player } ) then {
|
|||||||
};
|
};
|
||||||
}, 0, []] call cba_fnc_addPerFrameHandler;
|
}, 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");
|
|
||||||
|
@ -21,6 +21,7 @@ PREP(canInteract);
|
|||||||
PREP(canInteractWith);
|
PREP(canInteractWith);
|
||||||
PREP(canUseWeapon);
|
PREP(canUseWeapon);
|
||||||
PREP(changeProjectileDirection);
|
PREP(changeProjectileDirection);
|
||||||
|
PREP(checkFiles);
|
||||||
PREP(checkPBOs);
|
PREP(checkPBOs);
|
||||||
PREP(claim);
|
PREP(claim);
|
||||||
PREP(closeDialogIfTargetMoves);
|
PREP(closeDialogIfTargetMoves);
|
||||||
|
91
addons/common/functions/fnc_checkFiles.sqf
Normal file
91
addons/common/functions/fnc_checkFiles.sqf
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* 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");
|
||||||
|
|
||||||
|
///////////////
|
||||||
|
// check server version
|
||||||
|
///////////////
|
||||||
|
if (isMultiplayer) then {
|
||||||
|
if (isServer) then {
|
||||||
|
// send servers version of ACE to all clients
|
||||||
|
GVAR(ServerVersion) = _version;
|
||||||
|
publicVariable QGVAR(ServerVersion);
|
||||||
|
} else {
|
||||||
|
// clients have to wait for the variable
|
||||||
|
[{
|
||||||
|
if (isNil QGVAR(ServerVersion)) exitWith {};
|
||||||
|
|
||||||
|
private "_version";
|
||||||
|
_version = _this select 0;
|
||||||
|
|
||||||
|
if (_version != GVAR(ServerVersion)) then {
|
||||||
|
private "_errorMsg";
|
||||||
|
_errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version];
|
||||||
|
|
||||||
|
diag_log text format ["[ACE] ERROR: %1", _errorMsg];
|
||||||
|
|
||||||
|
if (hasInterface) then {diag_log str "1";
|
||||||
|
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||||
|
}, 1, _version] call CBA_fnc_addPerFrameHandler;
|
||||||
|
};
|
||||||
|
};
|
@ -15,6 +15,21 @@
|
|||||||
disableSerialization;
|
disableSerialization;
|
||||||
endLoadingScreen;
|
endLoadingScreen;
|
||||||
|
|
||||||
|
|
||||||
|
// no message without player possible
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
// wait for display
|
||||||
|
if (isNull (call BIS_fnc_displayMission)) exitWith {
|
||||||
|
[{
|
||||||
|
if (isNull (call BIS_fnc_displayMission)) exitWith {};
|
||||||
|
|
||||||
|
(_this select 0) call FUNC(errorMessage);
|
||||||
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||||
|
|
||||||
|
}, 1, _this] call CBA_fnc_addPerFrameHandler;
|
||||||
|
};
|
||||||
|
|
||||||
private ["_textHeader", "_textMessage", "_onOK", "_onCancel"];
|
private ["_textHeader", "_textMessage", "_onOK", "_onCancel"];
|
||||||
|
|
||||||
_textHeader = _this select 0;
|
_textHeader = _this select 0;
|
||||||
|
@ -95,3 +95,7 @@ if (!isServer) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
diag_log text format ["[ACE]: Check-PBOs Module Initialized. Mode: %1.", _mode];
|
diag_log text format ["[ACE]: Check-PBOs Module Initialized. Mode: %1.", _mode];
|
||||||
|
|
||||||
|
if (_checkAll) then {
|
||||||
|
0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber);
|
||||||
|
};
|
||||||
|
@ -1,25 +1,13 @@
|
|||||||
// by commy2
|
// by commy2
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
sleep 1; //wait for module
|
|
||||||
|
|
||||||
_files = [];
|
_files = [];
|
||||||
|
|
||||||
if (missionNamespace getVariable ["ACE_Version_CheckAll", false]) then {
|
{
|
||||||
{
|
if (_x find "a3_" != 0 && {_x find "ace_" != 0} && {!(toLower _x in (missionNamespace getVariable ["ACE_Version_Whitelist", []]))}) then {
|
||||||
if (toLower _x find "a3_" != 0 && {!(toLower _x in (missionNamespace getVariable ["ACE_Version_Whitelist", []]))}) then {
|
|
||||||
_files pushBack _x;
|
_files pushBack _x;
|
||||||
};
|
};
|
||||||
} forEach activatedAddons;
|
} forEach activatedAddons;
|
||||||
} else {
|
|
||||||
{
|
|
||||||
if (toLower _x find "ace_" == 0) then {
|
|
||||||
_files pushBack _x;
|
|
||||||
};
|
|
||||||
} forEach activatedAddons;
|
|
||||||
};
|
|
||||||
|
|
||||||
_versionMain = parseNumber getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
|
|
||||||
|
|
||||||
_versions = [];
|
_versions = [];
|
||||||
{
|
{
|
||||||
@ -27,35 +15,10 @@ _versions = [];
|
|||||||
_versions set [_forEachIndex, _version];
|
_versions set [_forEachIndex, _version];
|
||||||
} forEach _files;
|
} forEach _files;
|
||||||
|
|
||||||
_versionFull = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "versionStr");
|
|
||||||
diag_log text format ["[ACE] Full Version Number: %1", _versionFull];
|
|
||||||
|
|
||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
diag_log text format ["[ACE] Server: ACE_Common is Version %1.", _versionMain];
|
|
||||||
|
|
||||||
{
|
|
||||||
if (toLower _x find "ace_" == 0) then {//
|
|
||||||
_version = _versions select _forEachIndex;
|
|
||||||
if (_version != _versionMain) then {
|
|
||||||
diag_log text format ["[ACE] Server: %1 is Version %2.", _x, _version];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} forEach _files;
|
|
||||||
|
|
||||||
ACE_Version_ServerVersions = [_files, _versions];
|
ACE_Version_ServerVersions = [_files, _versions];
|
||||||
publicVariable "ACE_Version_ServerVersions";
|
publicVariable "ACE_Version_ServerVersions";
|
||||||
} else {
|
} else {
|
||||||
diag_log text format ["[ACE] Client: ACE_Common is Version %1.", _versionMain];
|
|
||||||
|
|
||||||
{
|
|
||||||
if (toLower _x find "ace_" == 0) then {//
|
|
||||||
_version = _versions select _forEachIndex;
|
|
||||||
if (_version != _versionMain) then {
|
|
||||||
diag_log text format ["[ACE] Client: %1 is Version %2.", _x, _version];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} forEach _files;
|
|
||||||
|
|
||||||
ACE_Version_ClientVersions = [_files, _versions];
|
ACE_Version_ClientVersions = [_files, _versions];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ class CfgPatches {
|
|||||||
weapons[] = {};
|
weapons[] = {};
|
||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
requiredAddons[] = {"ace_laser"};
|
requiredAddons[] = {"ace_laser"};
|
||||||
version = VERSION;
|
VERSION_CONFIG;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user