View previous topic :: View next topic |
Author |
Message |
Reclaimer Shawn Advanced Cheater Reputation: 0
Joined: 09 Jun 2015 Posts: 77
|
Posted: Mon Dec 10, 2018 6:39 pm Post subject: Using Cheat Engine to Make a Hex Editor? |
|
|
Alright, so I know how to make executable trainers and I've noticed that Cheat Engine can open files as memory and write to them. Knowing this, I have files for a video game I'd like to hex edit. Instead of hex editing myself in HxD, I'd like to make a program to do it automatically for me as the addresses in these physical files never change and they aren't encrypted. The value I'd need to write is also always the same. So, I'd need to make a tool (preferably with Cheat Engine) that opens a file, replaces hex values in said file at certain addresses, and then either saves those changes to the file or exports a new file with the hex edited changes. How would I go about doing that with a Cheat Engine UI?
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4297
|
Posted: Mon Dec 10, 2018 9:36 pm Post subject: |
|
|
The easiest way to do this with CE is probably to just use the Lua IO library.
Relevant section of the manual; search for examples anywhere (CE's API is unrelated).
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25291 Location: The netherlands
|
Posted: Tue Dec 11, 2018 1:45 am Post subject: |
|
|
openFileAsProcess
then aobscan or whatever, edit
and when done saveOpenedFile
_________________
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 |
|
|
Reclaimer Shawn Advanced Cheater Reputation: 0
Joined: 09 Jun 2015 Posts: 77
|
Posted: Tue Dec 11, 2018 1:54 pm Post subject: |
|
|
Dark Byte wrote: | openFileAsProcess
then aobscan or whatever, edit
and when done saveOpenedFile |
Thanks Dark Byte! What you told me has worked. The code that I'd use to modify the file is below:
Code: |
function CEButton1Click(sender)
local path = "D:/Desktop Files/Gaming/Halo CE Stuff/maps/bloodgulch.map"
openFileAsProcess(path, r)
writeBytes ("00000004", 7, 0)
saveOpenedFile(path)
end
|
That works for me considering I've set the path in the code and I'll never move my directory for modifying my files. Now, the only problem is I want the user to be able to set the path themselves without modifying the code. It'd basically be opening a windows prompt to open the file, and after selecting said file, the path becomes the path of the file selected. How would I go about doing that?[/code]
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Tue Dec 11, 2018 2:03 pm Post subject: |
|
|
Check out the celua.txt file that comes with Cheat Engine, it has all the info on what's available to the Lua state.
You would want to look into:
- OpenDialog
- FileDialog
_________________
- Retired. |
|
Back to top |
|
|
Reclaimer Shawn Advanced Cheater Reputation: 0
Joined: 09 Jun 2015 Posts: 77
|
Posted: Tue Dec 11, 2018 4:59 pm Post subject: |
|
|
atom0s wrote: | Check out the celua.txt file that comes with Cheat Engine, it has all the info on what's available to the Lua state.
You would want to look into:
- OpenDialog
- FileDialog |
Thanks atom0s! That got it working for me. Here's the finished code:
Code: |
function CEButton1Click(sender)
load_dialog = createOpenDialog(self)
load_dialog.InitalDir = os.getenv('%USERPROFILE%')
load_dialog.execute()
local path = load_dialog.FileName
openFileAsProcess(path, r)
writeBytes ("00000004", 7, 0)
saveOpenedFile(path)
end
|
|
|
Back to top |
|
|
|