SunBeam wrote: ↑Mon Jan 10, 2022 11:50 pm
Horse4Horse wrote: ↑Mon Jan 10, 2022 9:52 pm
why I'm getting a "Invalid address for ReadMem" error in code like this:
"when game is updated" -> Your snippet won't be the same when the game is updated. Once the executable is recompiled chances are high that the alignment will relocate functions/instructions. So that address of yours - 4B1EFE - won't show a "call 0046D5A0", but something else, if you inspect it in Memory View. So you will need to re-find the location to begin with (where you have your CALL that you want to switch with another).
There are quite a few things you need to do BEFORE all of your questions. And that could get solved if you study a bit more. For example: what is the formula to calculate a destination from a known EP? (If you ask me what EP means, then I dunno...)
I think answer to the first part are already said, it's script handler error, and not my brain damage(phew), so I dont include that as quote.
It's hard to explain my idea, but I'll try.
Injecting are done every time in the exact location, and all code in between "desired" and "original" can be changed in numbers, but not in lenght. So "desired" is always be "INJECT+0" and "original" will be always a "INJECT+11". All what I plan - is to read that "desired" bytes, then subtract 11 bytes from second byte of it, and write that to "INJECT+11". Because at "INJECT+11" it will be correct call to the "desired" location.
Even easer - I can just "readmem(INJECT+1,1)", and calculate that one byte, because all other bytes wont change at all(two calls arent separated enough, but if "desired" will something on the borderline - better to increase readmem to 2 bytes).
I know, that I'm searching with aobscan - that call instruction, and after any update it will be changed, and aobscan fail. I just trying find a easy example to explain my idea. Real injection will be in the place without all that variables(calls, jumps, movs etc), just with unique bytes.
Maybe I dont understand something, but I checked out that part in other game versions - and these two calls separated exaclty by 11 bytes every time. So in theory it is possible.
I need to separate scripts(mainly because of the first problem) and in the first script calculate "desired_calculated" from "desired-(desired-original)=desired_calculated". Or simply "desired-0x11 = desired_calculated" - because spacing between calls likely will not change. And if will - so "original" value wil be wrong already, because "readmem" will read wrong bytes from wrong location(maybe like a "xor eax,eax" and etc).
So how about it?
And yea, I dont know about an entry point, only a year passed after I started to learn CE seriosly, from an easy and unstable solutions to more complex and failproof(mainly because I tired to fix everything after game updates).