Step 5
Editing the opcodes of a program.
This is the gold mine...what you've been waiting for. It allows almost anything to be done...unless your game checks the memory, then you need either a CRC bypass or to modify registers. (register modifying is coming soon...hopefully)
OK if you're not a fan of assembly...TOO BAD YOU HAVE TO LEARN THIS!.
As you know, OpCodes are the heart of disassembled 32-bit programs. And if you can edit these...you are set! In fact, if you can edit these, you don't really need debug registers, because with those...you are limited to four, but you never run out of opcodes to changes...so let's get started.
OK, we know that editing opcodes is our goal, but how do we do that? The answer is Hex Dumps, (or in cheat engine array of bytes), it's very easy too!
Now for writing 4 byte values...you had to convert back and forth...this was not easy! This is much more straight forward, so let's start!
Add an address as Array of Byte in Cheat Engine record its value (hexadecimal) and then change its opcode. Note that the AOB changes! Now, all you have to do is change the AOB of an address to change its opcode, but how to do this? Simple...watch!
Suppose an address's AOB is 00 (add [eax],al), but you want to change the opcode to jmp 0, this is very easy to find...change the opcode to jmp 0 and look at the new AOB it happens to be E9 D7 69 FF FE 90 and then 0's forever. These 0's can be ignored. So here's how i would do this:
int byteswritten;
byte[] memory={ 0xe9, 0xd7, 0xff, 0xfe, 0x90 };
preader.WriteProcessMemory((IntPtr)0x1001d07,memory,out byteswritten);
Remember that when you do this, you only have to change UP to where the bytes changed...for instance if I change the opcode and only the second byte changes I could do this:
original: af 8f 8a 0a 4f
after opcode change: af 3f 8a 0a 4f
I could change the above yellow text to:
0xaf, 0x3f
I know that this too can be complicated and hard to write out so I've written a program to do most of the thinking for you!
And you can visit the TMH help page this program generates all of the code that you should need to make a trainer.
You've now completed Step 5, and the entire tutorial, now check out TMH!