Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Trying to replace an inc with addition of 2 or more

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
FragrantRegard
How do I cheat?
Reputation: 0

Joined: 01 Jan 2016
Posts: 4
Location: Seattle

PostPosted: Fri Jan 01, 2016 11:20 pm    Post subject: Trying to replace an inc with addition of 2 or more Reply with quote

Within the memory, at one address I isolated a snippet of code like this:

Code:
inc [eax]


Instead of just increasing eax by 1, I wanted to increase it by 2 or some other arbitrary value. I attempted to replace it with an auto-assembler script like this:

Code:
[ENABLE]
alloc(newmem, 2048)
label(returnhere)
label(originalcode)
label(exit)

0027041D:
jmp newmem
nop
returnhere:

newmem:
add [eax], 2
jmp returnhere

originalcode:
inc [eax]

exit:
jmp returnhere

[DISABLE]
0027041D:
inc [eax]


I assume since the inc and an add would be different numbers of bytes that this has caused my issue where the program instantly crashes.

Sorry if wrong subforum.

_________________
Working on spelunky hax
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Jan 01, 2016 11:32 pm    Post subject: Reply with quote

You should use Cheat Engine's AOB Injection template instead of trying to write it manually.
In Auto assemble, Template > AOB Injection

You're likely crashing because your jump overwrote more than just "inc [eax]" and the game needed those instructions.
Back to top
View user's profile Send private message
FragrantRegard
How do I cheat?
Reputation: 0

Joined: 01 Jan 2016
Posts: 4
Location: Seattle

PostPosted: Sat Jan 02, 2016 12:31 am    Post subject: Reply with quote

That did the trick, thank you. And with AOB Injection, that also means I shouldn't have issues with RAM addresses changing upon multiple restarts of the game?
_________________
Working on spelunky hax
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Jan 02, 2016 12:35 am    Post subject: Reply with quote

Correct
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Sat Jan 02, 2016 2:01 pm    Post subject: Reply with quote

FragrantRegard wrote:
That did the trick, thank you. And with AOB Injection, that also means I shouldn't have issues with RAM addresses changing upon multiple restarts of the game?



Aob injection scans the games/programs operation codes. Cheat engine scans for this pre defined string of characters in the .exe file its self. Then creates a registered symbol to track that point and creates a jump to new allocated memory. In this new memory you can write in your own code.

Yes that .exe is loaded in your RAM that makes it random to your memory but its not random at all according to cheat engine.

AOB is basically there to deal with version variations of a program.

Its all code injection in the end.

RAM addresses changing upon restart is a "pointer" thing about dynamic memory.

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites