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 


Open "AddressListAutoAssemblerEdit" in CE

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 159

PostPosted: Thu May 03, 2012 1:00 am    Post subject: Open "AddressListAutoAssemblerEdit" in CE Reply with quote

Hello

How I can do call function in CE 6.2 RC ?

MainUnit.pas:
Code:
AddressListAutoAssemblerEdit(Sender: TObject; memrec: TMemoryRecord)


Its is possible from CE Lua? Maybe I can showing AutoAssemblerEdit within linking "newTableEntry"...

Code:
newTableEntry = addresslist_createMemoryRecord(addresslist)


I tried and finally tired to find some any solution.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu May 03, 2012 4:53 am    Post subject: Reply with quote

you can't. This method type isn't implemented yet and it's not even a published function.
Using the popupmenu change->script also won't work as there's no way to select a memoryrecord right now
What you could try is launching the auto assembler window using memoryview->auto assembler
then find the assemblescreen object and set the text property to the script.
Hook the execute button, and when clicked close the window and update the script

Or alternatively, just popup your own form with a memo and use that

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 159

PostPosted: Thu May 03, 2012 5:35 am    Post subject: Reply with quote

If you can, then add this function in Lua. That would be great Razz

OpenAddressListAutoAssemblerEdit(memrec)

I share my script. Unfortunately the AA-editor did not open automatically.

AAgenerate.lua
Code:
--[[
Version 1.0
This CE Lua code generate autoassembler code on CE 6.2 Beta 5
]]--

AACodeTemplate = [[
[ENABLE]
alloc(newMem, 2048)
label(returnHere)

newMem:
->>cheatCode
->>originalCode
jmp returnHere

->>address:
jmp newMem
->>nops
returnHere:

[DISABLE]
->>address:
->>originalCode

dealloc(newMem)
]]
-------------------------
   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
            print('A')
            print(sumBytes)
            originalCodeString = originalCodeString..opcode
         else
            print('B')
            print(sumBytes)
            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 GenerateAA(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
   
   return script
end

function AddAARecord(script)
   local addresslist = getAddressList()
   newTableEntry = addresslist_createMemoryRecord(addresslist)
   memoryrecord_setDescription(newTableEntry, 'New Script')
   memoryrecord_setType(newTableEntry, vtAutoAssembler)
   memoryrecord_setScript(newTableEntry, script)   
   return newTableEntry
end

function OpenAAEditor(newTableEntry)
   ---???
end
------------------------------------------------------
function CreateAndShowingAA(strAddress)
  local script = GenerateAA(strAddress)
  local newTableEntry = AddAARecord(script)
  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 OnItemMenuGenerateAAClick(sender)
  local strAddress = getNameFromAddress(dv_address1) -- string.format("%x",address)
  CreateAndShowingAA(strAddress)
end
-----------------------------------------------------


AddItemMenuInMemoryViewForm('* Create AA', 'Ctrl+Shift+A', OnItemMenuGenerateAAClick, OnSelectionTracker)
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 Lua Scripting 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