| View previous topic :: View next topic |
| Author |
Message |
Bswap Newbie cheater
Reputation: 0
Joined: 18 Aug 2009 Posts: 21
|
Posted: Sun Nov 01, 2009 9:28 pm Post subject: Redirecting code! JMP or CALL |
|
|
When gamehacking we have to redirect code execution away from the main game code quite a lot... for most of us, this is quite a basic task, but it does pose the question, what is better; JMP or CALL?
Each have their benefits and cons.
JMP pros: easy to use. does not alter flags or stack.
cons: requires knowing return address, balancing overwritten instructions
CALL pros: does not require balancing of overwritten instructions
cons: modifies stack (esp)
I imagine there would be slight performance differences between them too.
I'm opening up this thread to anyone and everyone, im eager to hear your thoughts on this subject.
Peace
|
|
| Back to top |
|
 |
CourtneyMarie How do I cheat?
Reputation: 0
Joined: 27 Oct 2009 Posts: 4
|
Posted: Mon Nov 02, 2009 3:37 am Post subject: |
|
|
Jmp is easier to use I'd stick to jump
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 474
Joined: 09 May 2003 Posts: 25953 Location: The netherlands
|
Posted: Mon Nov 02, 2009 6:04 am Post subject: |
|
|
call DOES require balancing of overwritten instructions
both call and jmp are 5 byte instructions. They need to be placed somewhere, so they do overwrite memory.
In the case of call, the return will be right after the call. That means if you overwrote a 6 byte instruction you HAVE to nop the last byte out
In the case of a jmp you don't have to nop it out (it's usually better to do so for readability, but not required) you can just jump after the overwritten instruction (and saves execution time, but really, you won't notice)
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
|