BattletechModders / ModTek

Mod system for HBS's PC game BattleTech.
GNU Lesser General Public License v2.1
121 stars 34 forks source link

Feature Suggestion: UnityDebug support #224

Open korgano opened 1 year ago

korgano commented 1 year ago

UnityDebug is "UnityDoorstop implementation with Harmony patch that converts pdb to mdb allowing mono to read debug symbols."

This tool eliminates the need to swap out the game's mono-2.0-bdwgc.dll with a hard to obtain, potentially unstable DNSpy compatible copy, but is incompatible with ModTek. Attempting to run both at the same time results in ModTek failing to initialize and the game getting stuck in a loop as it tries to load modded saves.

This would also simplify onboarding of new modders and ensure that DNSpy debugging remains available in the future.

CptMoore commented 1 year ago

Since we already use UnitDoorstop, you can just enable debugging in the doorstop_config.ini by setting debug_enabled to true, no need to replace a mono dll.

Regarding the debug symbols patch, I myself haven't needed it, and I just tested the same harmonypatch `UnitDebug" uses on my install and it was only called once, so that doesn't sound useful:

AppDomain.Load Assembly=MonoMod.Utils.GetManagedSizeHelper, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null rawAssembly.Length=3072 rawSymbolStore.Length=

However, I could just move the debugging (+profiling) documentation to its own page and link it directly, to make it easier to find

https://github.com/BattletechModders/ModTek/blob/master/doc/DEVELOPMENT_GUIDE.md#debugging