Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- range search script --
- RAM_START = 0x02000000
- RAM_SIZE = 0x7E4000
- result_table = {}
- result_count = 0
- -- values to check. usually an address range. --
- range1 = 0x027E3300
- range2 = 0x027E3300
- local file = assert(io.open("output.txt", "w"))
- -- 3 functions copied from interwebs
- function table.val_to_str ( v )
- if "string" == type( v ) then
- v = string.gsub( v, "\n", "\\n" )
- if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then
- return "'" .. v .. "'"
- end
- return '"' .. string.gsub(v,'"', '\\"' ) .. '"'
- else
- return "table" == type( v ) and table.tostring( v ) or
- tostring( v )
- end
- end
- function table.key_to_str ( k )
- if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then
- return k
- else
- return "[" .. table.val_to_str( k ) .. "]"
- end
- end
- function table.tostring( tbl )
- local result, done = {}, {}
- for k, v in ipairs( tbl ) do
- table.insert( result, table.val_to_str( v ) )
- done[ k ] = true
- end
- for k, v in pairs( tbl ) do
- if not done[ k ] then
- table.insert( result,
- table.key_to_str( k ) .. "=" .. table.val_to_str( v ) )
- end
- end
- return "{" .. table.concat( result, "," ) .. "}"
- end
- if (range1 - 1) < range2 then
- for N = 0, RAM_SIZE do
- local getvar = memory.readdword(RAM_START + N)
- if getvar + 1 > range1 then
- if getvar - 1 < range2 then
- result_count = result_count + 1
- result_table[result_count] = string.format('0x%08X', (RAM_START + N)) -- update table with the pointer to the value, not the value.
- end
- end
- N = N + 4
- end
- else
- print("You cannot have range 1 greater than range 2.")
- end
- file:write(table.tostring(result_table))
- print("RAM search finished. Result written to output.txt.")
- file:close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement