statValue can have a negative value; if cast to uint from the start, its value will be lost.

This commit is contained in:
vietdungdev
2026-03-05 13:55:41 +07:00
parent 9840b0c026
commit dd642512b0

View File

@@ -215,7 +215,7 @@ func (gd *GameReader) HoveredData() data.HoverData {
func (gd *GameReader) getStatsList(statListPtr uintptr) stat.Stats { func (gd *GameReader) getStatsList(statListPtr uintptr) stat.Stats {
statsListBuffer := gd.ReadBytesFromMemory(statListPtr, 0x10) statsListBuffer := gd.ReadBytesFromMemory(statListPtr, 0x10)
statList := ReadUIntFromBuffer(statsListBuffer, 0, Uint64) statList := ReadUIntFromBuffer(statsListBuffer, 0, Uint64)
statCount := ReadUIntFromBuffer(statsListBuffer, 0x08, Uint64) statCount := ReadUIntFromBuffer(statsListBuffer, 0x08, Uint32)
if statCount == 0 { if statCount == 0 {
return []stat.Data{} return []stat.Data{}
} }
@@ -228,7 +228,7 @@ func (gd *GameReader) getStatsList(statListPtr uintptr) stat.Stats {
statLayer := ReadUIntFromBuffer(statBuffer, offset, Uint16) statLayer := ReadUIntFromBuffer(statBuffer, offset, Uint16)
statEnum := ReadUIntFromBuffer(statBuffer, offset+0x2, Uint16) statEnum := ReadUIntFromBuffer(statBuffer, offset+0x2, Uint16)
statValue := ReadIntFromBuffer(statBuffer, offset+0x4, Uint32) statValue := ReadIntFromBuffer(statBuffer, offset+0x4, Int32)
value := statValue value := statValue
switch stat.ID(statEnum) { switch stat.ID(statEnum) {