 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
GH*master Expert Cheater
Reputation: 8
Joined: 10 Jan 2008 Posts: 159
|
Posted: Thu Oct 04, 2012 3:47 am Post subject: Generate AA-code from templates (extension for CE) |
|
|
Simple generate AA-code from templates (extension for CE)
1) You can fast generate AA-code
2) You can modify the templates
AACodeTemplate
AND
AOBSCANCodeTemplate
3) Go to Disassembler window, selected some instructions and you can see new commands in popup menu
4) Also you can input hotkeys (to see "popup menu-> item name-> [hot-keys]")
Code: | --[[
Version 1.1
CE 6.2
]]--
scriptCount = 0
AACodeTemplate = [[
[ENABLE]
alloc(newMem, 2048)
label(returnHere)
newMem:
->>cheatCode
->>originalCode
jmp returnHere
->>address:
jmp newMem
->>nops
returnHere:
[DISABLE]
->>address:
->>originalCode
dealloc(newMem)
]]
AOBSCANCodeTemplate = [[
[ENABLE]
AOBSCAN(signatureAddress, ->>arrayOfbyte)
alloc(newMem, 2048)
label(returnHere)
label(address->>NscriptCount)
registersymbol(address->>NscriptCount)
newMem:
->>cheatCode
->>originalCode
jmp returnHere
signatureAddress: //->>comment
address->>NscriptCount:
jmp newMem
->>nops
returnHere:
[DISABLE]
address->>NscriptCount:
->>originalCode
dealloc(newMem)
unregistersymbol(address->>NscriptCount)
]]
-------------------------
function GetInfoInjection(strAddress) -- return adressReturnHere, originalCodeString, nopsString
local sumBytes = 0
local originalCodeString = ""
local adressReturnHere = strAddress
local countBytes = 0
local isFirst = true
repeat
countBytes = getInstructionSize(adressReturnHere)
lineDissassemble = disassemble(adressReturnHere)
extrafield, opcode, bytes, adressReturnHere = splitDisassembledString(lineDissassemble)
sumBytes = sumBytes + countBytes
--adressReturnHere = string.format("%x", ("0x"..adressReturnHere) + countBytes)
adressReturnHere = adressReturnHere..'+'..countBytes
if sumBytes == 5 or isFirst then
isFirst = false
originalCodeString = originalCodeString..opcode
else
originalCodeString = originalCodeString.."\r\n"..opcode
end
until (sumBytes >= 5)
local nopsString = ""
local nopsCount = sumBytes - 5
if (nopsCount>0) then
for i = 1, nopsCount do
if i == nopsCount then
nopsString = nopsString.."nop"
else
nopsString = nopsString.."nop\r\n"
end
end
end
return adressReturnHere, originalCodeString, nopsString
end
function GetFullSignature(startAddress, length) -- return full signature
local bytestring = {}
bytestring = readBytes(startAddress, length, true)
local str=''
for i=1, length do
str=str..string.format('%02X ', bytestring[i])
end
return str
end
-------------------------
function GetScriptAA(strAddress)
local script = AACodeTemplate
local cheatCode = ""
local originalCode = ''
local nops = ''
local adressReturnHere = 0
adressReturnHere, originalCode, nops = GetInfoInjection(strAddress)
script = string.gsub(script,"->>cheatCode", cheatCode)
script = string.gsub(script,"->>originalCode", originalCode)
local baseAddress = getNameFromAddress(strAddress)
script = string.gsub(script,"->>address", baseAddress)
if nops=='' then
script = string.gsub(script,"->>nops\n", nops) --\r\n
else
script = string.gsub(script,"->>nops", nops)
end
script = string.gsub(script,"->>NscriptCount", scriptCount)
return script
end
function GetScriptAOBSCAN()
local address = math.min(dv_address1, dv_address2)
local stop = math.max(dv_address1, dv_address2)
local length = stop + getInstructionSize(stop) - address
if length <= 5 then
print('Sorry. You must selected more 5 bytes')
return
end
local strSignature = GetFullSignature(address, length)
local result = AOBScan(strSignature, "+X-C-W")
local count = -1
local rez = result ~= nil
if rez then
count = strings_getCount(result)
object_destroy(result)
rez = count == 1
end
if not rez then
return
end
local strAddress = getNameFromAddress(address)
local script = AOBSCANCodeTemplate
local cheatCode = ""
local originalCode = ''
local nops = ''
local adressReturnHere = 0
adressReturnHere, originalCode, nops = GetInfoInjection(strAddress)
script = string.gsub(script,"->>arrayOfbyte", strSignature)
script = string.gsub(script,"->>cheatCode", cheatCode)
script = string.gsub(script,"->>originalCode", originalCode)
local comment = string.format('%08x = %s', address, getNameFromAddress(strAddress))
script = string.gsub(script,"->>comment", comment) --// 00ADFCFD = GameDLL_x86.dll+50FCFD
if nops=='' then
script = string.gsub(script,"->>nops\n", nops) --\r\n
else
script = string.gsub(script,"->>nops", nops)
end
script = string.gsub(script,"->>NscriptCount", scriptCount)
return script
end
------------------------------------------------------
function AddAARecord(script, sciptName)
local addresslist = getAddressList()
newTableEntry = addresslist_createMemoryRecord(addresslist)
memoryrecord_setDescription(newTableEntry, sciptName)
memoryrecord_setType(newTableEntry, vtAutoAssembler)
memoryrecord_setScript(newTableEntry, script)
scriptCount = scriptCount + 1
return newTableEntry
end
function OpenAAEditor(newTableEntry)
---???
end
-------Add Item Menu in Disassembler------------------
function OnSelectionTracker(disassemblerview, address, address2)
dv_address1=address
dv_address2=address2
end
function AddItemMenuInMemoryViewForm(nameItemMenu, shortcut, functionItemClick, functionSelectiontracker)
local mv = getMemoryViewForm()
local dv = memoryview_getDisassemblerView(mv)
disassemblerview_onSelectionChange(dv, functionSelectiontracker)
dv_address1 = disassemblerview_getSelectedAddress(mv)
dv_address2 = dv_address1
popupmenu = control_getPopupMenu(dv)
mi = createMenuItem(popupmenu)
menuItem_setCaption(mi, nameItemMenu)
menuItem_onClick(mi, functionItemClick)
menuItem_setShortcut(mi, shortcut)
menuItem_add(menu_getItems(popupmenu), mi)
end
function AddItemMenuSeparatorInMemoryViewForm()
local mv = getMemoryViewForm()
local dv = memoryview_getDisassemblerView(mv)
disassemblerview_onSelectionChange(dv, functionSelectiontracker)
popupmenu = control_getPopupMenu(dv)
mi = createMenuItem(popupmenu)
menuItem_setCaption(mi, '-')
menuItem_add(menu_getItems(popupmenu), mi)
end
function OnItemMenuGenerateAAClick(sender)
local strAddress = getNameFromAddress(dv_address1) -- string.format("%x",address)
local script = GetScriptAA(strAddress)
local newTableEntry = AddAARecord(script,'New Script')
OpenAAEditor(newTableEntry)
end
function OnItemMenuGetSignatureInfoClick(sender)
print('--START--')
local address = math.min(dv_address1, dv_address2)
print('Address: '..getNameFromAddress(address)..' or '.. string.format('%08x', address))
a2 = getPreviousOpcode(address)
a1 = getPreviousOpcode(a2)
a4 = address + getInstructionSize(address)
a5 = a4 + getInstructionSize(a4)
print('')
print('Original view code:')
print(' ' .. disassemble(a1))
print(' ' .. disassemble(a2))
print(' ' .. disassemble(address) .. '<<<')
print(' ' .. disassemble(a4))
print(' ' .. disassemble(a5))
print('')
local stop = math.max(dv_address1, dv_address2)
local length = stop + getInstructionSize(stop) - address
if length <= 5 then
print('Sorry. You must selected more 5 bytes')
return
end
local strSignature = GetFullSignature(address, length)
print('Start AOBScan with '.. strSignature..', with typeMem "+X-C-W"')
local result = AOBScan(strSignature, "+X-C-W")
local count = -1
if result == nil then
print(' ' ..'Sorry. Attention, not find signature by protection "+X-C-W"! Check it out yourself! :(')
else
count = strings_getCount(result)
object_destroy(result)
print('')
if (count == 1) then
print(' ' ..'Signature is unique. Yes, is good! :) ')
else
print(' ' ..string.format('Sorry. Signature is not unique. :( Founded address by protection "+X-C-W" = %s', count))
end
print('')
end
print('Thank you for using this lua-plagin, GameHackLab[RU], 2009-2012(C)')
print('--END--')
end
function OnItemMenuGenerateAAWithAOBSCANClick(sender)
local script = GetScriptAOBSCAN()
local newTableEntry = AddAARecord(script, 'New AOBSCAN-Script ')
OpenAAEditor(newTableEntry)
end
-----------------------------------------------------
AddItemMenuSeparatorInMemoryViewForm()
AddItemMenuInMemoryViewForm('* Create AA', 'Ctrl+Shift+A', OnItemMenuGenerateAAClick, OnSelectionTracker)
AddItemMenuInMemoryViewForm('* Create AA-aobsan', 'Ctrl+Shift+B', OnItemMenuGenerateAAWithAOBSCANClick, OnSelectionTracker)
AddItemMenuInMemoryViewForm('* Get signature info', 'Ctrl+Shift+I', OnItemMenuGetSignatureInfoClick, OnSelectionTracker) |
|
|
Back to top |
|
 |
Zadkos How do I cheat?
Reputation: 0
Joined: 20 Mar 2010 Posts: 9
|
Posted: Mon Nov 19, 2012 6:33 am Post subject: Gj!:) |
|
|
That's awesome!
Can something like this be used to replace the original auto assembler templates?
A bit off topic, is there any way to make my auto assembler preferences persistent? Normally, everytime I open the Cheat Engine the preferences are reseted to default.
|
|
Back to top |
|
 |
GH*master Expert Cheater
Reputation: 8
Joined: 10 Jan 2008 Posts: 159
|
Posted: Wed Nov 28, 2012 12:42 pm Post subject: |
|
|
Ver 2.1 (year 2012)
Many fixed and more power, more templates AA... Sorry about my tiny comments... laziness
1) Plagin_MenuDisassembler_GenericAA.lua
2) CreateCheat.frm
Plagin_MenuDisassembler_GenericAA.7z
Authors:
1) SnedS91
2) GH*master
|
|
Back to top |
|
 |
Keule Cheater
Reputation: 0
Joined: 08 Aug 2012 Posts: 25
|
Posted: Mon Nov 25, 2013 2:19 pm Post subject: |
|
|
There is a Bug with CE 6.3, didnt tested with lower Versions.
If you try to run a .CT file directly, CE will show a Error-Message saying, that he cant find the "CreateCheat.frm" file.
Here the little fix:
Line 70:
Code: | form = createFormFromFile('autorun\CreateCheat.frm') |
exchange to:
Code: | form = createFormFromFile('autorun\CreateCheat.frm', getCheatEngineDir()) |
|
|
Back to top |
|
 |
|
|
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 cannot download files in this forum
|
|