Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


wildcards search

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
urufu
How do I cheat?
Reputation: 0

Joined: 18 Mar 2019
Posts: 6

PostPosted: Thu Dec 24, 2020 11:44 am    Post subject: wildcards search Reply with quote

I was just wandering if it was possible to add the special wildcard to the search such as !0 and [1-9]?
for example:
search with 00 00 A0 40 08 00 00 00 ?? ?? ?? ?? FF FF FF FF 00 01 ?? 00, 3 results:
00 00 A0 40 08 00 00 00 ?? ?? ?? ?? FF FF FF FF 00 01 ?? 00
00 00 A0 40 00 00 00 00 ?? ?? ?? ?? FF FF FF FF 00 01 ?? 00
00 00 A0 40 00 00 00 00 ?? ?? ?? ?? FF FF FF FF 00 01 ?? 00

Could I search with
00 00 A0 40 !0 00 00 00 ?? ?? ?? ?? FF FF FF FF 00 01 ?? 00,
then the result will be the first only one.
00 00 A0 40 08 00 00 00 ?? ?? ?? ?? FF FF FF FF 00 01 ?? 00
!0 means is not equal to zero.
Back to top
View user's profile Send private message
urufu
How do I cheat?
Reputation: 0

Joined: 18 Mar 2019
Posts: 6

PostPosted: Sat Dec 26, 2020 10:51 pm    Post subject: Reply with quote

Anyone who can help me with this question? Smile
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Sat Dec 26, 2020 11:38 pm    Post subject: Reply with quote

https://forum.cheatengine.org/viewtopic.php?p=5768338#5768338
Basically took this script and inversed it.

Usage:
Code:
-- lua
--0x091DDDA8 --> 00 01 02 03 21 C0 6D
--0x099E9578 --> 00 01 02 03 21 C0 1B
local address = AOBScanNot("00 01 02 03 !00!04 C0 !6D");
--address --> 0x099E9578

-- asm
aobscanNot(myAob,00 01 02 03 !00!04 C0 !6D)
registersymbol(myAob); //0x099E9578



Script:
Code:
-- AOBScanNot('XX XX XX !YY XX XX !ZZ XX');
   -- AOBScanNot('XX XX XX !YY XX XX !AA!BB!CC!DD ... XX');
function AOBScanNot(aob) -- only string
   if (type(aob) == 'string') then
      aob = aob:gsub('[^%x%!%s%?]+',''):gsub('%s+',' '); -- clean up and remove exceesive space
      local NotOffset,NotOffsetSize,byteNum = {},0,0;
      for byte in aob:gmatch('%S+') do
         byteNum = byteNum+1; -- total bytes
         if (byte:match('!')) then
            NotOffset[byteNum] = {};
            NotOffsetSize = NotOffsetSize + 1;
            for NotByte in byte:gmatch('[^!]+%x+') do -- incase some genius would want to do xx|yy|??
               table.insert(NotOffset[byteNum],tonumber(NotByte,16));
            end
         end
      end
      local newAob = aob:gsub('!%x+','??'):gsub('%?+','??');
      local aobs = AOBScan(newAob) -- get rid of the 'Not' bytes
      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 isValid = true;
            for offset,NotBytes in pairs(NotOffset) do
               for _,byte in pairs(NotBytes) do
                  if (byte == bytes[offset]) then
                     print('found bad byte:',byte);
                     isValid = false
                     break;
                  end
               end
               if (not isValid) then
                  break;
               end
            end
            if (isValid) then
               aobs.destroy();
               return address
            end
         end
         aobs.destroy();
      end
   end
end

registerAutoAssemblerCommand('aobscanNot',function(line)
   local name,bytes = line:match('([^,]+),(.+)');
   local address = AOBScanNot(bytes);
   return ('define(%s,%s)'):format(name,address);
end)



AOBScanNot.lua
 Description:
Place in autorun...

Download
 Filename:  AOBScanNot.lua
 Filesize:  1.58 KB
 Downloaded:  128 Time(s)


_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3325

PostPosted: Sun Dec 27, 2020 6:26 am    Post subject: Reply with quote

Good stuff!
You ought to create aobscanmodule and aobscanregion variants and put them all in a single LUA file; -)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites