Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - olizit

#1
Tools / Re: [TOOL] (A15) Mod Full Debugger
February 28, 2017, 02:44:28 PM
Sorry for my very late reply.
I've put a sample project on github https://github.com/olizit/RimWorld_RemoteDebug
Can you add this sample mod into the RimWorld, start the game with debug mode and attach to it.
When game started, add a function breakpoint inside Xamarin "When an exception is throw" to System.Exception. When game is fully loaded open in game bottom menu "Hello World". A breakpoint should be triggered.
Now you can test a standard breakpoint. Do not forget to add breakpoint in whitespace before the code.
Tell me if it's working or not !
#2
Tools / Re: [TOOL] (A15) Mod Full Debugger
October 08, 2016, 12:27:31 PM
Tutorial up to date for Visual Studio 2015
#3
Do you recommand to clone master or stable branch ?
#4
Ideas / Re: Research queue.
September 10, 2016, 03:26:31 AM
I posted a PR on github to update this mod on A14.
https://github.com/FluffierThanThou/RW_ResearchTree
#5
You can take a look on my tutorial https://ludeon.com/forums/index.php?topic=25603.0
#6
Tools / [TOOL] (A15) Mod Full Debugger
September 04, 2016, 12:45:04 PM
Procedure below allow mod developers to full debugging mod C# code.
I use Windows to create this tutorial and RimWorld v0.14.1249

Installation with Xamarin Studio (all platform)

1. Install the latest version of mono runtime http://www.mono-project.com/download/
Mono runtime install directory is named <Mono_install_path> in this tutorial.

2. Install the latest version of Xamarin studio http://www.monodevelop.com/download/. GTK# for .NET is also needed.

3. Add an Environment Variable named MONODEVELOP_SDB_TEST with value 1.
MONODEVELOP_SDB_TEST enable a menu entry in Xamarin studio: Run->Run With->Custom Command Mono Soft Debugger

4. Duplicate RimWorld game directory to create a clean install for mod develop. The newly copy is named <RimWorld_mod_install_path> in this tutorial.

5. Replace <RimWorld_mod_install_path>\RimWorld1249Win_Data\Mono\mono.dll by latest mono for RimWorld (see sources and releases section)
New mono.dll is a modified version of original mono to allow debugging. DO NOT USE THIS NEW DLL IN PRODUCTION.

6. Copy your mod and all dependencies mods in Mods folder.

7. Open mod solution file with Xamarin Studio or Visual Studio

8. Edit project settings :
a. MSBuild build engine must be checked.
b. Debug info must be enabled.
c. Add an After Build Custom Commands
Command: "<Mono_install_path>\bin\pdb2mdb.bat"  <point to output dll mod>
This step convert debugging symbol pdb file to a mdb file.
After a sucessfull build your mod Assemblies must contains 3 files <name mod>.dll <name mod>.dll.mdb and <name mod>.pdb.
d. Add a Run Execute Custom Commands.
Command: <RimWorld_mod_install_path>\<Rimworld executable>.exe

9. Create a batch file in <RimWorld_mod_install_path> to setup RimWorld execution
Set an Environment Variable to set debugging parameters
set RIMWORLD_MOD_DEBUG=--debugger-agent=transport=dt_socket,address=127.0.0.1:12345,server=y
Start RimWorld with an isolated mod config folder
<Rimworld executable>.exe -savedatafolder=Mod_SaveData

10. Start RimWorld with batch file. RimWorld is started "stuck". Actually mono runtime server debugger wait a client.

11. In Xamarin Studio click on Run->Run With->Custom Command Mono Soft Debugger
Parameters must be matched with batch file address and port.
IP: 127.0.0.1
Port: 12345
Click on Connect.
Now RimWorld load all things. Configure RimWorld to mod developement (enable mods, etc...)
Xamarin Studio is now hit breakpoints in your mod methods and you can watch variables.


Installation with Visual Studio 2015 (Windows only)

1. Install the latest version of mono runtime http://www.mono-project.com/download/
Mono runtime install directory is named <Mono_install_path> in this tutorial.

2. Install Visual Studio 2015 Tools for Unity extension https://visualstudiogallery.msdn.microsoft.com/8d26236e-4a64-4d64-8486-7df95156aba9?SRC=VSIDE

3. Duplicate RimWorld game directory to create a clean install for mod develop. The newly copy is named <RimWorld_mod_install_path> in this tutorial.

4. Replace <RimWorld_mod_install_path>\RimWorld1249Win_Data\Mono\mono.dll by latest mono for RimWorld (see sources and releases section)
New mono.dll is a modified version of original mono to allow debugging. DO NOT USE THIS NEW DLL IN PRODUCTION.

5. Copy your mod and all dependencies mods in Mods folder.

6. Open mod solution file with Visual Studio

7. Edit project settings :
a. Debug info must be enabled.
b. Add an Post-build event command line
Command: "<Mono_install_path>\bin\pdb2mdb.bat" $(TargetPath)
This step convert debugging symbol pdb file to a mdb file.
After a sucessfull build your mod Assemblies must contains 3 files <name mod>.dll <name mod>.dll.mdb and <name mod>.pdb.

8. Create a batch file in <RimWorld_mod_install_path> to setup RimWorld execution
Set an Environment Variable to set debugging parameters
set RIMWORLD_MOD_DEBUG=--debugger-agent=transport=dt_socket,address=127.0.0.1:12345,server=y
Start RimWorld with an isolated mod config folder
<Rimworld executable>.exe -savedatafolder=Mod_SaveData

9. Start RimWorld with batch file. RimWorld is started "stuck". Actually mono runtime server debugger wait a client.

10. In Visual Studio click on Debug->Attach Unity Debugger->Input IP
Parameters must be matched with batch file address and port.
IP: 127.0.0.1
Port: 12345
Click on OK.
Now RimWorld load all things. Configure RimWorld to mod developement (enable mods, etc...)
Visual Studio is now hit breakpoints in your mod methods and you can watch variables.

Sources and Releases
https://github.com/olizit/RimWorld_mono/releases

Known issues

  • Crash at exit

Tips and Tricks

  • Breakpoint must be set in whitespace before first character of instruction even if breakpoint does not work

Limitations

  • Debug command "Set next statement" is disabled (it's tricky to report code from latest mono).
  • Debug command "Step Into" do a "Step Over" instead

Feedbacks
It' a BETA tutorial. Post feedbacks if there are something wrong in this tutorial.

Help
I need help to port this toturial on Linux and Mac
#7
Ideas / Re: Research queue.
August 29, 2016, 03:51:14 PM
No A14. I don't update yet to A15.
#8
Ideas / Re: Research queue.
August 29, 2016, 03:17:59 PM
Is there a chance this mod can be updated to A14 ?
I found source here : https://github.com/FluffierThanThou/RW_ResearchTree
I try to load this mod with A14 and it fails with a "could not find" exception  :'(