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 


CE (DWORD) Group Scan (GG)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1247

PostPosted: Mon Mar 21, 2022 4:09 pm    Post subject: CE (DWORD) Group Scan (GG) Reply with quote

Please warn me if I'm keeping this section busy with useless garbage.
------------------------------------------------------------------------------
Here's @Dark Byte's example post for a look at CE's built-in functionality.
There you will find some advanced codes. Unlike my code, CE also performs group scans other than 4 bytes.

https://forum.cheatengine.org/viewtopic.php?p=5777758

------------------------------------------------------------------------------
I didn't cover it very comprehensively because I added some features and prepared a code close to what it was in GG.
Of course, you can still edit and improve it according to your wishes.

Let's list some use cases before using the code:
1) Make sure that the value to be scanned can be "Word", "Byte", "2 Byte", "Integer". Based on "4 bytes" and "Integer" values ​​only.

2) Set group scan values ​​to ";" Separate with (semicolon).

3) Group scan in GG is treated as "value;value:Scan memory". Sequential scanning is on request.
In this code; It is treated as "value;value:byte intervals between values" and by default sequential (equal spaced) scanning is performed.
This is calculated as follows; 20500;1100;50:8 (Coins;Diamonds;Cash), this brings the probability of 8 bytes (:8, "?? ?? ?? ?? ?? ?? ??") between each value, and the result is You will get a sequence like this;
Code:
"14 50 00 00 ?? ?? ?? ?? ?? ?? ?? ?? 4C 04 00 00 ?? ?? ?? ?? ?? ?? ?? ?? 32 00 00 00"


4) You cannot use math operation in Group scan in GG.
Although it's a bit redundant, you can add math in this code, including 4 operations (1 operation for each value).
Usage may be:
Code:
10250*2;2200/2;40+10:8


5) You can add the found results to the address list during scanning or by selecting them from the list.

-----------------------------------------------------------------------------------------
GUI Uses:

1) "C" Button: Clear scan box.

2) Auto - Add AddrList: When enabled, it adds the results to the Address list if results are found during scanning.

3) "Search" Button: It starts scanning the values written in the search box.

4) "Add All Address List" Button: Adds all the addresses above to the address list in order.

Options:
If the address result list boxes 1 and 2 (Memo 1 and Memo 2) are double-clicked on the row, it adds the address in the clicked row to the address list with its sequence number.

------------------------------------------------------------------------------------------
Code and Image:

Plugin usage explanation for novices:
1) Copy the code below in the original language of the page.
2) Create a new txt file on the PC desktop and open it.
3) Paste the copied code into the txt file.
4) Click "File" in the txt file menu and choose "Save as"
5) In the window that opens, give the file a name and write ".lua" at the end (without the quotes).
6) If the name is ok, change the txt box to "All files" and save.
7) Copy the "Lua" file you saved.
Cool Right-click on the Cheat Engine logo and select "Open file location" in the pop-up window.
9) Paste your Lua file into the "autorun" folder in the opened Cheat Engine file.

If you have done it in order, the registration is complete. You can open CE and start using it from the menu.

------------------------------------------------------------------------------------------
Code:

ExFrm1={"TCEForm"}
function getGroupSearch()

topic=250
if ExFrm1.visible==false then
ExFrm1.setLayeredAttributes(0x000100, 250, LWA_COLORKEY | LWA_ALPHA )
ExFrm1.Color=0x000100
ExFrm1.visible=true
else
if ExFrm1.visible==true then
  ExFrm1.Show()
  else
--if ExFrm1 then ExFrm1.Destroy() ExFrm1=nil end
ExFrm1 = createForm()
ExFrm1.Popupmode=0;
ExFrm1.Height=280 ExFrm1.Width=420
ExFrm1.Position=poDesktopCenter ExFrm1.BorderStyle=bsNone
ExFrm1.ShowInTaskBar="stAlways"
ExFrm1.Caption="AylinCE  Trainers"
ExFrm1.setLayeredAttributes(0x000100, 250, LWA_COLORKEY | LWA_ALPHA )
ExFrm1.Color=0x000100

ExPnl2 = createPanel(ExFrm1)
ExPnl2.Height=35 ExPnl2.Left=0 ExPnl2.Top=0 ExPnl2.Width=420
ExPnl2.Caption="[CE]  Group  Search  [DWORD (4 Bytes)]" ExPnl2.Cursor= -22
ExPnl2.Font.Size=14 ExPnl2.Font.Style='fsBold' ExPnl2.Font.Color=0
ExPnl2.Color=0x00ff00 ExPnl2.BevelWidth=4
ExPnl2.OnMouseDown=function() ExFrm1.DragNow() end

ExPnl1 = createPanel(ExFrm1)
ExPnl1.Height=240 ExPnl1.Left=0 ExPnl1.Top=40 ExPnl1.Width=420
ExPnl1.Color=0xffff00 ExPnl1.BevelWidth=4

ExEdt1=createEdit(ExPnl1)
ExEdt1.AutoSize=false
ExEdt1.Left=10 ExEdt1.Height=25 ExEdt1.Top=10 ExEdt1.Width=200

ExChk1 = createCheckBox(ExPnl1)
ExChk1.Left=235 ExChk1.Top=12 ExChk1.caption="Auto-Add AddrList"
ExChk1.Font.Size=8 ExChk1.Font.Style='fsBold'

ExBtn1=createButton(ExPnl1)
ExBtn1.Left=345 ExBtn1.Height=25 ExBtn1.Top=10 ExBtn1.Width=65
ExBtn1.Caption='Search'

ExBtn2=createButton(ExPnl1)
ExBtn2.Left=210 ExBtn2.Height=25 ExBtn2.Top=10 ExBtn2.Width=20
ExBtn2.Caption='C'

ExMem1=createMemo(ExPnl1)
ExMem1.Left=10 ExMem1.Height=160 ExMem1.Top=40 ExMem1.Width=140
ExMem1.ScrollBars=ssAutoBoth ExMem1.WordWrap=false

ExMem2=createMemo(ExPnl1)
ExMem2.Left=155 ExMem2.Height=160 ExMem2.Top=40 ExMem2.Width=140
ExMem2.ScrollBars=ssAutoBoth ExMem2.WordWrap=false

ExMem3=createMemo(ExPnl1)
ExMem3.Left=300 ExMem3.Height=160 ExMem3.Top=40 ExMem3.Width=110
ExMem3.ScrollBars=ssAutoBoth ExMem3.WordWrap=false

ExBtn3=createButton(ExPnl1)
ExBtn3.Left=10 ExBtn3.Height=25 ExBtn3.Top=205 ExBtn3.Width=25
ExBtn3.Caption='--'

ExBtn4=createButton(ExPnl1)
ExBtn4.Left=155 ExBtn4.Height=25 ExBtn4.Top=205 ExBtn4.Width=140
ExBtn4.Caption='Add All Address List'

ExBtn5=createButton(ExPnl1)
ExBtn5.Left=385 ExBtn5.Height=25 ExBtn5.Top=205 ExBtn5.Width=25
ExBtn5.Caption='X'

if ExTmr1 then ExTmr1.destroy() ExTmr1=nil end
ExTmr1=createTimer() ExTmr1.Interval=150 ExTmr1.Enabled=false
--------------------------------------------------
local Search={}
local SearchIndex1=0

function checkResult(addr)
local res=1
src=0
src1=tonumber(SearchIndex1) * #Search
 for i=1, #Search - 1 do
    if src==src1 then src=0 end
  adr1=addr .. "+" .. string.format("%02X", tonumber(src))
    src=tonumber(SearchIndex1) + tonumber(src)
  aaF=readInteger(adr1)
  --print(Search[i] .. " - " .. readInteger(adr1))
   if tonumber(aaF)~=tonumber(Search[i]) then
    res=2
   end
  end
 return res
end

function findResult()
ExTmr1.Enabled=false
 if ExMem1.Lines.Text=="" then
  showMessage("Code Not found!")
  else
  src=0
  src1=tonumber(SearchIndex1) * #Search
  SL=createStringlist()
  SL.Text=ExMem1.Lines.Text
   for j=0,strings_getCount(SL)-1 do
   adrr=SL[j]
    if src==src1 then src=0 end
    for i=1, #Search do
     adr1=adrr .. "+" .. string.format("%02X", tonumber(src))
     if adr1~=nil then
      src=tonumber(SearchIndex1) + tonumber(src)
      ExMem2.Lines.Add(getNameFromAddress(adr1))
      ExMem3.Lines.Add(readInteger(adr1))
     end
    end
   end
   SL = nil
   ExTmr1.Enabled=true
  end
end

function FindAndValue(find_this)
find_this=tonumber(find_this)
ExTmr1.Enabled=false
local memscan = createMemScan()
local foundlist = createFoundList(memscan)
memscan.firstScan(soExactValue, vtDword, rtRounded, find_this, nil, 0, "00007fffffffffff", "+W-C", fsmAligned, "4", false, false, false, false)
memscan.waitTillDone()
foundlist.initialize()
saved_values = {}
local value = foundlist.Value
local address = foundlist.Address
 --print(foundlist.Count)
 if foundlist.Count>0 then
  for i = 0, foundlist.Count - 1 do
 --print(address[i])
   res1=checkResult(address[i])
   if res1==1 then
    ExMem1.Lines.Add(address[i])
   end
    if i==(foundlist.Count) - 1 then
     ExTmr1.Enabled=true
     foundlist.destroy()
     memscan.destroy()
    end
  end
  else
  foundlist.destroy()
  memscan.destroy()
  showMessage("Code Not found!")
 end
end

----------------------------------------------

function valueMath(val)
rslt="" bb1=0 bb2=0
aa2=string.find(val,"*")
aa3=string.find(val,"+")
aa4=string.find(val,"-")
aa5=string.find(val,"/")
 if aa2~=nil then bb1,bb2=string.match(val,"(.-)*(.*)") rslt=tonumber(bb1) * tonumber(bb2)
  elseif aa3~=nil then bb1,bb2=string.match(val,"(.-)+(.*)") rslt=tonumber(bb1) + tonumber(bb2)
  elseif aa4~=nil then bb1,bb2=string.match(val,"(.-)-(.*)") rslt=tonumber(bb1) - tonumber(bb2)
  elseif aa5~=nil then bb1,bb2=string.match(val,"(.-)/(.*)") rslt=tonumber(bb1) / tonumber(bb2)
  else rslt=tonumber(val)
 end
 return math.floor(rslt)
end

function GetTheTableList(aa)
 local SL=createStringlist()
 SL.Text=aa
 for i=0,strings_getCount(SL)-1 do
 aa=valueMath(SL[i])
  Search[i+1] = aa
 end
 SL = nil
end

function addList()
ExTmr1.Enabled=false
 if ExMem2.Lines.Text=="" then
  showMessage("Code Not found!")
  else
  SL=createStringlist()
  SL.Text=ExMem2.Lines.Text
  desX=0
  desX1=1
   for i=0,strings_getCount(SL)-1 do
    adrr=SL[i]
    --print(adrr)
    if adrr ~= nil then
     if desX==#Search then desX=0 desX1=tonumber(desX1) + 1 end
     desX=tonumber(desX) + 1
     --addList1(adrr,desX)
     mr = AddressList.createMemoryRecord()
     mr.Description = ("Result" .. tonumber(desX1) .. " - " .. i + 1)
     mr.Type = vtDword
     mr.Address = adrr
    end
   end
   SL = nil
   ExTmr1.Enabled=true
 end
end

ExEdt1.Text="1000;1200;431;519:4"
tInd=0
ExTmr1.OnTimer=function()
tInd=tonumber(tInd) + 1
--print("tInd: " .. tInd)
 if tInd==2 then
  findResult()
 end
 if tInd==5 then
  if ExChk1.Checked==true then
   addList()
   else
   ExTmr1.Enabled=false
  end
 end
 if tInd==6 then
  ExTmr1.Enabled=false
 end
end


ExBtn1.OnClick=function(sender)
ExMem1.Lines.Text=""
ExMem2.Lines.Text=""
ExMem3.Lines.Text=""
Text=ExEdt1.Text
aa=""
aa1=0
tInd=0
aa1=string.match(Text,":(.*)")
aa=string.gsub(Text,":"..aa1,""):gsub(";","\n")
--print(aa1 .. "\n" .. aa)
  if aa1~="" or aa1~=nil then SearchIndex1=tonumber(aa1) else SearchIndex1=4 end
  if aa~="" then
   GetTheTableList(aa)
    --print("search: " .. Search[1])
     FindAndValue(Search[1])
   else
   print("ERROR:There are invalid values!\nSample: 10;30;20;40:4 etc.")
  end
end
local nexdesX1 = 0

ExMem1.OnDblClick=function()
local code = ExMem1.SelText
local cInd = 0
 for i=0, ExMem1.Lines.Count - 1 do
  if ExMem1.Lines[i]==code then cInd=i + 1 end
 end
 --print(cInd)
 if code~=nil then
  nexdesX1=tonumber(nexdesX1) + 1
  mr = AddressList.createMemoryRecord()
  mr.Description = ("M1_L" .. cInd .. "_Result" .. tonumber(nexdesX1))
  mr.Type = vtDword
  mr.Address = ExMem1.SelText
 end
end

ExMem2.OnDblClick=function()
local cInd = 0
local code = ExMem2.SelText
 for i=0, ExMem2.Lines.Count - 1 do
  if ExMem2.Lines[i]==code then cInd=i + 1 end
 end
 --print(cInd)
 if code~=nil then
  nexdesX1=tonumber(nexdesX1) + 1
  mr = AddressList.createMemoryRecord()
  mr.Description = ("M2_L" .. cInd .. "_Result" .. tonumber(nexdesX1))
  mr.Type = vtDword
  mr.Address = ExMem2.SelText
 end
end

ExBtn2.OnClick=function()
ExEdt1.Text=""
end

ExBtn4.OnClick=addList

ExBtn3.OnClick=function() ExFrm1.WindowState="wsMinimized" end

function cls()
cTim.enabled=false
  ExFrm1.visible=false
end

if cTim then cTim.Destroy() cTim=nil end
cTim=createTimer() cTim.Interval=35 cTim.Enabled=false

cTim.OnTimer=function()
topic=tonumber(topic) - 10
ExFrm1.setLayeredAttributes(0x000100, tonumber(topic), LWA_COLORKEY | LWA_ALPHA )
ExFrm1.Color=0x000100
 if topic==0 then cls() end
end

ExBtn5.OnClick=function() cTim.Enabled=true end
end
end
end

mf = getMainForm()
mainMenu = mf.Menu.Items
if not groupSrc then groupSrc=createMenuItem(mf.MainMenu)
groupSrc.Name = 'groupSrc'
   groupSrc.Caption = 'GroupSearch'
   mainMenu.insert(mainMenu.Count-1,groupSrc)
   groupSrc.OnClick=getGroupSearch
end


And we have come to the end of another archive.

Please don't hesitate if this code helps you;
You can give a Reputation grade by tapping the thumb icon under my profile picture.

See you in another archive.



gsrc1.PNG
 Description:
 Filesize:  74.55 KB
 Viewed:  13361 Time(s)

gsrc1.PNG



_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions 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