Skip to content
6 changes: 5 additions & 1 deletion addons/common/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ call COMPILE_FILE(init_perFrameHandler);
call COMPILE_FILE(init_delayLess);

// Due to activateAddons being overwritten by eachother (only the last executed command will be active), we apply this bandaid
private _addons = ("true" configClasses (configFile >> "CfgPatches")) apply {configName _x};
#ifndef LINUX_BUILD
private _addons = ("true" configClasses (configFile >> "CfgPatches")) apply {configName _x};
#else
private _addons = ["true" configClasses (configFile >> "CfgPatches"), {configName _x}] call CBA_fnc_filter;
#endif

activateAddons _addons;
GVAR(addons) = _addons;
Expand Down
2 changes: 2 additions & 0 deletions addons/common/XEH_preInit_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "XEH_preInit.sqf"
2 changes: 2 additions & 0 deletions addons/common/fnc_addBinocularMagazine_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// not implemented for 1.54
nil
6 changes: 5 additions & 1 deletion addons/common/fnc_dropMagazine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ params [["_unit", objNull, [objNull]], ["_item", "", [""]], ["_ammo", -1, [0]]];

// random mag mode
if (_ammo < 0) then {
_ammo = ((magazinesAmmoFull _unit select {_x select 0 == _item && {toLower (_x select 4) in ["uniform","vest","backpack"]}}) call BIS_fnc_selectRandom) param [1, "null"];
#ifndef LINUX_BUILD
_ammo = ((magazinesAmmoFull _unit select {_x select 0 == _item && {toLower (_x select 4) in ["uniform","vest","backpack"]}}) call BIS_fnc_selectRandom) param [1, "null"];
#else
_ammo = (([magazinesAmmoFull _unit, {_x select 0 == _item && {toLower (_x select 4) in ["uniform","vest","backpack"]}}] call BIS_fnc_conditionalSelect) call BIS_fnc_selectRandom) param [1, "null"];
#endif
};

// no mag of this type in units inventory
Expand Down
2 changes: 2 additions & 0 deletions addons/common/fnc_dropMagazine_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_dropMagazine.sqf"
6 changes: 5 additions & 1 deletion addons/common/fnc_dropWeapon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ SCRIPT(dropWeapon);

params [["_unit", objNull, [objNull]], ["_item", "", [""]]];

private _weaponInfo = (weaponsItems _unit select {_x select 0 == _item}) param [0, []];
#ifndef LINUX_BUILD
private _weaponInfo = (weaponsItems _unit select {_x select 0 == _item}) param [0, []];
#else
private _weaponInfo = ([weaponsItems _unit, {_x select 0 == _item}] call BIS_fnc_conditionalSelect) param [0, []];
#endif
private _return = [_unit, _item] call CBA_fnc_removeWeapon;

if (_return) then {
Expand Down
2 changes: 2 additions & 0 deletions addons/common/fnc_dropWeapon_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_dropWeapon.sqf"
6 changes: 5 additions & 1 deletion addons/common/fnc_getAlive.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ if (_entities isEqualType grpNull) then {
_entities = units _entities;
};

_entities select {alive _x} // return
#ifndef LINUX_BUILD
_entities select {alive _x} // return
#else
[_entities, {alive _x}] call BIS_fnc_conditionalSelect // return
#endif
2 changes: 2 additions & 0 deletions addons/common/fnc_getAlive_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_getAlive.sqf"
12 changes: 11 additions & 1 deletion addons/common/fnc_getMagazineIndex.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,14 @@ private _displayName = getText (configFile >> "CfgMagazines" >> _magazine >> "di

if (_displayName isEqualTo "") exitWith {[]};

magazinesDetail _unit select {_x find _displayName == 0} apply {_x = _x splitString "[:]"; _x select (count _x - 1)};
#ifndef LINUX_BUILD
magazinesDetail _unit select {_x find _displayName == 0} apply {_x = _x splitString "[:]"; _x select (count _x - 1)};
#else
[magazinesDetail _unit, {
if (_x find _displayName == 0) then {
_x = _x splitString "[:]";
_x = _x select (count _x - 1);
true
} else {false};
}] call BIS_fnc_conditionalSelect;
#endif
2 changes: 2 additions & 0 deletions addons/common/fnc_getMagazineIndex_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_getMagazineIndex.sqf"
32 changes: 23 additions & 9 deletions addons/common/fnc_removeMagazine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,31 @@ if (_ammo < 0) then {
private _backpack = backpackContainer _unit;

// magazinesAmmoCargo bugged. returns nil for objNull.
if (!isNull _uniform) then {
_uniformMagazines = magazinesAmmoCargo _uniform select {_x select 0 == _item};
};
#ifndef LINUX_BUILD
if (!isNull _uniform) then {
_uniformMagazines = magazinesAmmoCargo _uniform select {_x select 0 == _item};
};

if (!isNull _vest) then {
_vestMagazines = magazinesAmmoCargo _vest select {_x select 0 == _item};
};
if (!isNull _vest) then {
_vestMagazines = magazinesAmmoCargo _vest select {_x select 0 == _item};
};

if (!isNull _backpack) then {
_backpackMagazines = magazinesAmmoCargo _backpack select {_x select 0 == _item};
};
if (!isNull _backpack) then {
_backpackMagazines = magazinesAmmoCargo _backpack select {_x select 0 == _item};
};
#else
if (!isNull _uniform) then {
_uniformMagazines = [magazinesAmmoCargo _uniform, {_x select 0 == _item}] call BIS_fnc_conditionalSelect;
};

if (!isNull _vest) then {
_vestMagazines = [magazinesAmmoCargo _vest, {_x select 0 == _item}] call BIS_fnc_conditionalSelect;
};

if (!isNull _backpack) then {
_backpackMagazines = [magazinesAmmoCargo _backpack, {_x select 0 == _item}] call BIS_fnc_conditionalSelect;
};
#endif

{
if (_x select 1 == _ammo) exitWith {
Expand Down
2 changes: 2 additions & 0 deletions addons/common/fnc_removeMagazine_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_removeMagazine.sqf"
6 changes: 5 additions & 1 deletion addons/common/fnc_turretPath.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ params [["_unit", objNull, [objNull]]];

private _vehicle = vehicle _unit;

(allTurrets [_vehicle, true] select {(_vehicle turretUnit _x) isEqualTo _unit}) param [0, []]
#ifndef LINUX_BUILD
(allTurrets [_vehicle, true] select {(_vehicle turretUnit _x) isEqualTo _unit}) param [0, []]
#else
([allTurrets [_vehicle, true], {(_vehicle turretUnit _x) isEqualTo _unit}] call BIS_fnc_conditionalSelect) param [0, []]
#endif
6 changes: 5 additions & 1 deletion addons/common/fnc_turretPathWeapon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ params [["_vehicle", objNull, [objNull]], ["_weapon", "", [""]]];
private _turrets = allTurrets _vehicle;
_turrets pushBack [-1];

(_turrets select {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}) param [0, []]
#ifndef LINUX_BUILD
(_turrets select {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}) param [0, []]
#else
([_turrets, {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}] call BIS_fnc_conditionalSelect) param [0, []]
#endif
2 changes: 2 additions & 0 deletions addons/common/fnc_turretPathWeapon_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_turretPathWeapon.sqf"
2 changes: 2 additions & 0 deletions addons/common/fnc_turretPath_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_turretPath.sqf"
6 changes: 5 additions & 1 deletion addons/common/fnc_vehicleRole.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ SCRIPT(vehicleRole);

params [["_unit", objNull, [objNull]]];

fullCrew vehicle _unit select {(_x select 0) isEqualTo _unit} param [0, [nil, ""]] select 1
#ifndef LINUX_BUILD
fullCrew vehicle _unit select {(_x select 0) isEqualTo _unit} param [0, [nil, ""]] select 1
#else
([fullCrew vehicle _unit, {(_x select 0) isEqualTo _unit}] call BIS_fnc_conditionalSelect) param [0, [nil, ""]] select 1
#endif
2 changes: 2 additions & 0 deletions addons/common/fnc_vehicleRole_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_vehicleRole.sqf"
4 changes: 2 additions & 2 deletions addons/common/test_config.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ TEST_TRUE(isNull _result,_funcName);
_result = ["B_MBT_01_TUSK_F", [0,1]] call CBA_fnc_getTurret;
TEST_TRUE(isNull _result,_funcName);

_result = {isNull _x} count ([[0],[1],[2],[3],[4]] apply {["B_Heli_Transport_03_F", _x] call CBA_fnc_getTurret});
/*_result = {isNull _x} count ([[0],[1],[2],[3],[4]] apply {["B_Heli_Transport_03_F", _x] call CBA_fnc_getTurret});
TEST_TRUE(_result == 0,_funcName);

_result = {!isNull _x} count ([[0],[1],[2],[3],[4]] apply {["B_Heli_Transport_03_F", _x] call CBA_fnc_getTurret});
TEST_TRUE(_result == 5,_funcName);
TEST_TRUE(_result == 5,_funcName);*/
13 changes: 11 additions & 2 deletions addons/events/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ if (!isNull (uiNamespace getVariable ["CBA_missionDisplay", displayNull])) then
};

PREP(keyHandler);
PREP(keyHandlerDown);
#ifndef LINUX_BUILD
PREP(keyHandlerDown);
#else
PREP(keyHandlerDown_Linux);
FUNC(keyHandlerDown) = FUNC(keyHandlerDown_Linux);
#endif
PREP(keyHandlerUp);

["keyDown", FUNC(keyHandlerDown)] call CBA_fnc_addDisplayHandler;
Expand All @@ -55,7 +60,11 @@ PREP(keyHandlerUp);
private _keyHandlers = [];
_keyHandlers resize 250;

GVAR(keyDownStates) = _keyHandlers apply {[]};
#ifndef LINUX_BUILD
GVAR(keyDownStates) = _keyHandlers apply {[]};
#else
GVAR(keyDownStates) = [_keyHandlers, {[]}] call CBA_fnc_filter;
#endif
GVAR(keyUpStates) = + GVAR(keyDownStates);

GVAR(keyHandlersDown) = call CBA_fnc_createNamespace;
Expand Down
2 changes: 2 additions & 0 deletions addons/events/XEH_preInit_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "XEH_preInit.sqf"
7 changes: 6 additions & 1 deletion addons/events/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include "script_component.hpp"

PREP(keyHandler);
PREP(keyHandlerDown);
#ifndef LINUX_BUILD
PREP(keyHandlerDown);
#else
PREP(keyHandlerDown_Linux);
FUNC(keyHandlerDown) = FUNC(keyHandlerDown_Linux);
#endif
PREP(keyHandlerUp);
2 changes: 2 additions & 0 deletions addons/events/XEH_preStart_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "XEH_preStart.sqf"
6 changes: 5 additions & 1 deletion addons/events/fnc_addKeyHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ _hash setVariable [_hashKey, [_key, _settings, _code, _allowHold, _holdDelay]];
private _keyHandlers = [GVAR(keyDownStates), GVAR(keyUpStates)] select (_type == "keyup");

private _hashKeys = _keyHandlers param [_key, []];
_hashKeys pushBackUnique _hashKey; // pushBackUnique. Fixes using addKeyHander twice with the same keyHash/id executing the newly added action twice.
#ifndef LINUX_BUILD
_hashKeys pushBackUnique _hashKey; // pushBackUnique. Fixes using addKeyHander twice with the same keyHash/id executing the newly added action twice.
#else
_hashKeys pushBack _hashKey;
#endif
_keyHandlers set [_key, _hashKeys];

_hashKey
2 changes: 2 additions & 0 deletions addons/events/fnc_addKeyHandler_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_addKeyHandler.sqf"
2 changes: 2 additions & 0 deletions addons/events/fnc_addPlayerEventHandler_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// not implemented for 1.54
-1
15 changes: 13 additions & 2 deletions addons/events/fnc_keyHandlerDown.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ private _blockInput = false;
};

// check if either holding down a key is enabled or if the key wasn't already held down
if (_execute && {_allowHold || {GVAR(keyUpActiveList) pushBackUnique _xUp != -1}}) then {
#ifndef LINUX_BUILD
if (_execute && {_allowHold || {GVAR(keyUpActiveList) pushBackUnique _xUp != -1}}) then {
#else
if (_execute && {_allowHold || {!(_xUp in GVAR(keyUpActiveList))}}) then {
GVAR(keyUpActiveList) pushBack _xUp;
#endif
private _params = + _this;
_params pushBack + _keybindParams;
_params pushBack _x;
Expand All @@ -69,7 +74,13 @@ private _blockInput = false;

// Verify if the required modifier keys are present
if (_keybindSettings isEqualTo _inputSettings) then {
GVAR(keyDownActiveList) pushBackUnique _x;
#ifndef LINUX_BUILD
GVAR(keyDownActiveList) pushBackUnique _x;
#else
if !(_x in GVAR(keyDownActiveList)) then {
GVAR(keyDownActiveList) pushBack _x;
};
#endif
};
} forEach (GVAR(keyUpStates) param [_inputKey, []]);

Expand Down
2 changes: 2 additions & 0 deletions addons/events/fnc_keyHandlerDown_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_keyHandlerDown.sqf"
6 changes: 5 additions & 1 deletion addons/events/fnc_targetEvent.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ if !(_targets isEqualType []) then {
_targets = [_targets];
};

private _remoteTargets = _targets select {!local GETOBJ(_x)};
#ifndef LINUX_BUILD
private _remoteTargets = _targets select {!local GETOBJ(_x)};
#else
private _remoteTargets = [_targets, {!local GETOBJ(_x)}] call BIS_fnc_conditionalSelect;
#endif

// do local events if there is a local target
if (count _targets > count _remoteTargets) then {
Expand Down
2 changes: 2 additions & 0 deletions addons/events/fnc_targetEvent_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_targetEvent.sqf"
9 changes: 7 additions & 2 deletions addons/hashes/fnc_hashCreate.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ SCRIPT(hashCreate);
// -----------------------------------------------------------------------------
params [["_array", [], [[]]], "_defaultValue"];

private _keys = _array apply {_x select 0};
private _values = _array apply {_x select 1};
#ifndef LINUX_BUILD
private _keys = _array apply {_x select 0};
private _values = _array apply {_x select 1};
#else
private _keys = [_array, {_x select 0}] call CBA_fnc_filter;
private _values = [_array, {_x select 1}] call CBA_fnc_filter;
#endif

// Return.
[TYPE_HASH, _keys, _values, if (isNil "_defaultValue") then {nil} else {_defaultValue}];
2 changes: 2 additions & 0 deletions addons/hashes/fnc_hashCreate_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_hashCreate.sqf"
12 changes: 6 additions & 6 deletions addons/help/fnc_setVersionLine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,29 @@ if (isNil {uiNamespace getVariable QGVAR(VerList)}) then {
};

// start loop that cycles through all addons
terminate (_display getVariable [QGVAR(VerScript), scriptNull]);
terminate (uiNamespace getVariable [QGVAR(VerScript), scriptNull]);

private _verScript = [_display] spawn { // will terminate when main menu mission exits
uiSleep 3;
QUOTE(_this call COMPILE_FILE(fnc_setVersionLine)) configClasses (configFile >> "CBA_DirectCall");
};

_display setVariable [QGVAR(VerScript), _verScript];
uiNamespace setVariable [QGVAR(VerScript), _verScript];

// start loop with mouse moving event on main menu. this is used, because loops can't be used at that point
if !(_display getVariable [QGVAR(VerScriptFlag), false]) then {
_display setVariable [QGVAR(VerScriptFlag), true];
if (isNull (uiNamespace getVariable [QGVAR(VerScriptFlag), displayNull])) then {
uiNamespace setVariable [QGVAR(VerScriptFlag), _display];
_display displayAddEventHandler ["mouseMoving", {
params ["_display"];

if (!scriptDone (_display getVariable [QGVAR(VerScript), scriptNull])) exitWith {};
if (!scriptDone (uiNamespace getVariable [QGVAR(VerScript), scriptNull])) exitWith {};

private _verScript = [_display] spawn { // will terminate when main menu mission exits
uiSleep 3;
QUOTE(_this call COMPILE_FILE(fnc_setVersionLine)) configClasses (configFile >> "CBA_DirectCall");
};

_display setVariable [QGVAR(VerScript), _verScript];
uiNamespace setVariable [QGVAR(VerScript), _verScript];
}];
};

Expand Down
20 changes: 17 additions & 3 deletions addons/jr/fnc_compatibleItems.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,23 @@ if (isNil "_compatibleItems") then {
private _cfgCompatibleItems = _x >> "compatibleItems";
if (isArray _cfgCompatibleItems) then {
{
_compatibleItems pushBackUnique _x;
#ifndef LINUX_BUILD
_compatibleItems pushBackUnique _x;
#else
if !(_x in _compatibleItems) then {_compatibleItems pushBack _x};
#endif
nil
} count (getArray _cfgCompatibleItems);
} else {
if (isClass _cfgCompatibleItems) then {
{
if ((getNumber _x > 0)) then {_compatibleItems pushBackUnique (configName _x)};
if (getNumber _x > 0) then {
#ifndef LINUX_BUILD
_compatibleItems pushBackUnique configName _x;
#else
if !(configName _x in _compatibleItems) then {_compatibleItems pushBack configName _x};
#endif
};
nil
} count configProperties [_cfgCompatibleItems, "isNumber _x"];
};
Expand All @@ -57,5 +67,9 @@ if (isNil "_compatibleItems") then {
if (_typefilter == 0) then { //return
+ _compatibleItems
} else {
_compatibleItems select {_typefilter == getNumber(configFile>>"CfgWeapons">>_x>>"itemInfo">>"type")};
#ifndef LINUX_BUILD
_compatibleItems select {_typefilter == getNumber (configFile >> "CfgWeapons" >> _x >> "itemInfo" >> "type")}
#else
[_compatibleItems, {_typefilter == getNumber (configFile >> "CfgWeapons" >> _x >> "itemInfo" >> "type")}] call BIS_fnc_conditionalSelect
#endif
};
2 changes: 2 additions & 0 deletions addons/jr/fnc_compatibleItems_Linux.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define LINUX_BUILD
#include "fnc_compatibleItems.sqf"
Empty file added addons/linux/$NOBIN$
Empty file.
1 change: 1 addition & 0 deletions addons/linux/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x\cba\addons\linux
13 changes: 13 additions & 0 deletions addons/linux/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

#define F_FILEPATH(comp,func) class DOUBLES(PREFIX,comp) {\
init = __EVAL([QUOTE(call COMPILE_FILE_SYS(PREFIX,comp,func)), QUOTE(call COMPILE_FILE_SYS(PREFIX,comp,DOUBLES(func,Linux)))] select IS_LINUX);\
}

class Extended_PreStart_EventHandlers {
F_FILEPATH(events,XEH_preStart);
};

class Extended_PreInit_EventHandlers {
F_FILEPATH(common,XEH_preInit);
F_FILEPATH(events,XEH_preInit);
};
Loading