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 


Cheat Engine Forum Index
PostGo back to topic
mgr.inz.Player
I post too much
Reputation: 161
Joined: 07 Nov 2008
Posts: 4358
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Jul 22, 2016 8:20 pm    Post subject:

Quick and dirty function for CE6.5.1 64bit

Every memoryrecod has Hotkeylist object (TList class).

So the idea is:
1. e.g. you have 5 entries/memrecs, set hotkey(s) to at least one, highlight them (one with hotkey and 4 without) and rightclick to bring popup menu.
2. below autorun script will go through all selected/highlighted memrecs in addresslist.
3. it will find the one with hotkeys, and use it as the source
4. in other selected memrecs, it will replace the pointer to Hotkeylist, so it will point to "source Hotkeylist"
5. from now on, changing hotkeys in one memrec (of those 5) will change for the other 4.
6. Now save the CT file.


6. because this method is "hackish" and few memrecs will share the same object:
a) save it as new CT file (do not overwrite the original). And just close CE.
b) and do not delete any of the altered memrecs when you just used this function (removing one will free shared Hotkeylist, and this will lead to "access violation" in other memrecs). Just do step 6a, then launch CE, open CT file, and you can edit without any issues, there's no longer shared Hotkeylist object.



Code:
function duplicateHotkeysForSelectedMemRecs()
  if not (getCEVersion()==6.51) then return end
  if not cheatEngineIs64Bit() then return end

  if messageDialog("'Duplicate Hotkeys for selected MemRecs'\nAre you sure?",mtInformation,mbYes,mbNo) == mrNo then
    return
  end

  local AL=getAddressList()

  local indexOfMR=nil

  -- find MR with hotkeys
  for i=0,AL.Count-1 do
    if AL[i].Selected and AL[i].HotkeyCount>0 then
      indexOfMR = i
      break
    end
  end

  if indexOfMR==nil then return end

  local addressOfMR = userDataToInteger(AL[indexOfMR])
  local addressOfHotkeylistTList = readQwordLocal(addressOfMR + 0x48) -- Hotkeylist: TList; //at offset 0x48

  -- replace Hotkeylist for all selected MRs
  for i=0,AL.Count-1 do
    if i~=indexOfMR and AL[i].Selected then
      local addressOfOtherMR = userDataToInteger(AL[i])
      writeQwordLocal(addressOfOtherMR+0x48,addressOfHotkeylistTList)
    end
  end

end

local PopupMenu2=getMainForm().findComponentByName("PopupMenu2")
local duplicateHotkeys = createMenuItem(PopupMenu2)
duplicateHotkeys.Caption= "Duplicate Hotkeys for selected MemRecs"
duplicateHotkeys.Name = "duplicateHotkeysForSelectedMemRecs"
duplicateHotkeys.OnClick = duplicateHotkeysForSelectedMemRecs
PopupMenu2.Items.add(duplicateHotkeys)

_________________
Dark Souls II Item Swap and Item List
My Borderlands2 tables

Recent CheatEngine builds
Back to top
View user's profile Send private message MSN Messenger
Post reviews:   Approve 1
Author Review
++METHOS
Review: Approve
Post reference:
ReviewPosted: Sat Jul 23, 2016 4:46 am


Back to top
View user's profile Send private message
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites