mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Thu Apr 26, 2012 8:25 am Post subject: Auto-fill pointerscanner scanoptions window |
|
|
Auto-fill pointerscanner scanoptions window
Custom settings (address, maxlevel, offsets) at the end of script.
Script only do this:
address to find, pointer must end with specific offsets checkbox, offsets and max level
This is for current ce revision and newer.
Code: | RequiredCEVersion=6.2
if (getCEVersion==nil) or (getCEVersion()<RequiredCEVersion) then
messageDialog('Please install Cheat Engine '..RequiredCEVersion, mtError, mbOK)
closeCE()
end
function searchForForm(name)
local formptr
local formname
for i=0, getFormCount() - 1 do
formptr = getForm(i)
formname = getProperty(formptr,'name')
if formname == name then
return formptr
end
end
return nil
end
function searchForSubmenu(parentForm,menuname,index)
local menu = component_findComponentByName(parentForm, menuname)
local submenu = menuItem_getItem(menu, index)
return submenu
end
function PointerScanSettingsWindowSet(timer)
timer_setEnabled(timer,false)
PSSF = searchForForm('frmPointerScannerSettings')
local edtAddress = component_findComponentByName(PSSF
,'edtAddress')
control_setCaption(edtAddress,myADDRESS)
local editMaxLevel = component_findComponentByName(PSSF
,'editMaxLevel')
control_setCaption(editMaxLevel,myMAXLEVEL)
local MustEndOffset = component_findComponentByName(PSSF
,'cbMustEndWithSpecificOffset')
setProperty(MustEndOffset,'Checked','false') --clean
setProperty(MustEndOffset,'Checked','true')
-- now EditOffset1 already exist
local AddButton = component_findComponentByName(PSSF,'btnAddOffset')
if (#myOffsets > 1) then
for i=1,#myOffsets - 1 do control_doClick(AddButton) end
end
for i=1,#myOffsets do
local EditOffset = component_findComponentByName(PSSF,'EdtOffset'..i)
control_setCaption(EditOffset,myOffsets[i])
end
end
function pointerscan()
local submenuToPSF = searchForSubmenu(getMemoryViewForm(),'Extra1',11)
menuItem_doClick(submenuToPSF)
local PSF = searchForForm('frmPointerScanner')
form_centerScreen(PSF)
local submenuToPSSF = searchForSubmenu(PSF,'Pointerscanner1',0)
local myTimer = createTimer(nil,true)
timer_setInterval(myTimer,500)
timer_onTimer(myTimer,PointerScanSettingsWindowSet)
menuItem_doClick(submenuToPSSF)
end
myADDRESS = '00466666'
myMAXLEVEL = 3
myOffsets = {'200','50'} -- last offset is 200
pointerscan() |
If you want to set
Edit boxes:
"from"
"to"
"maximum offset value"
"nr of threads scanning"
add this:
Code: | local edtReverseStart = component_findComponentByName(PSSF
,'edtReverseStart')
control_setCaption(edtReverseStart,'00000000')
local edtReverseStop = component_findComponentByName(PSSF
,'edtReverseStop')
control_setCaption(edtReverseStop,'7FFFFFFF')
local editStructsize = component_findComponentByName(PSSF
,'editStructsize')
control_setCaption(editStructsize,'2048')
local edtThreadcount = component_findComponentByName(PSSF
,'edtThreadcount')
control_setCaption(edtThreadcount,'2') |
Check boxes:
"address must be 32bit aligned"
"only find paths with static address"
"don't include pointers with read-only nodes"
"stop traversing a path when static has been found"
add this:
Code: | local CbAlligned = component_findComponentByName(PSSF
,'CbAlligned')
setProperty(CbAlligned,'Checked','true')
local cbStaticOnly = component_findComponentByName(PSSF
,'cbStaticOnly')
setProperty(cbStaticOnly,'Checked','true')
local cbNoReadOnly = component_findComponentByName(PSSF
,'cbNoReadOnly')
setProperty(cbNoReadOnly,'Checked','true')
local cbOnlyOneStatic = component_findComponentByName(PSSF
,'cbOnlyOneStatic')
setProperty(cbOnlyOneStatic,'Checked','true') |
You can merge this script with memscan_fistScan and memscan_nextScan instructions.
For example, I know correct "end offsets" for pointer and I know how hero structure looks like.
pointer to medallion: [[[[baseaddress]+250]+14]+29c]
structure:
0x29c medallion (1byte) - when charged = 1
0x2ac EXP (4byte)
0x2b0 talent (4byte)
The problem is: I don't know pointer base address for other game version (Retail vs STEAM).
I figured out that I can use groupscan for searching for this structure. We can read EXP and talent values, they are inside witcher 2 inventory menu.
Group scan command looks like this:
1:1 w:15 4:exp 4:talent
Then launch pointerscan for found address.
Final tool is here (tool for witcher 2): link
You can test it with calc.exe. Copy and paste calc.exe file, rename it to witcher2.exe, launch witcher2.exe(calc), then launch tool.
Values to try:
15345,34 (most probably, zero results)
0,0 (many results, like few 100s)
0,1 (few 10s)
if you write unique values (my calc.exe and exp:0 talent:2), pointerscan begins.
tool for witcher 2 full lua script:
you need form (UDF1) with button (onclick set to CEButton1Click) and two edit boxes (UDF1_CEEdit1 and UDF1_CEEdit2)
Code: | function searchForFormAndSetText(name,text)
local formptr
local formname
for i=0, getFormCount() - 1 do
formptr = getForm(i)
formname = getProperty(formptr,'name')
if formname == name then
if text then control_setCaption(formptr, text) end
return formptr
end
end
return nil
end
function searchForSubmenu(parentForm,menuname,index)
local menu = component_findComponentByName(parentForm, menuname)
local submenu = menuItem_getItem(menu, index)
return submenu
end
function PointerScanSettingsWindowSet(timer)
timer_setEnabled(timer,false)
PSSF = searchForFormAndSetText('frmPointerScannerSettings',
'PRESS ONLY OK BUTTON! Then save file.')
local edtAddress = component_findComponentByName(PSSF
,'edtAddress')
control_setCaption(edtAddress,myADDRESS)
local editMaxLevel = component_findComponentByName(PSSF
,'editMaxLevel')
control_setCaption(editMaxLevel,myMAXLEVEL)
local MustEndOffset = component_findComponentByName(PSSF
,'cbMustEndWithSpecificOffset')
setProperty(MustEndOffset,'Checked','false') --clean
setProperty(MustEndOffset,'Checked','true')
-- now EditOffset1 already exist
local AddButton = component_findComponentByName(PSSF,'btnAddOffset')
if (#myOffsets > 1) then
for i=1,#myOffsets - 1 do control_doClick(AddButton) end
end
for i=1,#myOffsets do
local EditOffset = component_findComponentByName(PSSF,'EdtOffset'..i)
control_setCaption(EditOffset,myOffsets[i])
end
end
function pointerscan()
local submenuToPSF = searchForSubmenu(getMemoryViewForm(),'Extra1',11)
menuItem_doClick(submenuToPSF)
local PSF = searchForFormAndSetText('frmPointerScanner'
,'Searching pointer for Witcher 2 v3, wait')
form_centerScreen(PSF)
local submenuToPSSF = searchForSubmenu(PSF,'Pointerscanner1',0)
local myTimer = createTimer(nil,true)
timer_setInterval(myTimer,500)
timer_onTimer(myTimer,PointerScanSettingsWindowSet)
menuItem_doClick(submenuToPSSF)
end
ms = createMemScan()
FL = createFoundList(ms)
memscanusedbefore=false
strings_add(getAutoAttachList(), "witcher2.exe")
control_setCaption(UDF1,control_getCaption(UDF1_CEButton1))
form_show(UDF1)
myADDRESS = nil
myMAXLEVEL = 3
myOffsets = {'29c','14','250'} -- last offset is 29c
function CEButton1Click(sender)
local exp = control_getCaption(UDF1_CEEdit1)
local talent = control_getCaption(UDF1_CEEdit2)
local groupscancommand = '1:1 w:15 4:'..exp..' 4:'..talent
if (memscanusedbefore==true) then foundlist_deinitialize(FL) end
memscanusedbefore=true
memscan_firstScan(ms, soExactValue, vtGrouped, rtRounded, groupscancommand,
"", "0x00000000", "0x7fffffff", "+W*X-C", fsmAligned, "4",
false, false, false, false)
memscan_waitTillDone(ms)
foundlist_initialize(FL)
FlCount = foundlist_getCount(FL)
if (FlCount == 1) then
myADDRESS = foundlist_getAddress(FL,0)
pointerscan()
else
message = [[Nothing found, did you write correct values?]]
if (FlCount~=0) then message=[[
More than 1 address found,
please change exp or talent value (kill monster or something)]]
end
showMessage(message..'\r\n\r\nAddresses found: '..FlCount)
end
end
function FormClose(sender)
foundlist_deinitialize(FL)
object_destroy(ms)
form_hide(UDF1)
closeCE()
return caFree --Possible options: caHide, caFree, caMinimize, caNone
end |
errors? suggestions? send PM.
_________________
|
|