hairlessorphan Posted February 11, 2016 Share Posted February 11, 2016 (edited) Has anyone successfully attached XCOM2 to a debugger? What steps did you take? I saw this in the tech documentation, and none of it makes sense, because Firaxis. Script Debugging The stock command line options for development specify “-autodebug”, which tells UE3 to attempt to attach to a script debugger if one is available. This level of debug support is only necessary for deep or complex mods, or if you would like to learn more about how the game works by watching it in motion within a debugging environment. XCOM 2 Modbuddy performs many of the steps required to get script debugging working, but to review the basic requirements / steps they are: 1. The game must run in an “uncooked” mode. This is enabled by you when you set the SDK and Game directories in Modbuddy, because modbuddy will then create symlinks / junctions to the game directories giving it access to the uncooked resources of the SDK. 2. Game scripts must be compiled in debug mode. Adding a “Debug” configuration to your mod project and building using it will set this up. Performing this action will also add a new command line option to the “StartDebugging” batch script: “-noseekfreeloading” which will instruct the game to use the uncooked resources and debug scripts. 3. You will need to install a script debugger that will respond to “-autodebug”. An example of such a debugger can be found here: https://code.google.com/archive/p/unreal-debugger/downloads. The basic setup for a debugger will include a DLL for the game to attach to and a debug environment that is launched by that DLL or connects to it.So I believe step one happens automatically. Step two works, no problem. Step three is what? Where does it want these .dll's from the .zip? In the folder with the Visual Studio (Mod"Buddy") install? In the folder with the UDK (XComGame.exe) install? In the folder with the base game install? What happens after that? I've also tried console command toggledebugger, but all that does is crash. Any ideas? Edited February 11, 2016 by hairlessorphan Link to comment Share on other sites More sharing options...
hairlessorphan Posted February 11, 2016 Author Share Posted February 11, 2016 Nevermind, got it. Damn it, this always happens. I slam my face against a wall for two hours, I ask for help, I solve it five minutes later. For those wondering, here's the ticket: 1) Copy the .dll's from the .zip into the folder with XCom2.exe:[steam Install Location]\SteamApps\common\XCOM 2\Binaries\Win64 (or Win32 if you're luddite) 2) Go to the launcher folder:[steam Install Location]\SteamApps\common\XCOM 2\Binaries\Win64\Launcher 3) Edit StartDebugging.bat to:ModLauncherWPF.exe -allowconsole -log -autodebug -noseekfreeloading (flags:-allowconsole allows console-log will open a new shell window that will display all `LOG calls from the scripts in realtime-autodebug will make it look for the debugger .dll's-noseekfreeloading will make it load the game from uncooked scripts) 4) Execute StartDebugging.bat 5) Enjoy breakpoints Ok, new problem. I've been trying to catch the engine in the act of loading up item templates by placing breakpoints on the various X2ItemTemplate_DefaultThingy.CreateTemplates() functions, but I can't. Not sure why; my best guess is they happen before the debugger loads up and hits the game window breakpoint. Any ideas what the very first event might be and/or which class actually invokes the template creators? Link to comment Share on other sites More sharing options...
Kvalyr Posted February 11, 2016 Share Posted February 11, 2016 AFAIK the callchain for Template creation is thus:[some Native C++ Function inside the game] -> X2DataSet.uc -> [Loop through classes that extend X2DataSet] -> Call CreateTemplates() on eachWhich would explain why CreateTemplates() called on an override of one of the base game's CreateTemplates() function doesn't replace the call in the overriden class, it calls the override class serially afterwards instead.Unsure if that's intentional behaviour but it makes updating existing templates after creation easier.See here: http://forums.nexusmods.com/index.php?/topic/3771570-overriding-vanilla-content/?p=34411265 Link to comment Share on other sites More sharing options...
TommInfinite Posted February 11, 2016 Share Posted February 11, 2016 Is there a way to know why project failes to build by XCOM2 mod buddy? I thought debug log in documentation does that but judging by your instruction it's for the game (after project is built). I know there is a mistake in scripts but I can't know which one without prefixing lines one by one with "//". Link to comment Share on other sites More sharing options...
SheepDarklord Posted February 11, 2016 Share Posted February 11, 2016 (edited) Has anyone actually managed to get breakpoints to work? The breakpoints never trigger for me. I've made changes that are definitely being implemented into the game when I build my mod but when I place breakpoints in the debugger the program never breaks. Edit: ignore me, my own fault fixed it now. I was just getting confused Edited February 11, 2016 by SheepDarklord Link to comment Share on other sites More sharing options...
Quaro Posted February 24, 2016 Share Posted February 24, 2016 I don't know how I missed the fact that there's an actual debugger in here. Wow. Thanks for the writeup, I couldn't get it working from the documentation either. Link to comment Share on other sites More sharing options...
Questengine Posted March 5, 2016 Share Posted March 5, 2016 Hey SheepDarklord, can you share what fixed it for you? I can see my changes in game, and I can see my log messages, but I can't get the debugger to break at any breakpoints. What did you do to fix it? Link to comment Share on other sites More sharing options...
Recommended Posts