diff --git a/ArmaDragonflyClient_x64.dll b/ArmaDragonflyClient_x64.dll index 640ee2d..3ddce5f 100644 Binary files a/ArmaDragonflyClient_x64.dll and b/ArmaDragonflyClient_x64.dll differ diff --git a/ArmaDragonflyClient_x64.so b/ArmaDragonflyClient_x64.so index fd6c79e..a137b76 100644 Binary files a/ArmaDragonflyClient_x64.so and b/ArmaDragonflyClient_x64.so differ diff --git a/addons/db/functions/fnc_fetch.sqf b/addons/db/functions/fnc_fetch.sqf index 17496ea..a406502 100644 --- a/addons/db/functions/fnc_fetch.sqf +++ b/addons/db/functions/fnc_fetch.sqf @@ -52,9 +52,7 @@ if (_count_total == _total) then { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_fetch' Data String: %1", _dataString]; #endif - private _callValue = (_call == "true"); - - [_uniqueID, _function, _callValue, (parseSimpleArray _dataString), _netId] call FUNC(handler); + [_uniqueID, _function, _call, (parseSimpleArray _dataString), _netId] call FUNC(handler); dragonfly_db_fetch_array = dragonfly_db_fetch_array select {!((_x select 0) in [_uniqueID])}; }; \ No newline at end of file diff --git a/addons/db/functions/fnc_handler.sqf b/addons/db/functions/fnc_handler.sqf index 93fea0a..47217f2 100644 --- a/addons/db/functions/fnc_handler.sqf +++ b/addons/db/functions/fnc_handler.sqf @@ -32,7 +32,7 @@ * Public: Yes */ -params [["_uniqueID", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_data", [], [[]]], ["_netId", nil, [""]]]; +params [["_uniqueID", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_data", [], [[]]], ["_netId", "", [""]]]; #ifdef __A3__DEBUG__ diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' UniqueID: '%1', Function: '%2', Call: '%3', Data: '%4', NetId: '%5'", _uniqueID, _function, _call, _data, _netId]; @@ -44,10 +44,34 @@ if (_function == "" || count _data == 0) exitWith { private _func = call compile format ["%1", _function]; -if ((!isNil "_netId") and (_netId isNotEqualTo "")) then { +if (_netId != "") then { private _target = objectFromNetId _netId; - - if (_call) then { _data remoteExecCall [_function, _target, false]; } else { _data remoteExec [_function, _target, false]; }; + + if (!isNull _target) then { + #ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' Using NetId: '%1'", _netId]; + #endif + + if (_call) then { + _data remoteExecCall [_function, _target, false]; + } else { + _data remoteExec [_function, _target, false]; + }; + } else { + #ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' NetId '%1' resolved to null object, using local execution", _netId]; + #endif + + if (_call) then { + _data call _func; + } else { + _data spawn _func; + }; + }; } else { - if (_call) then { _data call _func; } else { _data spawn _func; }; + if (_call) then { + _data call _func; + } else { + _data spawn _func; + }; }; \ No newline at end of file diff --git a/addons/db/functions/fnc_hashSetBulk.sqf b/addons/db/functions/fnc_hashSetBulk.sqf index faf569f..afe4110 100644 --- a/addons/db/functions/fnc_hashSetBulk.sqf +++ b/addons/db/functions/fnc_hashSetBulk.sqf @@ -22,8 +22,8 @@ * N/A * * Examples: - * ["loadout", [getUnitLoadout player], "position", [getPosASLVisual player]] call dragonfly_db_fnc_hashSetBulk (Server or Singleplayer Only) - * ["loadout", [getUnitLoadout player], "position", [getPosASLVisual player]] remoteExecCall ["dragonfly_db_fnc_hashSetBulk", 2, false] (Multiplayer Only) + * [["loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] call dragonfly_db_fnc_hashSetBulk (Server or Singleplayer Only) + * [["loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] remoteExecCall ["dragonfly_db_fnc_hashSetBulk", 2, false] (Multiplayer Only) * * Public: Yes */ diff --git a/addons/db/functions/fnc_hashSetIdBulk.sqf b/addons/db/functions/fnc_hashSetIdBulk.sqf index 53c9082..7235b94 100644 --- a/addons/db/functions/fnc_hashSetIdBulk.sqf +++ b/addons/db/functions/fnc_hashSetIdBulk.sqf @@ -22,8 +22,8 @@ * N/A * * Examples: - * [getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]] call dragonfly_db_fnc_hashSetIdBulk (Server or Singleplayer Only) - * [getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]] remoteExecCall ["dragonfly_db_fnc_hashSetIdBulk", 2, false] (Multiplayer Only) + * [[getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] call dragonfly_db_fnc_hashSetIdBulk (Server or Singleplayer Only) + * [[getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] remoteExecCall ["dragonfly_db_fnc_hashSetIdBulk", 2, false] (Multiplayer Only) * * Public: Yes */ diff --git a/extension/bin/Release/net8.0/linux-x64/publish/ArmaDragonflyClient_x64.so b/extension/bin/Release/net8.0/linux-x64/publish/ArmaDragonflyClient_x64.so index fd6c79e..a137b76 100644 Binary files a/extension/bin/Release/net8.0/linux-x64/publish/ArmaDragonflyClient_x64.so and b/extension/bin/Release/net8.0/linux-x64/publish/ArmaDragonflyClient_x64.so differ diff --git a/extension/bin/Release/net8.0/win-x64/publish/ArmaDragonflyClient_x64.dll b/extension/bin/Release/net8.0/win-x64/publish/ArmaDragonflyClient_x64.dll index 640ee2d..3ddce5f 100644 Binary files a/extension/bin/Release/net8.0/win-x64/publish/ArmaDragonflyClient_x64.dll and b/extension/bin/Release/net8.0/win-x64/publish/ArmaDragonflyClient_x64.dll differ diff --git a/extension/src/Utils.cs b/extension/src/Utils.cs index 386ce2a..8817874 100644 --- a/extension/src/Utils.cs +++ b/extension/src/Utils.cs @@ -50,25 +50,30 @@ namespace ArmaDragonflyClient { if (!data.StartsWith('[')) data = BuildArray(data); - Main.Log($"{data}", "debug"); + + Main.Log($"Single chunk data: {data}", "debug"); string dataAsString = $"[\"{uniqueId}\",\"{function}\",{call.ToString().ToLower()},{data},\"{entity}\"]"; - Main.Log($"{dataAsString}", "debug"); + + Main.Log($"Single chunk data string: {dataAsString}", "debug"); Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_handler", dataAsString); } else { - if (!data.StartsWith('[')) + if (!data.StartsWith('[') || !data.EndsWith(']')) data = BuildArray(data); - Main.Log($"{data}", "debug"); + + Main.Log($"Single chunk data: {data}", "debug"); + var chunks = SplitIntoChunks(data, bufferSize); int totalChunks = chunks.Count; - for (int i = 0; i < chunks.Count; i++) + for (int chunkIndex = 0; chunkIndex < chunks.Count; chunkIndex++) { - string escapedChunk = chunks[i].Replace("\"", "\"\""); - string callString = call ? "true" : "false"; - string chunkAsString = $"[\"{uniqueId}\",\"{function}\",{i+1},{totalChunks},\"{escapedChunk}\",\"{callString}\",\"{entity}\"]"; + string escapedChunkData = chunks[chunkIndex].Replace("\"", "\"\""); + string chunkAsString = $"[\"{uniqueId}\",\"{function}\",{chunkIndex+1},{totalChunks},\"{escapedChunkData}\",{call.ToString().ToLower()},\"{entity}\"]"; + + Main.Log($"Chunk {chunkIndex+1}/{totalChunks}: {chunkAsString}", "debug"); Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_fetch", chunkAsString); } } @@ -80,27 +85,33 @@ namespace ArmaDragonflyClient { if (!data.StartsWith('[')) data = BuildArray(data); - Main.Log($"{data}", "debug"); + + Main.Log($"Single chunk data: {data}", "debug"); string dataAsString = $"[\"{uniqueId}\",\"{eventType}\",\"{eventName}\",{data},\"{target}\"]"; - Main.Log($"{dataAsString}", "debug"); + + Main.Log($"Single chunk data: {dataAsString}", "debug"); Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_pubSubHandler", dataAsString); } else { if (!data.StartsWith('[')) data = BuildArray(data); - Main.Log($"{data}", "debug"); + + Main.Log($"Single chunk data: {data}", "debug"); + var chunks = SplitIntoChunks(data, bufferSize); int totalChunks = chunks.Count; - for (int i = 0; i < chunks.Count; i++) + for (int chunkIndex = 0; chunkIndex < chunks.Count; chunkIndex++) { - string escapedChunk = chunks[i].Replace("\"", "\"\""); - string chunkAsString = $"[\"{uniqueId}\",\"{eventType}\",\"{eventName}\",{i+1},{totalChunks},\"{escapedChunk}\",\"{target}\"]"; + string escapedChunkData = chunks[chunkIndex].Replace("\"", "\"\""); + string chunkAsString = $"[\"{uniqueId}\",\"{eventType}\",\"{eventName}\",{chunkIndex+1},{totalChunks},\"{escapedChunkData}\",\"{target}\"]"; + + Main.Log($"Chunk {chunkIndex+1}/{totalChunks}: {chunkAsString}", "debug"); Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_pubSubFetch", chunkAsString); } } } } -} +} \ No newline at end of file