Skip to content

Commit 43333b3

Browse files
committed
v3.27.11
support latest max helping hand
1 parent d2871d8 commit 43333b3

File tree

7 files changed

+32
-18
lines changed

7 files changed

+32
-18
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#if DEBUG
2+
3+
4+
namespace Celeste.Mod.SpeedrunTool.DebugTool;
5+
internal static class TestCommand {
6+
7+
[Command("test", "SpeedrunTool debug test")]
8+
public static void Test() {
9+
10+
}
11+
}
12+
#endif

SpeedrunTool/Source/Extensions/LoggerExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public static void DebugLog(this object message, LogLevel logLevel = LogLevel.In
3737

3838
try {
3939
Engine.Commands?.Log($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{Tag}] {logLevel}: {message}", color);
40-
} catch (Exception) {
40+
}
41+
catch (Exception) {
4142
// ignored
4243
}
4344
}

SpeedrunTool/Source/SaveLoad/Implements/DeepClonerUtils.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,14 @@ private static void Config() {
237237
// Clone dynData.Data
238238
if (type is { IsClass: true } objType && !DynDataUtils.IgnoreObjects.ContainsKey(sourceObj)) {
239239
bool cloned = false;
240-
240+
241+
// 对其类型及其逐层展开的根类型 T 检验 DynData<T> 里是否涉及到这个对象
241242
do {
242243
if (DynDataUtils.NotExistDynData(objType, out object dataMap)) {
243244
continue;
244245
}
245246

246-
object[] parameters = { sourceObj, null };
247+
object[] parameters = [sourceObj, null];
247248
if (false == (bool)dataMap.InvokeMethod("TryGetValue", parameters)) {
248249
continue;
249250
}
@@ -262,7 +263,8 @@ private static void Config() {
262263
}
263264
}
264265

265-
// Clone DynamicData
266+
// Clone DynamicData
267+
// 注意这个和 DynData 不是同一个东西
266268
if (DynamicData._DataMap.TryGetValue(sourceObj, out DynamicData._Data_ value) && value.Data.Count > 0) {
267269
DynamicData._DataMap.Add(clonedObj, value.DeepClone(deepCloneState));
268270
}

SpeedrunTool/Source/SaveLoad/Implements/DynDataUtils.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ namespace Celeste.Mod.SpeedrunTool.SaveLoad;
66

77
internal static class DynDataUtils {
88
// DynData
9-
private static readonly Dictionary<Type, object> CachedDataMaps = new();
10-
public static ConditionalWeakTable<object, object> IgnoreObjects = new();
11-
private static readonly HashSet<Type> IgnoreTypes = new();
9+
private static readonly Dictionary<Type, object> CachedDataMaps = [];
10+
public static ConditionalWeakTable<object, object> IgnoreObjects = [];
11+
private static readonly HashSet<Type> IgnoreTypes = [];
1212

1313
private static readonly Lazy<int> EmptyTableEntriesLength =
1414
new(() => new ConditionalWeakTable<object, object>().GetFieldValue<Array>("_entries").Length);
@@ -19,7 +19,7 @@ internal static class DynDataUtils {
1919
private static Func<object, bool> checkEmpty;
2020

2121
public static void ClearCached() {
22-
IgnoreObjects = new ConditionalWeakTable<object, object>();
22+
IgnoreObjects = [];
2323
IgnoreTypes.Clear();
2424
}
2525

@@ -29,7 +29,7 @@ public static bool NotExistDynData(Type type, out object dataMap) {
2929
return true;
3030
}
3131

32-
dataMap = GetDataMap(type);
32+
dataMap = GetDataMap(type);
3333
if (CheckEmpty(dataMap)) {
3434
IgnoreTypes.Add(type);
3535
return true;
@@ -43,16 +43,16 @@ private static bool CheckEmpty(object weakTable) {
4343
if (checkEmpty == null) {
4444
if (Type.GetType("Mono.Runtime") != null) {
4545
// Mono
46-
checkEmpty = o => o.GetFieldValue<int>("size") == 0;
46+
checkEmpty = static o => o.GetFieldValue<int>("size") == 0;
4747
}
4848
else if (weakTable.GetType().GetFieldInfo("_entries") != null) {
4949
// .net framework
50-
checkEmpty = o => o.GetFieldValue<Array>("_entries").Length == EmptyTableEntriesLength.Value &&
50+
checkEmpty = static o => o.GetFieldValue<Array>("_entries").Length == EmptyTableEntriesLength.Value &&
5151
o.GetFieldValue<int>("_freeList") == EmptyTableFreeList.Value;
5252
}
5353
else {
5454
// .net7
55-
checkEmpty = o => o.GetFieldValue("_container") is { } container && container.GetFieldValue<Array>("_entries").Length == EmptyContainerEntriesLength.Value &&
55+
checkEmpty = static o => o.GetFieldValue("_container") is { } container && container.GetFieldValue<Array>("_entries").Length == EmptyContainerEntriesLength.Value &&
5656
container.GetFieldValue<int>("_firstFreeEntry") == EmptyContainerFirstFreeEntry.Value;
5757
}
5858
}

SpeedrunTool/Source/SaveLoad/SaveLoadAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ public static void InitSlots() {
384384
#if DEBUG
385385
internal static void LogSavedValues(Level level) {
386386
System.Text.StringBuilder sb = new();
387-
387+
388388
foreach (SaveLoadAction slAction in SharedActions) {
389389
sb.Append($"\n====== {slAction.ActionDescription} ======\n");
390390
int count = 1;

SpeedrunTool/Source/SaveLoad/ThirdPartySupport/ThirdParty.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ private static void ComplexModsSupport() {
2020
}
2121

2222

23-
private static class EasyMods {
23+
private static class EasyMods {
2424

2525
internal static void Support() {
2626
CommunalHelperSupport();
@@ -46,9 +46,8 @@ private static void CrystallineHelperSupport() {
4646
SaveLoadAction.CloneModTypeFields("CrystallineHelper", "vitmod.TriggerTrigger", "collidedEntities");
4747
}
4848
private static void MaxHelpingHandSupport() {
49-
50-
SaveLoadAction.CloneModTypeFields("MaxHelpingHand", "Celeste.Mod.MaxHelpingHand.Effects.BlackholeCustomColors", "colorsMild");
51-
49+
SaveLoadAction.CloneModTypeFields("MaxHelpingHand", "Celeste.Mod.MaxHelpingHand.Effects.BlackholeCustomColors", "colorsMildOverride");
50+
SaveLoadAction.CloneModTypeFields("MaxHelpingHand", "Celeste.Mod.MaxHelpingHand.Entities.MovingFlagTouchSwitch", "flagMapping");
5251
}
5352
private static void VivHelperSupport() {
5453
if (ModUtils.GetAssembly("VivHelper") is not { }) {

SpeedrunTool/everest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- Name: SpeedrunTool
2-
Version: 3.27.10
2+
Version: 3.27.11
33
DLL: SpeedrunTool.dll
44
Dependencies:
55
- Name: Everest

0 commit comments

Comments
 (0)