Skip to content

Commit

Permalink
Use a more precise hook for freeze positions
Browse files Browse the repository at this point in the history
  • Loading branch information
AsgardXIV committed Jan 1, 2024
1 parent ffe53e3 commit 64799f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
15 changes: 3 additions & 12 deletions Anamnesis/Actor/Posing/Services/PoseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public class PoseService : ServiceBase<PoseService>
private NopHookViewModel? freezePhysics3;
private NopHookViewModel? freezeWorldPosition;
private NopHookViewModel? freezeWorldRotation;
private NopHookViewModel? freezeGposeTargetPosition1;
private NopHookViewModel? freezeGposeTargetPosition2;
private NopHookViewModel? freezeGposeTargetPosition;

private bool isEnabled;

Expand Down Expand Up @@ -122,8 +121,7 @@ public bool FreezeWorldPosition
{
this.freezeWorldPosition?.SetEnabled(value);
this.freezeWorldRotation?.SetEnabled(value);
this.freezeGposeTargetPosition1?.SetEnabled(value);
this.freezeGposeTargetPosition2?.SetEnabled(value);
this.freezeGposeTargetPosition?.SetEnabled(value);
this.RaisePropertyChanged(nameof(PoseService.FreezeWorldPosition));
this.RaisePropertyChanged(nameof(PoseService.WorldPositionNotFrozen));
FreezeWorldPositionsEnabledChanged?.Invoke(this.IsEnabled);
Expand All @@ -150,14 +148,7 @@ public override async Task Initialize()
this.freezePhysics3 = new NopHookViewModel(AddressService.SkeletonFreezePhysics3, 4);
this.freezeWorldPosition = new NopHookViewModel(AddressService.WorldPositionFreeze, 16);
this.freezeWorldRotation = new NopHookViewModel(AddressService.WorldRotationFreeze, 4);

// We need to keep the MOV in the middle here otherwise we invalidate the ptr, but we patch the rest:
// MOVSS dword ptr[RCX + 0xa0],XMM1
// MOV RBX,RCX
// MOVSS dword ptr[RCX + 0xa4],XMM2
// MOVSS dword ptr[RCX + 0xa8],XMM3
this.freezeGposeTargetPosition1 = new NopHookViewModel(AddressService.GPoseCameraTargetPositionFreeze, 8);
this.freezeGposeTargetPosition2 = new NopHookViewModel(AddressService.GPoseCameraTargetPositionFreeze + 8 + 3, 16);
this.freezeGposeTargetPosition = new NopHookViewModel(AddressService.GPoseCameraTargetPositionFreeze, 5);

GposeService.GposeStateChanged += this.OnGposeStateChanged;

Expand Down
2 changes: 1 addition & 1 deletion Anamnesis/Core/Memory/AddressService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private async Task Scan()
tasks.Add(this.GetAddressFromTextSignature("SkeletonFreezePosition2", "43 0f 29 24 18", (p) => { SkeletonFreezePosition2 = p; })); // SkeletonAddress7
tasks.Add(this.GetAddressFromTextSignature("WorldPositionFreeze", "F3 0F 11 78 ?? F3 0F 11 70 ?? F3 44 0F 11 40 ?? 48 83 48 ?? 02", (p) => { WorldPositionFreeze = p; }));
tasks.Add(this.GetAddressFromTextSignature("WorldRotationFreeze", "0F 11 40 ?? 48 8B 8B ?? ?? ?? ?? 0F B6 81 ?? ?? ?? ?? 24 0F 3C 03 75 ?? 48 8B 01 B2 01 FF 50 ?? 48 8B 83 ?? ?? ?? ??", (p) => { WorldRotationFreeze = p; }));
tasks.Add(this.GetAddressFromTextSignature("GPoseCameraTargetPositionFreeze", "F3 0F 11 89 ?? ?? ?? ?? 48 8B D9 F3 0F 11 91 ?? ?? ?? ??", (p) => { GPoseCameraTargetPositionFreeze = p; }));
tasks.Add(this.GetAddressFromTextSignature("GPoseCameraTargetPositionFreeze", "F3 0F 10 0E E8 ?? ?? ?? ?? 4C 8B 74 24", (p) => { GPoseCameraTargetPositionFreeze = p + 4; }));
tasks.Add(this.GetAddressFromTextSignature("AnimationSpeedPatch", "F3 0F 11 94 ?? ?? ?? ?? ?? 80 89 ?? ?? ?? ?? 01", (p) => { AnimationSpeedPatch = p; }));
tasks.Add(this.GetAddressFromSignature("Territory", "8B 1D ?? ?? ?? ?? 0F 45 D8 39 1D", 2, (p) => { Territory = p; }));
tasks.Add(this.GetAddressFromSignature("Weather", "49 8B 9D ?? ?? ?? ?? 48 8D 0D", 0, (p) => { Weather = p + 0x8; }));
Expand Down

0 comments on commit 64799f3

Please sign in to comment.