From bace23c3317ab17223eb1981667984c1aa23adab Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 18 May 2015 18:44:52 -0500 Subject: [PATCH 1/5] Button to dump array info to clipboard --- addons/optionsmenu/XEH_preInit.sqf | 1 + .../functions/fnc_debugDumpToClipboard.sqf | 60 +++++++++++++++++++ addons/optionsmenu/gui/settingsMenu.hpp | 6 ++ addons/optionsmenu/stringtable.xml | 3 + 4 files changed, 70 insertions(+) create mode 100644 addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf diff --git a/addons/optionsmenu/XEH_preInit.sqf b/addons/optionsmenu/XEH_preInit.sqf index 42f50287f20..e35784560aa 100644 --- a/addons/optionsmenu/XEH_preInit.sqf +++ b/addons/optionsmenu/XEH_preInit.sqf @@ -2,6 +2,7 @@ ADDON = false; +PREP(debugDumpToClipboard); PREP(onListBoxSettingsChanged); PREP(onListBoxShowSelectionChanged); PREP(onSettingsMenuOpen); diff --git a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf new file mode 100644 index 00000000000..55e962b3c33 --- /dev/null +++ b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf @@ -0,0 +1,60 @@ +/* + * Author: PabstMirror + * Dumps debug info to clipboard. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ACE_optionsmenu_fnc_debugDumpToClipboard + * + * Public: No + */ +#include "script_component.hpp" + +_outputString = "Array Variable Count': +"; + +{ + private["_var"]; + _var = missionNamespace getVariable [_x, nil]; + if(!isnil "_var" && {(typeName _var) == "ARRAY"} ) then { + _outputString = _outputString + format["%1 - ARRAY SIZE: %2 +", _x, (count _var)]; + }; +} forEach (allVariables missionNamespace); + +{ + _unit = _x; + { + private["_var"]; + _var = missionNamespace getVariable [_x, nil]; + if(!isnil "_var" && {(typeName _var) == "ARRAY"} ) then { + _outputString = _outputString + text format["%1 - ARRAY SIZE: %2 for %3 +", _x, (count _var), _unit]; + }; + } forEach (allVariables _unit); +} forEach allUnits; + + +FUNC(clipboardExport) = { + private["_chunks"]; + _chunks = []; + + _chunks = [_this select 0, "-"] call CBA_fnc_split; + + { + private["_chunk"]; + _chunk = _x + ";"; + "ace_clipboard" callExtension format["%1", _chunk]; + } forEach _chunks; + + "ace_clipboard" callExtension "--COMPLETE--"; +}; + + +[_outputString] call FUNC(clipboardExport); + diff --git a/addons/optionsmenu/gui/settingsMenu.hpp b/addons/optionsmenu/gui/settingsMenu.hpp index 04e7ee5aaad..8da18a303b4 100644 --- a/addons/optionsmenu/gui/settingsMenu.hpp +++ b/addons/optionsmenu/gui/settingsMenu.hpp @@ -247,6 +247,12 @@ class ACE_settingsMenu { text = "$STR_ACE_OptionsMenu_OpenExport"; x = X_PART(18); action = QUOTE(if (GVAR(serverConfigGeneration) > 0) then {createDialog 'ACE_serverSettingsMenu'; }); + }; + class action_debug: actionClose { + idc = 1102; + text = "$STR_ACE_OptionsMenu_DumpDebug"; + x = X_PART(26.5); + action = QUOTE([] call FUNC(debugDumpToClipboard)); }; }; }; diff --git a/addons/optionsmenu/stringtable.xml b/addons/optionsmenu/stringtable.xml index 22a1a88cfa3..33bd80cae42 100644 --- a/addons/optionsmenu/stringtable.xml +++ b/addons/optionsmenu/stringtable.xml @@ -285,5 +285,8 @@ Bottom Dół + + Debug To Clipboard + From b727fd79c4f0c05932869cb784a6d69941a030cf Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 18 May 2015 19:29:39 -0500 Subject: [PATCH 2/5] Call Ext Directly CBA_fnc_split problems --- .../functions/fnc_debugDumpToClipboard.sqf | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf index 55e962b3c33..796ee5891ea 100644 --- a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf +++ b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf @@ -15,14 +15,12 @@ */ #include "script_component.hpp" -_outputString = "Array Variable Count': -"; { private["_var"]; _var = missionNamespace getVariable [_x, nil]; if(!isnil "_var" && {(typeName _var) == "ARRAY"} ) then { - _outputString = _outputString + format["%1 - ARRAY SIZE: %2 + "ace_clipboard" callExtension format["%1 - ARRAY SIZE: %2 ", _x, (count _var)]; }; } forEach (allVariables missionNamespace); @@ -31,30 +29,13 @@ _outputString = "Array Variable Count': _unit = _x; { private["_var"]; - _var = missionNamespace getVariable [_x, nil]; + _var = _unit getVariable [_x, nil]; if(!isnil "_var" && {(typeName _var) == "ARRAY"} ) then { - _outputString = _outputString + text format["%1 - ARRAY SIZE: %2 for %3 + "ace_clipboard" callExtension format["%1 - ARRAY SIZE: %2 for %3 ", _x, (count _var), _unit]; }; } forEach (allVariables _unit); } forEach allUnits; -FUNC(clipboardExport) = { - private["_chunks"]; - _chunks = []; - - _chunks = [_this select 0, "-"] call CBA_fnc_split; - - { - private["_chunk"]; - _chunk = _x + ";"; - "ace_clipboard" callExtension format["%1", _chunk]; - } forEach _chunks; - - "ace_clipboard" callExtension "--COMPLETE--"; -}; - - -[_outputString] call FUNC(clipboardExport); - +"ace_clipboard" callExtension "--COMPLETE--"; From 7c8505592b7e46f1cdcb0816005f08e18c6ec23a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 19 May 2015 01:57:41 -0500 Subject: [PATCH 3/5] Chunk Data to Extension, add some extra diag info --- .../functions/fnc_debugDumpToClipboard.sqf | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf index 796ee5891ea..706e3e95e93 100644 --- a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf +++ b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf @@ -15,12 +15,42 @@ */ #include "script_component.hpp" +private ["_outputString", "_var", "_unit", "_countSent"]; +#define CHARS_PER_EXT_CALL 2000 +#define MIN_ARRAY_SIZE 0 + +_outputString = "---ACE Debug--- +"; + +_outputString = _outputString + format ["--Performance-- +diag_fps = %1 +count cba_common_perFrameHandlerArray = %2 +count diag_activeSQFScripts = %3 +count diag_activeSQSScripts = %4 +count diag_activeMissionFSMs = %5 + +", diag_fps, count cba_common_perFrameHandlerArray, count diag_activeSQFScripts, count diag_activeSQSScripts,count diag_activeMissionFSMs]; + +_outputString = _outputString + "--Player-- +"; +if (isNull ACE_player) then { + _outputString = _outputString + "Null + +"; +} else { + _outputString = _outputString + format ["typeOf = %1 +animationState = %2 + +", typeOf ace_player, animationState ace_player]; +}; + +_outputString = _outputString + format ["--Array Info (count >= %1)-- +", MIN_ARRAY_SIZE]; { - private["_var"]; _var = missionNamespace getVariable [_x, nil]; - if(!isnil "_var" && {(typeName _var) == "ARRAY"} ) then { - "ace_clipboard" callExtension format["%1 - ARRAY SIZE: %2 + if(!isnil "_var" && {(typeName _var) == "ARRAY"} && {(count _var) > MIN_ARRAY_SIZE}) then { + _outputString = _outputString + format["%1 - ARRAY SIZE: %2 ", _x, (count _var)]; }; } forEach (allVariables missionNamespace); @@ -28,14 +58,18 @@ { _unit = _x; { - private["_var"]; _var = _unit getVariable [_x, nil]; - if(!isnil "_var" && {(typeName _var) == "ARRAY"} ) then { - "ace_clipboard" callExtension format["%1 - ARRAY SIZE: %2 for %3 -", _x, (count _var), _unit]; + if(!isnil "_var" && {(typeName _var) == "ARRAY"} && {(count _var) > MIN_ARRAY_SIZE}) then { + _outputString = _outputString + format["%1 on [%2] - ARRAY SIZE: %3 +", _x, _unit, (count _var)]; }; } forEach (allVariables _unit); } forEach allUnits; +_countSent = 0; +while {_countSent < (count _outputString)} do { + "ace_clipboard" callExtension (_outputString select [_countSent, CHARS_PER_EXT_CALL]); + _countSent = _countSent + CHARS_PER_EXT_CALL; +}; "ace_clipboard" callExtension "--COMPLETE--"; From 2cf951970281d3d046c0d961ccb79cc685462307 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 28 May 2015 04:33:13 -0500 Subject: [PATCH 4/5] Send to extension directly --- .../functions/fnc_debugDumpToClipboard.sqf | 38 ++++++++----------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf index 706e3e95e93..350ba2a05ef 100644 --- a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf +++ b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf @@ -15,42 +15,42 @@ */ #include "script_component.hpp" -private ["_outputString", "_var", "_unit", "_countSent"]; +private ["_var", "_unit"]; -#define CHARS_PER_EXT_CALL 2000 -#define MIN_ARRAY_SIZE 0 +#define MIN_ARRAY_SIZE 10 -_outputString = "---ACE Debug--- +"ace_clipboard" callExtension "---ACE Debug--- "; -_outputString = _outputString + format ["--Performance-- +"ace_clipboard" callExtension format ["--Performance-- diag_fps = %1 -count cba_common_perFrameHandlerArray = %2 -count diag_activeSQFScripts = %3 -count diag_activeSQSScripts = %4 -count diag_activeMissionFSMs = %5 +count ace_common_waitAndExecArray = %2 +count cba_common_perFrameHandlerArray = %3 (max %4) +count diag_activeSQFScripts = %5 +count diag_activeSQSScripts = %6 +count diag_activeMissionFSMs = %7 -", diag_fps, count cba_common_perFrameHandlerArray, count diag_activeSQFScripts, count diag_activeSQSScripts,count diag_activeMissionFSMs]; +", diag_fps, count ace_common_waitAndExecArray, {!isNil "_x"} count cba_common_perFrameHandlerArray, count cba_common_perFrameHandlerArray, count diag_activeSQFScripts, count diag_activeSQSScripts,count diag_activeMissionFSMs]; -_outputString = _outputString + "--Player-- +"ace_clipboard" callExtension "--Player-- "; if (isNull ACE_player) then { - _outputString = _outputString + "Null + "ace_clipboard" callExtension "Null "; } else { - _outputString = _outputString + format ["typeOf = %1 + "ace_clipboard" callExtension format ["typeOf = %1 animationState = %2 ", typeOf ace_player, animationState ace_player]; }; -_outputString = _outputString + format ["--Array Info (count >= %1)-- +"ace_clipboard" callExtension format ["--Array Info (count >= %1)-- ", MIN_ARRAY_SIZE]; { _var = missionNamespace getVariable [_x, nil]; if(!isnil "_var" && {(typeName _var) == "ARRAY"} && {(count _var) > MIN_ARRAY_SIZE}) then { - _outputString = _outputString + format["%1 - ARRAY SIZE: %2 + "ace_clipboard" callExtension format ["%1 - ARRAY SIZE: %2 ", _x, (count _var)]; }; } forEach (allVariables missionNamespace); @@ -60,16 +60,10 @@ _outputString = _outputString + format ["--Array Info (count >= %1)-- { _var = _unit getVariable [_x, nil]; if(!isnil "_var" && {(typeName _var) == "ARRAY"} && {(count _var) > MIN_ARRAY_SIZE}) then { - _outputString = _outputString + format["%1 on [%2] - ARRAY SIZE: %3 + "ace_clipboard" callExtension format ["%1 on [%2] - ARRAY SIZE: %3 ", _x, _unit, (count _var)]; }; } forEach (allVariables _unit); } forEach allUnits; -_countSent = 0; -while {_countSent < (count _outputString)} do { - "ace_clipboard" callExtension (_outputString select [_countSent, CHARS_PER_EXT_CALL]); - _countSent = _countSent + CHARS_PER_EXT_CALL; -}; - "ace_clipboard" callExtension "--COMPLETE--"; From b49b2fa3d16370efa0aeb1981f3e00fe853f4d6a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 30 May 2015 01:21:47 -0500 Subject: [PATCH 5/5] Send to RPT and Clipboard --- .../functions/fnc_debugDumpToClipboard.sqf | 60 ++++++++++--------- addons/optionsmenu/gui/settingsMenu.hpp | 1 + addons/optionsmenu/stringtable.xml | 3 + 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf index 350ba2a05ef..04f66112e71 100644 --- a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf +++ b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf @@ -15,43 +15,49 @@ */ #include "script_component.hpp" -private ["_var", "_unit"]; +private ["_var", "_unit", "_outputText", "_text"]; #define MIN_ARRAY_SIZE 10 -"ace_clipboard" callExtension "---ACE Debug--- -"; +_outputText = { + diag_log text (_this select 0); + "ace_clipboard" callExtension ((_this select 0) + " +"); +}; -"ace_clipboard" callExtension format ["--Performance-- -diag_fps = %1 -count ace_common_waitAndExecArray = %2 -count cba_common_perFrameHandlerArray = %3 (max %4) -count diag_activeSQFScripts = %5 -count diag_activeSQSScripts = %6 -count diag_activeMissionFSMs = %7 +_text = format ["~~~~~~~~~ACE Debug~~~~~~~~~ +time = %1 -", diag_fps, count ace_common_waitAndExecArray, {!isNil "_x"} count cba_common_perFrameHandlerArray, count cba_common_perFrameHandlerArray, count diag_activeSQFScripts, count diag_activeSQSScripts,count diag_activeMissionFSMs]; +------Performance------ +diag_fps = %2 +count ace_common_waitAndExecArray = %3 +count cba_common_perFrameHandlerArray = %4 (max %5) +count diag_activeSQFScripts = %6 +count diag_activeSQSScripts = %7 +count diag_activeMissionFSMs = %8", +time, diag_fps, count ace_common_waitAndExecArray, {!isNil "_x"} count cba_common_perFrameHandlerArray, count cba_common_perFrameHandlerArray, count diag_activeSQFScripts, count diag_activeSQSScripts,count diag_activeMissionFSMs]; +[_text] call _outputText; -"ace_clipboard" callExtension "--Player-- -"; -if (isNull ACE_player) then { - "ace_clipboard" callExtension "Null -"; -} else { - "ace_clipboard" callExtension format ["typeOf = %1 -animationState = %2 +_text = format [" +------Player------ +typeOf = %1 +animationState = %2", +if (isNull ace_player) then {"null"} else {typeOf ace_player}, +if (isNull ace_player) then {"null"} else {animationState ace_player}]; +[_text] call _outputText; + + +_text = format [" +------Array Info (count >= %1)------", MIN_ARRAY_SIZE]; +[_text] call _outputText; -", typeOf ace_player, animationState ace_player]; -}; -"ace_clipboard" callExtension format ["--Array Info (count >= %1)-- -", MIN_ARRAY_SIZE]; { _var = missionNamespace getVariable [_x, nil]; if(!isnil "_var" && {(typeName _var) == "ARRAY"} && {(count _var) > MIN_ARRAY_SIZE}) then { - "ace_clipboard" callExtension format ["%1 - ARRAY SIZE: %2 -", _x, (count _var)]; + _text = format ["%1 - ARRAY SIZE: %2", _x, (count _var)]; + [_text] call _outputText; }; } forEach (allVariables missionNamespace); @@ -60,8 +66,8 @@ animationState = %2 { _var = _unit getVariable [_x, nil]; if(!isnil "_var" && {(typeName _var) == "ARRAY"} && {(count _var) > MIN_ARRAY_SIZE}) then { - "ace_clipboard" callExtension format ["%1 on [%2] - ARRAY SIZE: %3 -", _x, _unit, (count _var)]; + _text = format ["%1 on [%2] - ARRAY SIZE: %3", _x, _unit, (count _var)]; + [_text] call _outputText; }; } forEach (allVariables _unit); } forEach allUnits; diff --git a/addons/optionsmenu/gui/settingsMenu.hpp b/addons/optionsmenu/gui/settingsMenu.hpp index 8da18a303b4..15eb411019e 100644 --- a/addons/optionsmenu/gui/settingsMenu.hpp +++ b/addons/optionsmenu/gui/settingsMenu.hpp @@ -253,6 +253,7 @@ class ACE_settingsMenu { text = "$STR_ACE_OptionsMenu_DumpDebug"; x = X_PART(26.5); action = QUOTE([] call FUNC(debugDumpToClipboard)); + tooltip = "$STR_ACE_OptionsMenu_DumpDebugTooltip"; }; }; }; diff --git a/addons/optionsmenu/stringtable.xml b/addons/optionsmenu/stringtable.xml index a39af6da9f1..ce34356a661 100644 --- a/addons/optionsmenu/stringtable.xml +++ b/addons/optionsmenu/stringtable.xml @@ -299,5 +299,8 @@ Debug To Clipboard + + Sends debug information to RPT and clipboard. +