mirror of
https://github.com/awgil/ffxiv_reverse.git
synced 2025-04-22 06:57:44 +00:00
SpawnObject reversing.
This commit is contained in:
parent
855a6204de
commit
9bc55b834b
3 changed files with 57 additions and 2 deletions
|
@ -4,7 +4,6 @@ using System.Numerics;
|
|||
using Netlog.ServerIPC;
|
||||
using System.Text;
|
||||
using Dalamud.Memory;
|
||||
using Dalamud.Utility;
|
||||
|
||||
namespace Netlog;
|
||||
|
||||
|
@ -159,7 +158,7 @@ public unsafe class PacketDecoder
|
|||
{
|
||||
var details = category switch
|
||||
{
|
||||
ActorControlCategory.CancelCast => $"{ActionStr((ActionType)p2, p3)}, interrupted={p4 == 1}", // note: some successful boss casts have this message on completion, seen param1=param4=0, param2=1; param1 is related to cast time?..
|
||||
ActorControlCategory.CancelCast => $"{LogMsgStr(p1)}; action={ActionStr((ActionType)p2, p3)}, interrupted={p4 == 1}", // note: some successful boss casts have this message on completion
|
||||
ActorControlCategory.RecastDetails => $"group {p1}: {p2 * 0.01f:f2}/{p3 * 0.01f:f2}s",
|
||||
ActorControlCategory.Cooldown => $"group {p1}: action={ActionStr(ActionType.Spell, p2)}, time={p3 * 0.01f:f2}s",
|
||||
ActorControlCategory.GainEffect => $"{StatusStr(p1)}: extra={p2:X4}",
|
||||
|
@ -229,6 +228,16 @@ public unsafe class PacketDecoder
|
|||
return res;
|
||||
}
|
||||
|
||||
public TextNode DecodeSpawnObject(SpawnObject* p)
|
||||
{
|
||||
var res = new TextNode($"#{p->Index} {p->DataID:X} <{p->InstanceID:X}>");
|
||||
res.AddChild($"Kind={p->Kind}, u2={p->u2_state}, u3={p->u3}, u20={p->u20}, tail={p->u3C:X2} {p->u3E:X2}");
|
||||
res.AddChild($"LevelID={p->u_levelID}, GimmickID={p->u_gimmickID}, DutyID={p->DutyID}, FateID={p->FateID}");
|
||||
res.AddChild($"Pos={Vec3Str(p->Position)}, Rot={IntToFloatAngleDeg(p->Rotation):f1}deg, Scale={p->Scale:f3}");
|
||||
res.AddChild($"Model={p->u_modelID}, EState={p->EventState}, EObjState={p->EventObjectState}");
|
||||
return res;
|
||||
}
|
||||
|
||||
public TextNode DecodeUpdateClassInfo(UpdateClassInfo* p, string extra = "") => new($"L{p->CurLevel}/{p->ClassLevel}/{p->SyncedLevel} {ClassJobAbbrev(p->ClassID)}, exp={p->CurExp}+{p->RestedExp}{extra}");
|
||||
|
||||
public TextNode DecodeWaymarkPreset(WaymarkPreset* p)
|
||||
|
@ -275,6 +284,7 @@ public unsafe class PacketDecoder
|
|||
PacketID.ActorCast when (ActorCast*)payload is var p => DecodeActorCast(p),
|
||||
PacketID.UpdateHate when (UpdateHate*)payload is var p => DecodeUpdateHate(p),
|
||||
PacketID.UpdateHater when (UpdateHater*)payload is var p => DecodeUpdateHater(p),
|
||||
PacketID.SpawnObject when (SpawnObject*)payload is var p => DecodeSpawnObject(p),
|
||||
PacketID.UpdateClassInfo when (UpdateClassInfo*)payload is var p => DecodeUpdateClassInfo(p),
|
||||
PacketID.UpdateClassInfoEureka when (UpdateClassInfoEureka*)payload is var p => DecodeUpdateClassInfo(&p->Data, $", rank={p->Rank}/{p->Element}/{p->u2}, pad={p->pad3:X2}"),
|
||||
PacketID.UpdateClassInfoBozja when (UpdateClassInfoBozja*)payload is var p => DecodeUpdateClassInfo(&p->Data, $", rank={p->Rank}, pad={p->pad1:X2}{p->pad2:X4}"),
|
||||
|
|
|
@ -71,6 +71,25 @@ unsafe class PacketInterceptor : IDisposable
|
|||
TargetString = PacketDecoder.ObjStr(outData->IPC->TargetActor),
|
||||
PayloadStrings = decoded ?? new(PacketDecoder.ByteArrayStr(payloadStart, payloadSize))
|
||||
});
|
||||
|
||||
// HACK for replacing sastasha's shortcut eobj with custom (eg wormholes), then open recommendations actor control with eobjanim
|
||||
//if (opcode == 0x02D1 && *(uint*)(payloadStart + 4) == 0x1EB0CF)
|
||||
//{
|
||||
// Service.LogError($"foo doing rep {*(uint*)(payloadStart + 0x2C)}");
|
||||
// *(uint*)(payloadStart + 4) = 0x1EA1E1;
|
||||
// *(uint*)(payloadStart + 0x2C) = 0;
|
||||
// _hackID = *(uint*)(payloadStart + 8);
|
||||
//}
|
||||
//if (opcode == 0x0256 && *(ushort*)payloadStart == 512 && _hackID != 0)
|
||||
//{
|
||||
// Service.LogError($"replacing openrecs for {_hackID:X}");
|
||||
// outData->IPC->SourceActor = _hackID;
|
||||
// outData->IPC->TargetActor = _hackID;
|
||||
// *(ushort*)payloadStart = 413;
|
||||
// *(uint*)(payloadStart + 4) = 1;
|
||||
// *(uint*)(payloadStart + 8) = 2;
|
||||
// _hackID = 0;
|
||||
//}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using FFXIVClientStructs.FFXIV.Common.Math;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -741,6 +742,31 @@ public unsafe struct UpdateHater
|
|||
public uint pad3;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public unsafe struct SpawnObject
|
||||
{
|
||||
public byte Index;
|
||||
public byte Kind;
|
||||
public byte u2_state;
|
||||
public byte u3;
|
||||
public uint DataID;
|
||||
public uint InstanceID;
|
||||
public uint u_levelID;
|
||||
public uint DutyID;
|
||||
public uint OwnerID;
|
||||
public uint u_gimmickID;
|
||||
public float Scale;
|
||||
public ushort u20;
|
||||
public ushort Rotation;
|
||||
public ushort FateID;
|
||||
public ushort EventState; // for common gameobject field
|
||||
public uint EventObjectState; // for eventobject-specific field
|
||||
public uint u_modelID;
|
||||
public Vector3 Position;
|
||||
public ushort u3C;
|
||||
public ushort u3E;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public unsafe struct UpdateClassInfo
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue