Added waypoint pattern scan (#80)
Co-authored-by: Arto Simonyan <artosimonyan@protonmail.com>
This commit is contained in:
@@ -13,6 +13,7 @@ type Offset struct {
|
||||
RosterOffset uintptr
|
||||
PanelManagerContainerOffset uintptr
|
||||
WidgetStatesOffset uintptr
|
||||
WaypointsOffset uintptr
|
||||
FPS uintptr
|
||||
}
|
||||
|
||||
@@ -60,11 +61,17 @@ func calculateOffsets(process Process) Offset {
|
||||
WidgetStatesPtr := process.ReadUInt(pattern+3, Uint32)
|
||||
WidgetStatesOffset := pattern - process.moduleBaseAddressPtr + 7 + uintptr(WidgetStatesPtr)
|
||||
|
||||
// Waypoints
|
||||
pattern = process.FindPattern(memory, "\x48\x89\x05\x00\x00\x00\x00\x0F\x11\x00", "xxx????xxx")
|
||||
offsetBuffer := process.ReadUInt(pattern+3, Uint32)
|
||||
WaypointsOffset := pattern - process.moduleBaseAddressPtr + 23 + uintptr(offsetBuffer)
|
||||
|
||||
// FPS
|
||||
pattern = process.FindPattern(memory, "\x8B\x1D\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x8D\x4C\x24\x40", "xx????xxx????xxxxx")
|
||||
fpsOffsetPtr := uintptr(process.ReadUInt(pattern+2, Uint32))
|
||||
fpsOffset := pattern - process.moduleBaseAddressPtr + 6 + fpsOffsetPtr
|
||||
|
||||
|
||||
return Offset{
|
||||
GameData: gameDataOffset,
|
||||
UnitTable: unitTableOffset,
|
||||
@@ -74,6 +81,7 @@ func calculateOffsets(process Process) Offset {
|
||||
RosterOffset: rosterOffset,
|
||||
PanelManagerContainerOffset: panelManagerContainerOffset,
|
||||
WidgetStatesOffset: WidgetStatesOffset,
|
||||
WaypointsOffset: WaypointsOffset,
|
||||
FPS: fpsOffset,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func (gd *GameReader) GetPlayerUnit(mainPlayerUnit RawPlayerUnit) data.PlayerUni
|
||||
|
||||
availableWPs := make([]area.ID, 0)
|
||||
// Probably there is a better place to pick up those values, since this seems to be very tied to the UI
|
||||
wpList := gd.Process.ReadBytesFromMemory(gd.moduleBaseAddressPtr+0x2186420, 0x48)
|
||||
wpList := gd.Process.ReadBytesFromMemory(gd.moduleBaseAddressPtr+gd.offset.WaypointsOffset, 0x48)
|
||||
for i := 0; i < 0x48; i = i + 8 {
|
||||
a := binary.LittleEndian.Uint32(wpList[i : i+4])
|
||||
available := binary.LittleEndian.Uint32(wpList[i+4 : i+8])
|
||||
|
||||
Reference in New Issue
Block a user