OffSetFix-91403
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
)
|
||||
|
||||
type Offset struct {
|
||||
GameData uintptr
|
||||
UnitTable uintptr
|
||||
@@ -26,119 +22,70 @@ type Offset struct {
|
||||
}
|
||||
|
||||
func calculateOffsets(process *Process) Offset {
|
||||
// ignoring errors, always best practices
|
||||
memory, _ := process.getProcessMemory()
|
||||
|
||||
// GameReader
|
||||
pattern := process.FindPattern(memory, "\x44\x88\x25\x00\x00\x00\x00\x66\x44\x89\x25\x00\x00\x00\x00", "xxx????xxxx????")
|
||||
bytes := process.ReadBytesFromMemory(pattern+0x3, 4)
|
||||
offsetInt := uintptr(binary.LittleEndian.Uint32(bytes))
|
||||
gameDataOffset := (pattern - process.moduleBaseAddressPtr) - 0x121 + offsetInt
|
||||
memory, err := process.getProcessMemory()
|
||||
if err != nil || len(memory) == 0 {
|
||||
// Return empty offsets - will be recalculated when game is ready
|
||||
return Offset{}
|
||||
}
|
||||
|
||||
// UnitTable
|
||||
pattern = process.FindPattern(memory, "\x48\x03\xC7\x49\x8B\x8C\xC6", "xxxxxxx")
|
||||
bytes = process.ReadBytesFromMemory(pattern+7, 4)
|
||||
unitTableOffset := uintptr(binary.LittleEndian.Uint32(bytes))
|
||||
unitTableOffset := uintptr(0x1D95AF0)
|
||||
|
||||
// UI
|
||||
pattern = process.FindPattern(memory, "\x40\x84\xed\x0f\x94\x05", "xxxxxx")
|
||||
uiOffset := process.ReadUInt(pattern+6, Uint32)
|
||||
uiOffsetPtr := (pattern - process.moduleBaseAddressPtr) + 10 + uintptr(uiOffset)
|
||||
uiOffsetPtr := uintptr(0x1DA57DA)
|
||||
|
||||
// Hover
|
||||
pattern = process.FindPattern(memory, "\xc6\x84\xc2\x00\x00\x00\x00\x00\x48\x8b\x74", "xxx?????xxx")
|
||||
hoverOffset := process.ReadUInt(pattern+3, Uint32) - 1
|
||||
hoverOffset := uintptr(0x1CE8400)
|
||||
|
||||
// Expansion
|
||||
pattern = process.FindPattern(memory, "\x48\x8B\x05\x00\x00\x00\x00\x48\x8B\xD9\xF3\x0F\x10\x50\x00", "xxx????xxxxxxx?")
|
||||
offsetPtr := uintptr(process.ReadUInt(pattern+3, Uint32))
|
||||
expOffset := pattern - process.moduleBaseAddressPtr + 7 + offsetPtr
|
||||
expOffset := uintptr(0x1CE78D0)
|
||||
|
||||
// Party members offset
|
||||
pattern = process.FindPattern(memory, "\x02\x45\x33\xD2\x4D\x8B", "xxxxxx")
|
||||
offsetPtr = uintptr(process.ReadUInt(pattern-3, Uint32))
|
||||
rosterOffset := pattern - process.moduleBaseAddressPtr + 1 + offsetPtr
|
||||
rosterOffset := uintptr(0x1DABD60)
|
||||
|
||||
// PanelManagerContainer
|
||||
pattern = process.FindPatternByOperand(memory, "\x48\x89\x05\x00\x00\x00\x00\x48\x85\xDB\x74\x1E", "xxx????xxxxx")
|
||||
bytes = process.ReadBytesFromMemory(pattern, 8)
|
||||
panelManagerContainerOffset := (pattern - process.moduleBaseAddressPtr) // uintptr(binary.LittleEndian.Uint64(bytes))
|
||||
panelManagerContainerOffset := uintptr(0x1D00968)
|
||||
|
||||
// WidgetStates
|
||||
pattern = process.FindPattern(memory, "\x48\x8B\x0D\x00\x00\x00\x00\x4C\x8D\x44\x24\x00\x48\x03\xC2", "xxx????xxxx?xxx")
|
||||
WidgetStatesPtr := process.ReadUInt(pattern+3, Uint32)
|
||||
WidgetStatesOffset := pattern - process.moduleBaseAddressPtr + 7 + uintptr(WidgetStatesPtr)
|
||||
WidgetStatesOffset := uintptr(0x1DCDD40)
|
||||
|
||||
// Waypoints
|
||||
pattern = process.FindPattern(memory, "\x48\x89\x05\x00\x00\x00\x00\x0F\x11\x00", "xxx????xxx")
|
||||
offsetBuffer := process.ReadUInt(pattern+3, Uint32)
|
||||
WaypointTableOffset := pattern - process.moduleBaseAddressPtr + 7 + uintptr(offsetBuffer)
|
||||
WaypointTableOffset := uintptr(0x1C468B0)
|
||||
|
||||
// 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
|
||||
|
||||
// Keybindings
|
||||
pattern = process.FindPattern(memory, "\x48\x8D\x05\xAF\xEE", "xxxxx")
|
||||
bytes = process.ReadBytesFromMemory(pattern+3, 4)
|
||||
relativeOffset := int32(binary.LittleEndian.Uint32(bytes))
|
||||
keyBindingsOffset := pattern - process.moduleBaseAddressPtr + 7 + uintptr(relativeOffset)
|
||||
fpsOffset := uintptr(0x1C46894)
|
||||
|
||||
// KeyBindings Skills
|
||||
pattern = process.FindPattern(memory, "\x0F\x10\x04\x24\x48\x6B\xC8\x1C\x48\x8D\x05", "xxxxxxxxxxx")
|
||||
var keyBindingsSkillsOffset uintptr
|
||||
bytes = process.ReadBytesFromMemory(pattern+11, 4)
|
||||
relativeOffset = int32(binary.LittleEndian.Uint32(bytes))
|
||||
keyBindingsSkillsOffset = uintptr(int64(pattern) + 15 + int64(relativeOffset))
|
||||
keyBindingsSkillsOffset := uintptr(0x1CE8510)
|
||||
|
||||
// QuestInfo
|
||||
pattern = process.FindPattern(memory, "\x48\x8B\x0D\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x45\x33\xE4", "xxx????x????xxx")
|
||||
questInfoOffsetPtr := uintptr(process.ReadUInt(pattern+3, Uint32))
|
||||
questInfoOffset := pattern - process.moduleBaseAddressPtr + 7 + questInfoOffsetPtr
|
||||
questInfoOffset := uintptr(0)
|
||||
|
||||
// Terror Zones
|
||||
tzOffset := uintptr(0x29B2DF0)
|
||||
|
||||
// Quest Bytes Data
|
||||
pattern = process.FindPattern(memory, "\x42\xc6\x84\x28\x00\x00\x00\x00\x00\x49\xff\xc5\x49\x83\xfd\x29", "xxxx?????xxxxxxx")
|
||||
bytes = process.ReadBytesFromMemory(pattern+4, 4)
|
||||
questOffset := uintptr(binary.LittleEndian.Uint32(bytes))
|
||||
questDataOffset := questOffset + 1
|
||||
tzOffset := uintptr(0x248D4C8)
|
||||
|
||||
// Ping
|
||||
pattern = process.FindPattern(memory, "\x48\x8B\x0D\xCC\xCC\xCC\xCC\x49\x2B\xC7", "xxx????xxx")
|
||||
bytes = process.ReadBytesFromMemory(pattern+3, 4)
|
||||
relativeOffset = int32(binary.LittleEndian.Uint32(bytes))
|
||||
pingOffset := pattern - process.moduleBaseAddressPtr + 7 + uintptr(relativeOffset)
|
||||
pingOffset := uintptr(0)
|
||||
|
||||
// LegacyGraphics
|
||||
pattern = process.FindPattern(memory, "\x80\x3D\x00\x00\x00\x00\x00\x48\x8D\x54\x24\x30", "xx?????xxxxx")
|
||||
legacyGfxPtr := uintptr(process.ReadUInt(pattern+2, Uint32))
|
||||
legacyGfxOffset := pattern - process.moduleBaseAddressPtr + 7 + legacyGfxPtr
|
||||
legacyGfxOffset := uintptr(0x1DB263E)
|
||||
|
||||
// CharData
|
||||
pattern = process.FindPattern(memory, "\x48\x8D\x05\x00\x00\x00\x00\x89\x93\xF4\x0C\x00\x00", "xxx????xxxxxx")
|
||||
bytes = process.ReadBytesFromMemory(pattern+3, 4)
|
||||
relativeOffset = int32(binary.LittleEndian.Uint32(bytes))
|
||||
charDataOffset := pattern - process.moduleBaseAddressPtr + 7 + uintptr(relativeOffset)
|
||||
charDataOffset := uintptr(0x1CED5E8)
|
||||
|
||||
return Offset{
|
||||
GameData: gameDataOffset,
|
||||
UnitTable: unitTableOffset,
|
||||
UI: uiOffsetPtr,
|
||||
Hover: uintptr(hoverOffset),
|
||||
Hover: hoverOffset,
|
||||
Expansion: expOffset,
|
||||
RosterOffset: rosterOffset,
|
||||
PanelManagerContainerOffset: panelManagerContainerOffset,
|
||||
WidgetStatesOffset: WidgetStatesOffset,
|
||||
WaypointTableOffset: WaypointTableOffset,
|
||||
FPS: fpsOffset,
|
||||
KeyBindingsOffset: keyBindingsOffset,
|
||||
KeyBindingsSkillsOffset: keyBindingsSkillsOffset,
|
||||
QuestInfo: questInfoOffset,
|
||||
TZ: tzOffset,
|
||||
Quests: questDataOffset,
|
||||
Ping: pingOffset,
|
||||
LegacyGraphics: legacyGfxOffset,
|
||||
CharData: charDataOffset,
|
||||
|
||||
Reference in New Issue
Block a user