Skip to content

Commit 639a3c2

Browse files
committed
Make clean method names option toggleable via tweak values
1 parent a840b34 commit 639a3c2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Source/Client/Desyncs/StackTraceLogItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public override string StackTraceString
6464
if (!methodNameCache.TryGetValue(addr, out string method))
6565
methodNameCache[addr] = method = Native.MethodNameFromAddr(raw[i], false);
6666

67-
builder.AppendLine(method != null ? SyncCoordinator.CleanedMethodName(method) : "Null");
67+
builder.AppendLine(method != null ? SyncCoordinator.PossiblyCleanedMethodName(method) : "Null");
6868
}
6969

7070
return builder.ToString();

Source/Client/Desyncs/SyncCoordinator.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.Linq;
55
using System.Text.RegularExpressions;
6+
using LudeonTK;
67
using RimWorld;
78
using Verse;
89
using Multiplayer.Client.Desyncs;
@@ -243,9 +244,14 @@ public void TryAddStackTraceForDesyncLogRaw(StackTraceLogItemRaw item, int depth
243244
OpinionInBuilding.desyncStackTraceHashes.Add(hash);
244245
}
245246

246-
private static readonly Regex RemoveUnknownSourceInfoRegex = new(@"in <([a-zA-Z0-9]+)>:0");
247-
public static string CleanedMethodName(string rawName)
247+
[TweakValue("Multiplayer")]
248+
public static bool cleanMethodNames = false;
249+
250+
private static readonly Regex RemoveUnknownSourceInfoRegex = new("in <([a-zA-Z0-9]+)>:0");
251+
public static string PossiblyCleanedMethodName(string rawName)
248252
{
253+
if (!cleanMethodNames) return MethodNameWithIL(rawName);
254+
249255
// at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.RimWorld.UniqueIDsManager.GetNextID_Patch2 ...
250256
// =>
251257
// at (wrapper dynamic-method) RimWorld.UniqueIDsManager.GetNextID_Patch2 ...

0 commit comments

Comments
 (0)