Home » MODDING HQ 1.13 » v1.13 General Development Talk » Guide to debugging?
Guide to debugging?[message #337123] Sat, 25 October 2014 01:16 Go to next message
perpetual
Messages:4
Registered:October 2014
Location: United States
Hi,

I couldn't find any information about debugging the game. I've built from source using VS2010.

I want to change the the CTH system used in an ongoing campaign, which Flugente mentioned required debugging the game and changing values while running.

Any info on this would be greatly appreciated!
Re: Guide to debugging?[message #337131] Sat, 25 October 2014 13:05 Go to previous messageGo to next message
silversurfer

 
Messages:2301
Registered:May 2009
First you need to build a debug exe. Then you will need to run it from VS2010 (F5 or the Play button at the toolbar). I usually run the game in windowed mode for debugging so I can easily switch between applications.

To change any value you need to have a breakpoint in the code where code execution will halt and allow you to modify data. The easiest spot for your task is probably the end of function "LoadSavedGame" in "SaveLoadGame.cpp". Line 6442 (current development build 7606) contains a "return( TRUE );" statement where you set your breakpoint. Then you load your savegame and the game will break at this breakpoint.

Now in the "Watch" window you add the variable "gGameOptions.fUseNCTH". It will show you the current value next to it. 0 stands for OCTH system, 1 is for NCTH. Set whatever you like and press F5 to continue. Save your game and quit.

Now you can continue playing with the standard release exe.

Re: Guide to debugging?[message #337267] Tue, 28 October 2014 06:35 Go to previous messageGo to next message
perpetual
Messages:4
Registered:October 2014
Location: United States
Thanks for the detailed info, got it working. Cool stuff!
Re: Guide to debugging?[message #348907 is a reply to message #337131] Sat, 18 February 2017 08:10 Go to previous messageGo to next message
Slugg087

 
Messages:10
Registered:February 2017
Location: Sweden
I´m gonna necro this post since i also want to change to OCTH. I am not a programmer, i´ve just downloaded VS2010 just for this purpose. Exacly how do i build the debug.exe file?
Re: Guide to debugging?[message #352410 is a reply to message #348907] Wed, 14 February 2018 15:12 Go to previous messageGo to next message
mbr.to

 
Messages:17
Registered:February 2018
which IDE are the devs using these days?
would it work with the free visual studio community 2017?

is there any documentation for 1.13? seems like all the useful information is buried in humungous threads.

[Updated on: Wed, 14 February 2018 15:12]

Re: Guide to debugging?[message #352430 is a reply to message #352410] Thu, 15 February 2018 13:57 Go to previous message
Flugente

 
Messages:3344
Registered:April 2009
Location: Germany
@Slugg087: You build a debug exe and then start the program from VS. Or start with the exe and later attach to it. There is probably a thread on that... somewhere, but good luck finding that with the limited search function we have.

@mbr.to: VS2017 and the previous versions work.

The documentation for 1.13 is in whatever comments is in all those xmls and inis, the threads in this forum and, if you read the code, the comments there. There is also the wiki, but it is severely outdated.



“What are you doing?” Joffrey interrupted him.

“… can’t a man give a few last words for his son to carry?”

“…Who told you your son was making it out of this field alive?”

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Previous Topic: stuff id like to disable
Next Topic: Music modding query
Goto Forum:
  


Current Time: Sat Jul 21 22:36:01 EEST 2018

Total time taken to generate the page: 0.01264 seconds