mirror of
https://github.com/GameHackingBook/GameHackingCode
synced 2026-06-08 11:08:54 +00:00
23 lines
694 B
Lua
23 lines
694 B
Lua
function _verifyLinkedList(address)
|
|
local nextItem = readInteger(address) or 0
|
|
local previousItem = readInteger(address + 4) or 0
|
|
local nextItemBack = readInteger(nextItem + 4)
|
|
local previousItemForward = readInteger(previousItem)
|
|
|
|
return (address == nextItemBack
|
|
and address == previousItemForward)
|
|
end
|
|
|
|
function isValueInLinkedList(valueAddress)
|
|
for address = valueAddress - 8, valueAddress - 48, -4 do
|
|
if (_verifyLinkedList(address)) then
|
|
return address
|
|
end
|
|
end
|
|
return 0
|
|
end
|
|
|
|
local node = isValueInLinkedList(addressOfSomeValue)
|
|
if (node > 0) then
|
|
print(string.format("Value in LL, top of node at 0x0%x", node))
|
|
end |