Jump to content

log every XComGame func/event calls


OVNI

Recommended Posts

Hello,



To help me figure what's going on, I managed to log (hopefully) every event calls, and function calls (with stacktrace) for XComGame package.



To do that, you need to create a default mod, then go in its Src/XComGame/Classes folder with perl installed and in bash-compatible shell (should be fairy easy to convent to Windows' shell tho) execute :


for i in {1..10}; do perl -pi -e 'undef $/; s/((?<!\/)\/\*((?!\/\*).)*?\*\/)//gs' *.uc; done
perl -pi -e 'undef $/; s/(?<!img:)(?<!\/)\/\/.*(\n|$)/\n/g' *.uc
perl -pi -e 'undef $/; s/(`if.*)\n|$/$1;\n/g' *.uc
perl -pi -e 'undef $/; s/((?<!\S)event[^\=;]*?(\s*(?<name>\w*)\s*\().*?\)\s*\{(\s|((local\s)|`)(.|\n)*?;+)*)/$1\r\n\t`log("event called : $ARGV $+{name}");\n/gi' *.uc
perl -pi -e 'undef $/; s/((?<!\S)function[^\=;]*?(\s*(?<name>\w*)\s*\().*?\)\s*\{(\s|((local\s)|`)(.|\n)*?;+)*)/$1\r\n\t`log("function called : $ARGV $+{name}"\$Chr(10)\$class'\''Object'\''.static.GetScriptTrace());\n/gi' *.uc


Warning : if you let the whole XComGame package's files in the mod project, the game will log a HUGE amount of data (like 1GB / minute).


So before building, it's better to remove everything from the project, except the classes you want to study.



Build the mod (you don't need to enable it in game's launcher), then launch the game with -NOSEEKFREELOADING argument, the stuff will be logged (as usual) to %userprofile%\documents\My Games\XCOM2\XComGame\Logs\Launch.log


I don't know if any other arguments are required so here's what i use :


"PATH_TO\XCom2.exe" -nostartupmovies -FROMLAUNCHER -noRedScreens -review -nostartupmovies -allowconsole -LANGUAGE=INT -NOSEEKFREELOADING


Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...