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 Jan 16, 2025
1 parent a096080 commit 37168ce
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,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 @@ -106,7 +113,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 37168ce

Please sign in to comment.