Fix companion identification, extract offsets and vtable indices to separate file.

This commit is contained in:
Ottermandias 2023-01-16 13:02:22 +01:00
parent 79eee0e2c7
commit 4059e0630a
9 changed files with 60 additions and 22 deletions

View file

@ -400,17 +400,17 @@ internal sealed class ObjectIdentification : DataSharer, IObjectIdentifier
public static unsafe ulong KeyFromCharacterBase(CharacterBase* drawObject)
{
var type = (*(delegate* unmanaged<CharacterBase*, uint>**)drawObject)[50](drawObject);
var unk = (ulong)*((byte*)drawObject + 0x8E8) << 8;
var type = (*(delegate* unmanaged<CharacterBase*, uint>**)drawObject)[Offsets.DrawObjectGetModelTypeVfunc](drawObject);
var unk = (ulong)*((byte*)drawObject + Offsets.DrawObjectModelUnk1) << 8;
return type switch
{
1 => type | unk,
2 => type | unk | ((ulong)*(ushort*)((byte*)drawObject + 0x908) << 16),
2 => type | unk | ((ulong)*(ushort*)((byte*)drawObject + Offsets.DrawObjectModelUnk3) << 16),
3 => type
| unk
| ((ulong)*(ushort*)((byte*)drawObject + 0x8F0) << 16)
| ((ulong)**(ushort**)((byte*)drawObject + 0x910) << 32)
| ((ulong)**(ushort**)((byte*)drawObject + 0x910) << 40),
| ((ulong)*(ushort*)((byte*)drawObject + Offsets.DrawObjectModelUnk2) << 16)
| ((ulong)**(ushort**)((byte*)drawObject + Offsets.DrawObjectModelUnk4) << 32)
| ((ulong)**(ushort**)((byte*)drawObject + Offsets.DrawObjectModelUnk3) << 40),
_ => 0u,
};
}