Posted: Mon Jan 18, 2016 5:54 am Post subject: CE Request
Allow multiple entries inside the cheat table to be batch-edited for assigning hotkey and setting group config options. Currently, even with multiple entries highlighted, only the one entry that is right-clicked is affected. I know child entries can be used, but that is limited and is not always preferred.
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
Posted: 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)
Thanks, mgr.inz.Player! Sounds a bit tricky. I hope you don't mind...I will have to test this out later, when I have more time. Thank you so much for taking the time!
EDIT:
I decided to do a quick test on this and I am unable to get it working properly. I do not know if another LUA plugin is interfering, or if I am just doing something wrong.
The steps that I took:
Saved script as .LUA and placed in autorun folder.
1. Opened table.
2. Highlighted a single entry and assigned a hotkey to it.
3. Highlighted multiple entries, including the first entry, and chose to duplicated hotkeys across multiple entries.
4. Checked empty entries to see if hotkey was copied over - it was not.
5. Manually assigned the same hotkey to one of the empty entries to see if it would be copied over to any of the other entries - it was not.
1. Opened table.
2. Highlighted a single entry and assigned a hotkey to it.
3. Highlighted multiple entries, including the first entry, and chose to duplicated hotkeys across multiple entries.
4. Save the table, did not replace original and closed CE.
5. Opened newly revised table to check if newly assigned hotkeys copied over - they did not.
6. Tried to assign a hotkey to one of the empty entries to see if they would copy over - they did not.
1. Opened table.
2. Highlighted a multiple entries and assigned a hotkey to them.
3. Highlighted the same, multiple entries and chose to duplicated hotkeys across multiple entries.
4. Save the table, did not replace original and closed CE.
5. Opened newly revised table to check if newly assigned hotkeys copied over - they did not.
6. Tried to assign a hotkey to one of the empty entries to see if they would copy over - they did not.
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
Posted: Sun Jul 24, 2016 7:49 am Post subject:
In official CE651 memory record has "Hotkeylist: TList" at offset 0x48.
In other releases it can change. There is a method to find correct offset for your CE version:
1 start CE, attach CE to itself
2 add one memory record (can be simple address, pointer or AA script)
3 assign few hotkeys to that entry, e.g. three
4 do 4byte scan with value 3
5 assign another hotkey to that entry (or delete), e.g. now you have four
6 do 4byte scan with value 4 (number of currently assigned hotkeys)
7 you will find address of FCount
8 do print( getAddressList()[0] ) you will get address of memory record
9 then use structure spider.
For me it is:
FCount - 09F5AE40
memory record - 0C6B7E40
As you see, this "[[memrec+80]+8]+10" points to FCount and "[memrec+80]+0" points to TList
Address of TList is at "memrec+80"
So, I have to use 0x80 in the script for my current CE version (custom build). _________________
Thanks, mgr.inz.Player. It's good to know. Hopefully, DB can implement a permanent solution. If not, I am happy with this. Thank you. (+rep when I can)
In official CE651 memory record has "Hotkeylist: TList" at offset 0x48.
In other releases it can change. There is a method to find correct offset for your CE version:
1 start CE, attach CE to itself
2 add one memory record (can be simple address, pointer or AA script)
3 assign few hotkeys to that entry, e.g. three
4 do 4byte scan with value 3
5 assign another hotkey to that entry (or delete), e.g. now you have four
6 do 4byte scan with value 4 (number of currently assigned hotkeys)
7 you will find address of FCount
8 do print( getAddressList()[0] ) you will get address of memory record
9 then use structure spider.
For me it is:
FCount - 09F5AE40
memory record - 0C6B7E40
As you see, this "[[memrec+80]+8]+10" points to FCount and "[memrec+80]+0" points to TList
Address of TList is at "memrec+80"
So, I have to use 0x80 in the script for my current CE version (custom build).
thanks for the info. i had been meaning to find where the hotkeys were, but i was only comparing the first level for memory record lol and only found the isEditing flag.
just a side question, when structure dissect locks a structure, how much of the memory is shadowcopied? just the structure itself or a fixed region of memory around it?
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
Posted: Sun Jul 24, 2016 9:07 am Post subject:
predprey wrote:
just a side question, when structure dissect locks a structure, how much of the memory is shadowcopied? just the structure itself or a fixed region of memory around it?
Code:
if parent.parent.MainStruct<>nil then
size:=max(8192, parent.parent.MainStruct.getStructureSize)
else
size:=8192;
Maximum 8192 bytes. Or as much as structure size, not bigger than 8192 bytes.
Edit:
Damn, there is max not min. So:
Minimum 8192 bytes. Or as much as structure size. _________________
just a side question, when structure dissect locks a structure, how much of the memory is shadowcopied? just the structure itself or a fixed region of memory around it?
Code:
if parent.parent.MainStruct<>nil then
size:=max(8192, parent.parent.MainStruct.getStructureSize)
else
size:=8192;
Maximum 8192 bytes. Or as much as structure size, not bigger than 8192 bytes.
Works great, mgr.inz.Player! This is a lot better. Thanks!
I couldn't get it to work at first, because I didn't know that you had to press apply before clicking on the 'bulk edit' button. Also, there is a 0 in the bottom-right corner, for some reason. This is true, even if I set multiple hotkeys using bulk edit.
It just alters (set the same TList for all selected MR), saves to TEMP, restore original TList(so destroy will work without issues), loads table from TEMP
++METHOS wrote:
Also, there is a 0 in the bottom-right corner, for some reason.
I got this 0 even when I remove all extensions (I renamed autorun folder). Try this: set few hotkeys manually in one MR, and then reopen hotkey window.
Looks like another plugin for you. You should add it to the plugin sub-forum. Hopefully, some of these feature that are being created with LUA can be permanently added to CE, or to the autorun folder, by default. I don't imagine it would be too difficult to maintain compatibility with LUA updates. I owe you +reps.
For official CE651. Here's a WIP Batch Add Hotkey extension. It's a ASM hack and uses CE's native code to add to all selected records. Records need to be highlighted when you press the apply button in the create interface. Probably won't work with other CE versions since the pointers and aob would be different.
I tried using LuaCallFunction but it seems to get into an infinite loop and freeze after the syscall to execute the lua code. If someone can tell me how to avoid that I may be able to make this extension compatible with more versions of CE. I tried running the LuaCall in a native thread, didn't work either.
P.S. love how the extension subsection is getting livelier
EDIT: Download moved to CEnhancer thread. See signature below. _________________
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