Merge pull request #18 from CarlPoppa1/ping

Ping
This commit is contained in:
guiyomu-dev
2025-10-19 15:06:58 +02:00
committed by GitHub
3 changed files with 16 additions and 0 deletions

View File

@@ -66,6 +66,7 @@ type OnlineGame struct {
LastGameName string
LastGamePassword string
FPS int
Ping int
}
type Panel struct {

View File

@@ -111,6 +111,7 @@ func (gd *GameReader) GetData() data.Data {
LastGameName: gd.LastGameName(),
LastGamePassword: gd.LastGamePass(),
FPS: gd.FPS(),
Ping: gd.Ping(),
},
Monsters: monsters,
Corpses: gd.Corpses(pu.Position, hover),
@@ -441,6 +442,12 @@ func (gd *GameReader) FPS() int {
return int(gd.ReadUInt(gd.moduleBaseAddressPtr+gd.offset.FPS, Uint32))
}
func (gd *GameReader) Ping() int {
ptrToStructPtr := gd.moduleBaseAddressPtr + gd.offset.Ping
structPtrAddr := gd.ReadUInt(ptrToStructPtr, Uint64)
return int(gd.ReadUInt(uintptr(structPtrAddr+36), Uint32))
}
func (gd *GameReader) HasMerc() bool {
return gd.ReadUInt(gd.Process.moduleBaseAddressPtr+gd.offset.UI+0x8, Uint8) != 0
}

View File

@@ -19,6 +19,7 @@ type Offset struct {
KeyBindingsSkillsOffset uintptr
TZ uintptr
Quests uintptr
Ping uintptr
LegacyGraphics uintptr
}
@@ -100,6 +101,12 @@ func calculateOffsets(process *Process) Offset {
questOffset := uintptr(binary.LittleEndian.Uint32(bytes))
questDataOffset := questOffset + 1
// 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)
// 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))
@@ -120,6 +127,7 @@ func calculateOffsets(process *Process) Offset {
KeyBindingsSkillsOffset: keyBindingsSkillsOffset,
TZ: tzOffset,
Quests: questDataOffset,
Ping: pingOffset,
LegacyGraphics: legacyGfxOffset,
}
}