Skip to content

Commit

Permalink
Fix issue finding GetFieldDefaultValue on 2021.3.23
Browse files Browse the repository at this point in the history
  • Loading branch information
limoka committed May 7, 2023
1 parent 18e58ef commit 4e6132e
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ internal unsafe class Class_GetFieldDefaultValue_Hook : Hook<Class_GetFieldDefau
mask = "xxxxxxxx????xxxxxxx",
xref = false
},
// Idle Slayer - Unity 2021.3.23 (x64)
new MemoryUtils.SignatureDefinition
{
pattern = "\x40\x53\x48\x83\xEC\x20\x48\x8B\xDA\xE8\xCC\xCC\xCC\xCC\x4C",
mask = "xxxxxxxxxx????x",
xref = false
}
};

private static nint FindClassGetFieldDefaultValueXref(bool forceICallMethod = false)
Expand Down Expand Up @@ -91,7 +98,11 @@ private static nint FindClassGetFieldDefaultValueXref(bool forceICallMethod = fa
var getStaticFieldValue = XrefScannerLowLevel.JumpTargets(getStaticFieldValueAPI).Single();
Logger.Instance.LogTrace("Field::StaticGetValue: 0x{GetStaticFieldValueAddress}", getStaticFieldValue.ToInt64().ToString("X2"));

var getStaticFieldValueInternal = XrefScannerLowLevel.JumpTargets(getStaticFieldValue).Last();
var getStaticFieldValueTargets = XrefScannerLowLevel.JumpTargets(getStaticFieldValue).ToArray();
if (getStaticFieldValueTargets.Length > 4)
return getStaticFieldValueTargets[^2];

var getStaticFieldValueInternal = getStaticFieldValueTargets.Last();
Logger.Instance.LogTrace("Field::StaticGetValueInternal: 0x{GetStaticFieldValueInternalAddress}", getStaticFieldValueInternal.ToInt64().ToString("X2"));

var getStaticFieldValueInternalTargets = XrefScannerLowLevel.JumpTargets(getStaticFieldValueInternal).ToArray();
Expand Down

0 comments on commit 4e6132e

Please sign in to comment.