Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions 渔人的直感/Models/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public static class Data

private static IntPtr eventFrameworkPtrAddress;
private static IntPtr eventFrameworkPtr => _scanner.ReadIntPtr(eventFrameworkPtrAddress);
private static short eventInfoOffset;

private static short contentDirectorOffset;
private static short oceanFishingTimeOffsetOffset;
private static short oceanFishingCurrentZoneOffset;
Expand Down Expand Up @@ -86,13 +88,12 @@ public static void Initialize(SigScanner scanner)
conditionPtr = scanner.GetStaticAddressFromSig("48 8D 0D ? ? ? ? 45 33 C0 4C 8B F0", 3);

//获取EventFrameworkPtr
eventFrameworkPtrAddress = scanner.GetStaticAddressFromSig("48 8B 35 ?? ?? ?? ?? 0F B6 EA 4C 8B F1", 3);
// eventFrameworkPtrAddress = scanner.GetStaticAddressFromSig("48 83 3D ?? ?? ?? ?? ?? 44 0F B6 F0", 3);
eventFrameworkPtrAddress = scanner.GetStaticAddressFromSig("4C 39 2D ?? ?? ?? ?? 74 14", 3);

//获取Offset相关

var contentDirectoryAddress = scanner.ScanText("48 83 B9 ? ? ? ? ? 74 ? B0 ? C3 48 8B 81"); // 国服6.57
if (contentDirectoryAddress == IntPtr.Zero)
contentDirectoryAddress = scanner.ScanText("48 83 B9 ?? ?? ?? ?? ?? 75 ?? 48 8B 81"); // 国际服 7.0
eventInfoOffset = scanner.ReadInt16(scanner.ScanText("48 8B 88 ? ? ? ? BA ? ? ? ? 66 39 51 ? 75 ? F6 80"), 3);

var contentDirectoryAddress = scanner.ScanText("48 83 B9 ?? ?? ?? ?? ?? 75 ?? 48 8B 81"); // 国服6.57

contentDirectorOffset = scanner.ReadInt16(contentDirectoryAddress, 3);

Expand All @@ -105,9 +106,7 @@ public static void Initialize(SigScanner scanner)

contentDirectorTypeOffset = scanner.ReadInt16(scanner.ScanText("80 B8 ?? ?? ?? ?? ?? 75 ?? 83 FB ?? 73 ?? 0F B7 84 58"), 2);

var uiStatusEffectstAddress = scanner.ScanText("48 8D 81 ? ? ? ? C3 CC CC CC CC CC CC CC CC 48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 33 F6 48 8B D9"); // 国服6.57
if (uiStatusEffectstAddress == IntPtr.Zero)
uiStatusEffectstAddress = scanner.ScanText("48 8D 81 ? ? ? ? C3 CC CC CC CC CC CC CC CC 48 8B 41"); // 国际服7.0
var uiStatusEffectstAddress = scanner.ScanText("48 8D 81 ? ? ? ? C3 CC CC CC CC CC CC CC CC 48 8B 41");

UiStatusEffects = scanner.ReadInt32(uiStatusEffectstAddress, 3);

Expand All @@ -127,24 +126,27 @@ public static void Initialize(SigScanner scanner)
private static IntPtr GetInstanceContentDirector()
{
//找不到EventFrameworkPtr
if (eventFrameworkPtr == IntPtr.Zero)
var eventFramework = eventFrameworkPtr;

if (eventFramework == IntPtr.Zero)
{
Debug.WriteLine("Invalid eventFrameworkPtr");

return IntPtr.Zero;
}

var directorPtr = _scanner.ReadIntPtr(eventFrameworkPtr + contentDirectorOffset);
var directorPtr = _scanner.ReadIntPtr(eventFramework + contentDirectorOffset);

//找不到ContentDirector
if (directorPtr == IntPtr.Zero)
{
Debug.WriteLine("Invalid directorPtr");
return IntPtr.Zero;
}

//检查Director类型是否为InstanceContent. 下面这个也可以
// var directorType = _scanner.ReadInt16(_scanner.ReadIntPtr(directorPtr + eventInfoOffset), 2);
//这个是从FFXivClientStructs里看到的,应该不会变的吧
var directorType = BitConverter.ToUInt16(_scanner.ReadBytes(directorPtr + 0x22, 2), 0);
//检查Director类型是否为InstanceContent
var directorType = _scanner.ReadUInt16(_scanner.ReadIntPtr(directorPtr + eventInfoOffset), 2);

if (directorType != 0x8003)
{
Debug.WriteLine("Invalid director type");
Expand All @@ -168,4 +170,4 @@ public struct SpecialWeather
public string Name;
public float Duration;
}
}
}
4 changes: 3 additions & 1 deletion 渔人的直感/Models/SigScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Linq;
using System.Runtime.InteropServices;


namespace 渔人的直感.Models
{
/// <summary>
Expand Down Expand Up @@ -112,6 +111,9 @@ public byte[] ReadBytes(IntPtr offset, uint length)

public short ReadInt16(IntPtr address, int offset = 0) => BitConverter.ToInt16(ReadBytes(IntPtr.Add(address, offset), 2), 0);

public ushort ReadUInt16(IntPtr address, int offset = 0)
=> BitConverter.ToUInt16(ReadBytes(IntPtr.Add(address, offset), 2), 0);

public byte ReadByte(IntPtr address, int offset = 0) => ReadBytes(IntPtr.Add(address, offset), 1)[0];

public float ReadFloat(IntPtr address, int offset = 0) => BitConverter.ToSingle(ReadBytes(IntPtr.Add(address, offset), 4), 0);
Expand Down
Loading