-- AOBScanOr('XX XX XX YY|ZZ XX XX XX YY|ZZ'); -- XX XX XX YY XX XX XX YY|ZZ -- XX XX XX YY XX XX XX YY -- XX XX XX YY XX XX XX ZZ -- XX XX XX ZZ XX XX XX YY|ZZ -- XX XX XX ZZ XX XX XX YY -- XX XX XX ZZ XX XX XX ZZ function AOBScanOr(aob) -- only string if (type(aob) == 'string') then aob = aob:gsub('[^%x%|%s%?]+',''):gsub('%s+',' '); -- clean up and remove exceesive space local orOffset,orOffsetSize,byteNum = {},0,0; for byte in aob:gmatch('%S+') do byteNum = byteNum+1; -- total bytes if (byte:match('|')) then orOffset[byteNum] = {}; orOffsetSize = orOffsetSize + 1; for orByte in byte:gmatch('%x+[^|]?') do -- incase some genius would want to do xx|yy|?? table.insert(orOffset[byteNum],tonumber(orByte,16)); end end end local aobs = AOBScan(aob:gsub('%x+%|%x+','??')) -- get rid of the 'or' bytes local targetAddress if (aobs) then for i=0,aobs.Count-1 do local address = aobs.getString(i); local bytes,matchCount = readBytes(address,byteNum,true); -- better than multiple readBytes; local matchCount = 0; for offset,orBytes in pairs(orOffset) do for _,byte in pairs(orBytes) do if (byte == bytes[offset]) then matchCount = matchCount + 1; break; end end end if (matchCount == orOffsetSize) then aobs.destroy(); return address end end aobs.destroy(); end end end registerAutoAssemblerCommand('aobscanOr',function(line) local name,bytes = line:match('([^,]+),(.+)'); local address = AOBScanOr(bytes); return ('define(%s,%s)'):format(name,address); end) --[[ --lua call AOBScanOr("89 C9 4C 8B 14 CA|C8 41|49"); -- AA call aobscanor(myAob,89 C9 4C 8B 14 CA|C8 41|49) registersymbol(myAob) --]]