btw this post will keep updating (since i've opened this thread,i won't dump this)
Memory editing(byte inject)
Code: Select all
function MakeRangedNop(addr,addrTo)
addr = getAddress(addr)
addrTo = getAddress(addrTo)
local size
if addr == nil then
return
end
if addrTo == nil then
size = getInstructionSize(addr)
end
size = -(addr - addrTo)
MakeNop(addr,size)
end
function MakeNop(addr,size)
addr = getAddress(addr)
size = tonumber(size)
if addr == nil then
return
end
if size == 0 then
return
end
if size == nil then
size = getInstructionSize(addr)
end
size = size - 1
for i = 0,size do
writeBytes(addr+i,0x90)
end
end
Value types
Code: Select all
function readBoolean(addr)
local result
if addr == nil then
return nil
end
result = readBytes(addr) == 1
if readBytes(addr) > 1 then
result = nil
end
return result
end
function writeBoolean(addr,bool)
local result
if addr == nil or bool == nil then
return
end
result = bool and 1 or 0
writeBytes(addr,result)
end
function rewriteString(addr,text,wideChar)
if addr == nil then
error("Address wasn't setted!")
return
end
if text == nil then
error("String wasn't aspected!")
return
end
if wideChar == nil then
wideChar = false
end
addr = getAddress(addr)
if not addr then return end
local size = #readString(addr)
if wideChar then
local size = size * 2
for i = 0,size do
writeBytes(addr+i,{0x00,0x00})
end
else
for i = 0,size do
writeBytes(addr+i,0)
end
end
writeString(addr,text,wideChar)
end