Update for 5.1

This commit is contained in:
goat 2019-11-01 16:30:53 +09:00
parent 4ad5bee0c6
commit 545757d406
9 changed files with 100 additions and 28 deletions

View file

@ -158,8 +158,8 @@ namespace Dalamud {
HelpMessage = "Unmute a word or sentence. Usage: /fatewatchremove <word or sentence>" HelpMessage = "Unmute a word or sentence. Usage: /fatewatchremove <word or sentence>"
}); });
CommandManager.AddHandler("/xldactortable", new CommandInfo(OnDebugActorTable) { CommandManager.AddHandler("/xldstate", new CommandInfo(OnDebugPrintGameState) {
HelpMessage = "Actor table operations", HelpMessage = "Print parsed game state",
ShowInHelp = false ShowInHelp = false
}); });
@ -318,11 +318,13 @@ namespace Dalamud {
Process.Start(ChatHandlers.LastLink); Process.Start(ChatHandlers.LastLink);
} }
private void OnDebugActorTable(string command, string arguments) { private void OnDebugPrintGameState(string command, string arguments) {
Framework.Gui.Chat.Print(this.ClientState.Actors.Length + " entries"); Framework.Gui.Chat.Print(this.ClientState.Actors.Length + " entries");
Framework.Gui.Chat.Print(this.ClientState.LocalPlayer.Name); Framework.Gui.Chat.Print(this.ClientState.LocalPlayer.Name);
Framework.Gui.Chat.Print(this.ClientState.LocalPlayer.CurrentWorld.Name); Framework.Gui.Chat.Print(this.ClientState.LocalPlayer.CurrentWorld.Name);
Framework.Gui.Chat.Print(this.ClientState.LocalPlayer.HomeWorld.Name);
Framework.Gui.Chat.Print(this.ClientState.LocalContentId.ToString("X")); Framework.Gui.Chat.Print(this.ClientState.LocalContentId.ToString("X"));
Framework.Gui.Chat.Print(Framework.Gui.Chat.LastLinkedItemId.ToString());
for (var i = 0; i < this.ClientState.Actors.Length; i++) { for (var i = 0; i < this.ClientState.Actors.Length; i++) {
var actor = this.ClientState.Actors[i]; var actor = this.ClientState.Actors[i];
@ -369,7 +371,6 @@ namespace Dalamud {
continue; continue;
this.Configuration.ComboPresets |= value; this.Configuration.ComboPresets |= value;
Framework.Gui.Chat.Print(argumentsParts[1] + " SET");
} }
} }
break; break;
@ -379,7 +380,6 @@ namespace Dalamud {
continue; continue;
this.Configuration.ComboPresets ^= value; this.Configuration.ComboPresets ^= value;
Framework.Gui.Chat.Print(argumentsParts[1] + " TOGGLE");
} }
} }
break; break;
@ -390,7 +390,6 @@ namespace Dalamud {
continue; continue;
this.Configuration.ComboPresets &= ~value; this.Configuration.ComboPresets &= ~value;
Framework.Gui.Chat.Print(argumentsParts[1] + " UNSET");
} }
} }
break; break;

View file

@ -21,7 +21,7 @@
<None Include="$(SolutionDir)/Resources/**/*" CopyToOutputDirectory="PreserveNewest" Visible="false" /> <None Include="$(SolutionDir)/Resources/**/*" CopyToOutputDirectory="PreserveNewest" Visible="false" />
</ItemGroup> </ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>E:\Sapphire\recorder\FFXIV.Recorder\/bin\Dalamud.xml</DocumentationFile> <DocumentationFile></DocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DocumentationFile>E:\Sapphire\recorder\FFXIV.Recorder\/bin\Dalamud.xml</DocumentationFile> <DocumentationFile>E:\Sapphire\recorder\FFXIV.Recorder\/bin\Dalamud.xml</DocumentationFile>

View file

@ -13,8 +13,8 @@ namespace Dalamud.Game.ClientState
public IntPtr JobGaugeData { get; set; } public IntPtr JobGaugeData { get; set; }
protected override void Setup64Bit(SigScanner sig) { protected override void Setup64Bit(SigScanner sig) {
ActorTable = sig.Module.BaseAddress + 0x1B29B40; ActorTable = sig.Module.BaseAddress + 0x1C01D90;
LocalContentId = sig.Module.BaseAddress + 0x1B58B60; LocalContentId = sig.Module.BaseAddress + 0x1C2E000;
JobGaugeData = sig.Module.BaseAddress + 0x1BFD110; JobGaugeData = sig.Module.BaseAddress + 0x1BFD110;
} }
} }

View file

@ -20,13 +20,13 @@ namespace Dalamud.Game.ClientState.Structs
[FieldOffset(140)] public ObjectKind ObjectKind; [FieldOffset(140)] public ObjectKind ObjectKind;
[FieldOffset(141)] public byte SubKind; [FieldOffset(141)] public byte SubKind;
[FieldOffset(160)] public Position3 Position; [FieldOffset(160)] public Position3 Position;
[FieldOffset(6296)] public byte CurrentWorld; [FieldOffset(6308)] public byte CurrentWorld;
[FieldOffset(6298)] public byte HomeWorld; [FieldOffset(6310)] public byte HomeWorld;
[FieldOffset(6308)] public int CurrentHp; [FieldOffset(6328)] public int CurrentHp;
[FieldOffset(6312)] public int MaxHp; [FieldOffset(6332)] public int MaxHp;
[FieldOffset(6316)] public int CurrentMp; [FieldOffset(6336)] public int CurrentMp;
[FieldOffset(6320)] public int MaxMp; [FieldOffset(6340)] public int MaxMp;
[FieldOffset(6364)] public byte ClassJob; [FieldOffset(6388)] public byte ClassJob;
[FieldOffset(6366)] public byte Level; [FieldOffset(6390)] public byte Level;
} }
} }

View file

@ -76,13 +76,18 @@ namespace Dalamud.Game.Internal.Gui {
*/ */
protected override void Setup64Bit(SigScanner sig) { protected override void Setup64Bit(SigScanner sig) {
PrintMessage = sig.ScanText("4055 57 41 ?? 41 ?? 488DAC24D8FEFFFF 4881EC28020000 488B05???????? 4833C4 488985F0000000 4532D2 48894C2448"); //PrintMessage = sig.ScanText("4055 57 41 ?? 41 ?? 488DAC24D8FEFFFF 4881EC28020000 488B05???????? 4833C4 488985F0000000 4532D2 48894C2448"); LAST PART FOR 5.1???
PrintMessage =
sig.ScanText(
"4055 57 41 ?? 41 ?? 4157488DAC24E0FE FFFF4881EC2002 0000488B05???? ????48 33C4488985F000 000045 32D248894C2448");
//PrintMessage = sig.ScanText("4055 57 41 ?? 41 ?? 488DAC24E8FEFFFF 4881EC18020000 488B05???????? 4833C4 488985E0000000 4532D2 48894C2438"); old //PrintMessage = sig.ScanText("4055 57 41 ?? 41 ?? 488DAC24E8FEFFFF 4881EC18020000 488B05???????? 4833C4 488985E0000000 4532D2 48894C2438"); old
//PrintMessage = sig.ScanText("40 55 57 41 56 41 57 48 8D AC 24 D8 FE FF FF 48 81 EC 28 02 00 00 48 8B 05 63 47 4A 01 48 33 C4 48 89 85 F0 00 00 00 45 32 D2 48 89 4C 24 48 33"); //PrintMessage = sig.ScanText("40 55 57 41 56 41 57 48 8D AC 24 D8 FE FF FF 48 81 EC 28 02 00 00 48 8B 05 63 47 4A 01 48 33 C4 48 89 85 F0 00 00 00 45 32 D2 48 89 4C 24 48 33");
//PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 FA F2 B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A"); //PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 FA F2 B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A");
PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 ?? ?? B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A");
//PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 ?? ?? B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A"); 5.0
PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 7A 12 AF FF 8B C8 EB 1D 0F B6 42 14 8B 4A");
} }
} }
} }

View file

@ -87,7 +87,6 @@ namespace Dalamud.Game.Internal.Gui {
// TODO: this is currently broken // TODO: this is currently broken
// As it stands, don't rely on localCharacter.level for anything. // As it stands, don't rely on localCharacter.level for anything.
/*
if (localCharacter == null) { if (localCharacter == null) {
try { try {
localCharacter = dalamud.ClientState.LocalPlayer; localCharacter = dalamud.ClientState.LocalPlayer;
@ -97,14 +96,12 @@ namespace Dalamud.Game.Internal.Gui {
return this.iconHook.Original(self, actionID); return this.iconHook.Original(self, actionID);
} }
} }
*/
// Don't clutter the spaghetti any worse than it already is. // Don't clutter the spaghetti any worse than it already is.
int lastMove = Marshal.ReadInt32(lastComboMove); var lastMove = Marshal.ReadInt32(this.lastComboMove);
float comboTime = (float)Marshal.ReadInt32(comboTimer); var comboTime = Marshal.ReadInt32(this.comboTimer);
//localCharacter = dalamud.ClientState.LocalPlayer; this.localCharacter = this.dalamud.ClientState.LocalPlayer;
//byte level = localCharacter.Level; var level = this.localCharacter.Level;
byte level = 80;
// DRAGOON // DRAGOON
// TODO: Jump/High Jump into Mirage Dive // TODO: Jump/High Jump into Mirage Dive

View file

@ -0,0 +1,55 @@
using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.Actors.Types;
using Dalamud.Game.ClientState.Structs.JobGauge;
using Dalamud.Hooking;
using Serilog;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using XIVLauncher.Dalamud;
namespace Dalamud.Game.Internal.Gui {
public class TargetManager {
public delegate IntPtr GetTargetDelegate(IntPtr manager);
private Hook<GetTargetDelegate> getTargetHook;
private TargetManagerAddressResolver Address;
public unsafe TargetManager(Dalamud dalamud, SigScanner scanner) {
this.Address = new TargetManagerAddressResolver();
this.Address.Setup(scanner);
Log.Verbose("===== T A R G E T M A N A G E R =====");
Log.Verbose("GetTarget address {GetTarget}", Address.GetTarget);
this.getTargetHook = new Hook<GetTargetDelegate>(this.Address.GetTarget, new GetTargetDelegate(GetTargetDetour), this);
}
public void Enable() {
this.getTargetHook.Enable();
}
public void Dispose() {
this.getTargetHook.Dispose();
}
private IntPtr GetTargetDetour(IntPtr manager)
{
try {
var res = this.getTargetHook.Original(manager);
var test = Marshal.ReadInt32(res);
Log.Debug($"GetTargetDetour {manager.ToInt64():X} -> RET: {res:X}");
return res;
}
catch (Exception ex)
{
Log.Error(ex, "Exception GetTargetDetour hook.");
return this.getTargetHook.Original(manager);
}
}
}
}

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dalamud.Game.Internal.Gui {
class TargetManagerAddressResolver : BaseAddressResolver {
public IntPtr GetTarget { get; private set; }
protected override void Setup64Bit(SigScanner sig) {
this.GetTarget = sig.ScanText("40 57 48 83 EC 40 48 8B F9 48 8B 49 08 48 8B 01 FF 50 40 66 83 B8 CA 81 00 00 00 74 33 48 8B 4F 08 48 8B 01 FF 50 40 66 83 B8 CA 81 00 00 04 74");
}
}
}

View file

@ -5,7 +5,8 @@ namespace Dalamud.Game.Internal.Network {
public IntPtr ProcessZonePacket { get; private set; } public IntPtr ProcessZonePacket { get; private set; }
protected override void Setup64Bit(SigScanner sig) { protected override void Setup64Bit(SigScanner sig) {
ProcessZonePacket = sig.ScanText("48 89 74 24 18 57 48 83 EC 50 8B F2 49 8B F8 41 0F B7 50 02 8B CE E8 ?? ?? 7A FF 0F B7 57 02 8D 42 89 3D 5F 02 00 00 0F 87 60 01 00 00 4C 8D 05"); //ProcessZonePacket = sig.ScanText("48 89 74 24 18 57 48 83 EC 50 8B F2 49 8B F8 41 0F B7 50 02 8B CE E8 ?? ?? 7A FF 0F B7 57 02 8D 42 89 3D 5F 02 00 00 0F 87 60 01 00 00 4C 8D 05");
ProcessZonePacket = sig.ScanText("48 89 74 24 18 57 48 83 EC 50 8B F2 49 8B F8 41 0F B7 50 02 8B CE E8 ?? ?? 73 FF 0F B7 57 02 8D 42 ?? 3D ?? ?? 00 00 0F 87 60 01 00 00 4C 8D 05");
} }
} }
} }