Skip to content

Commit ee70e29

Browse files
authored
适配7.1 (#19)
* Update Common.cs * 7.1
1 parent 3f10838 commit ee70e29

2 files changed

Lines changed: 21 additions & 17 deletions

File tree

渔人的直感/Models/Common.cs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public static class Data
2424

2525
private static IntPtr eventFrameworkPtrAddress;
2626
private static IntPtr eventFrameworkPtr => _scanner.ReadIntPtr(eventFrameworkPtrAddress);
27+
private static short eventInfoOffset;
28+
2729
private static short contentDirectorOffset;
2830
private static short oceanFishingTimeOffsetOffset;
2931
private static short oceanFishingCurrentZoneOffset;
@@ -86,13 +88,12 @@ public static void Initialize(SigScanner scanner)
8688
conditionPtr = scanner.GetStaticAddressFromSig("48 8D 0D ? ? ? ? 45 33 C0 4C 8B F0", 3);
8789

8890
//获取EventFrameworkPtr
89-
eventFrameworkPtrAddress = scanner.GetStaticAddressFromSig("48 8B 35 ?? ?? ?? ?? 0F B6 EA 4C 8B F1", 3);
90-
// eventFrameworkPtrAddress = scanner.GetStaticAddressFromSig("48 83 3D ?? ?? ?? ?? ?? 44 0F B6 F0", 3);
91+
eventFrameworkPtrAddress = scanner.GetStaticAddressFromSig("4C 39 2D ?? ?? ?? ?? 74 14", 3);
92+
9193
//获取Offset相关
92-
93-
var contentDirectoryAddress = scanner.ScanText("48 83 B9 ? ? ? ? ? 74 ? B0 ? C3 48 8B 81"); // 国服6.57
94-
if (contentDirectoryAddress == IntPtr.Zero)
95-
contentDirectoryAddress = scanner.ScanText("48 83 B9 ?? ?? ?? ?? ?? 75 ?? 48 8B 81"); // 国际服 7.0
94+
eventInfoOffset = scanner.ReadInt16(scanner.ScanText("48 8B 88 ? ? ? ? BA ? ? ? ? 66 39 51 ? 75 ? F6 80"), 3);
95+
96+
var contentDirectoryAddress = scanner.ScanText("48 83 B9 ?? ?? ?? ?? ?? 75 ?? 48 8B 81"); // 国服6.57
9697

9798
contentDirectorOffset = scanner.ReadInt16(contentDirectoryAddress, 3);
9899

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

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

108-
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
109-
if (uiStatusEffectstAddress == IntPtr.Zero)
110-
uiStatusEffectstAddress = scanner.ScanText("48 8D 81 ? ? ? ? C3 CC CC CC CC CC CC CC CC 48 8B 41"); // 国际服7.0
109+
var uiStatusEffectstAddress = scanner.ScanText("48 8D 81 ? ? ? ? C3 CC CC CC CC CC CC CC CC 48 8B 41");
111110

112111
UiStatusEffects = scanner.ReadInt32(uiStatusEffectstAddress, 3);
113112

@@ -127,24 +126,27 @@ public static void Initialize(SigScanner scanner)
127126
private static IntPtr GetInstanceContentDirector()
128127
{
129128
//找不到EventFrameworkPtr
130-
if (eventFrameworkPtr == IntPtr.Zero)
129+
var eventFramework = eventFrameworkPtr;
130+
131+
if (eventFramework == IntPtr.Zero)
131132
{
132133
Debug.WriteLine("Invalid eventFrameworkPtr");
134+
133135
return IntPtr.Zero;
134136
}
135137

136-
var directorPtr = _scanner.ReadIntPtr(eventFrameworkPtr + contentDirectorOffset);
138+
var directorPtr = _scanner.ReadIntPtr(eventFramework + contentDirectorOffset);
139+
137140
//找不到ContentDirector
138141
if (directorPtr == IntPtr.Zero)
139142
{
140143
Debug.WriteLine("Invalid directorPtr");
141144
return IntPtr.Zero;
142145
}
143146

144-
//检查Director类型是否为InstanceContent. 下面这个也可以
145-
// var directorType = _scanner.ReadInt16(_scanner.ReadIntPtr(directorPtr + eventInfoOffset), 2);
146-
//这个是从FFXivClientStructs里看到的,应该不会变的吧
147-
var directorType = BitConverter.ToUInt16(_scanner.ReadBytes(directorPtr + 0x22, 2), 0);
147+
//检查Director类型是否为InstanceContent
148+
var directorType = _scanner.ReadUInt16(_scanner.ReadIntPtr(directorPtr + eventInfoOffset), 2);
149+
148150
if (directorType != 0x8003)
149151
{
150152
Debug.WriteLine("Invalid director type");
@@ -168,4 +170,4 @@ public struct SpecialWeather
168170
public string Name;
169171
public float Duration;
170172
}
171-
}
173+
}

渔人的直感/Models/SigScanner.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Linq;
55
using System.Runtime.InteropServices;
66

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

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

114+
public ushort ReadUInt16(IntPtr address, int offset = 0)
115+
=> BitConverter.ToUInt16(ReadBytes(IntPtr.Add(address, offset), 2), 0);
116+
115117
public byte ReadByte(IntPtr address, int offset = 0) => ReadBytes(IntPtr.Add(address, offset), 1)[0];
116118

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

0 commit comments

Comments
 (0)