feat: port aelrynth 2026.9.27.2 snapshot onto GitHub history
Overlay upstream/main (9b5e276) onto BlankenshipG main without rewriting
history. Keep origin-only Decal/plugin/docs trees. Re-apply aelrynth.com
and sibling-fork URL fixes that aelrynth git still has as tombohar links.
Co-authored-by: BlankenshipG <BlankenshipG@users.noreply.github.com>
This commit is contained in:
parent
ac0d743e16
commit
4ddbb52eb2
244 changed files with 59710 additions and 3067 deletions
69
tools/HookResolver.Core/Discovery/VtableDiscoveryService.cs
Normal file
69
tools/HookResolver.Core/Discovery/VtableDiscoveryService.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RynthCore.HookManifest.Scanning;
|
||||
using RynthCore.HookManifest.Schema;
|
||||
using RynthCore.HookResolver.Core.Disassembly;
|
||||
using RynthCore.HookResolver.Core.Offline;
|
||||
|
||||
namespace RynthCore.HookResolver.Core.Discovery;
|
||||
|
||||
public sealed record VtableMethodCandidate(
|
||||
int SlotIndex,
|
||||
int Va,
|
||||
int VtableVa,
|
||||
FunctionSnapshot Snapshot);
|
||||
|
||||
public sealed record VtableDiscoveryResult(
|
||||
string ClassName,
|
||||
int? TypeDescriptorVa,
|
||||
int ColCount,
|
||||
int VtableCount,
|
||||
IReadOnlyList<VtableMethodCandidate> Methods,
|
||||
string Summary);
|
||||
|
||||
public static class VtableDiscoveryService
|
||||
{
|
||||
public static VtableDiscoveryResult Discover(AcClientImage image, string className)
|
||||
{
|
||||
var view = image.View;
|
||||
var enumeration = RttiVtableScanner.EnumerateClass(view, className);
|
||||
|
||||
if (enumeration.TypeDescriptorVa is null)
|
||||
{
|
||||
return new VtableDiscoveryResult(className, null, 0, 0, [],
|
||||
$"Type descriptor '.?AV{className}@@' not present in .rdata.");
|
||||
}
|
||||
|
||||
if (enumeration.Vtables.Count == 0)
|
||||
{
|
||||
return new VtableDiscoveryResult(className,
|
||||
enumeration.TypeDescriptorVa, enumeration.ColVas.Count, 0, [],
|
||||
$"Type descriptor found @ 0x{enumeration.TypeDescriptorVa:X8} with " +
|
||||
$"{enumeration.ColVas.Count} COL(s) but no vtable preceded by a COL pointer.");
|
||||
}
|
||||
|
||||
var methods = enumeration.Methods
|
||||
.OrderBy(m => m.SlotIndex)
|
||||
.Select(m =>
|
||||
{
|
||||
int rva = m.Va - view.ImageBase;
|
||||
var snap = IcedDisassembler.Snapshot(view, rva);
|
||||
int vtableVa = enumeration.Vtables[0].VtableVa;
|
||||
return new VtableMethodCandidate(m.SlotIndex, m.Va, vtableVa, snap);
|
||||
})
|
||||
.ToList();
|
||||
|
||||
string summary =
|
||||
$"'{className}' → TypeDesc 0x{enumeration.TypeDescriptorVa:X8}, " +
|
||||
$"{enumeration.ColVas.Count} COL(s), {enumeration.Vtables.Count} vtable(s), " +
|
||||
$"{methods.Count} unique method(s).";
|
||||
|
||||
return new VtableDiscoveryResult(
|
||||
className,
|
||||
enumeration.TypeDescriptorVa,
|
||||
enumeration.ColVas.Count,
|
||||
enumeration.Vtables.Count,
|
||||
methods,
|
||||
summary);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue