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 


Can someone remind me how the code in this script works?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Bunny_Wabbit
Newbie cheater
Reputation: 0

Joined: 23 Sep 2017
Posts: 23
Location: United Kingdom

PostPosted: Sat Jan 29, 2022 7:30 pm    Post subject: Can someone remind me how the code in this script works? Reply with quote

So I've been looking for Cheat Engine trainers for the current patch of Streets of Rage 4, and I found a table that ColonelRVH made that enabled infinite health, infinite star specials and what not. The thing is, I don't want to complete cheat at this game, but to train myself to get better at a specific stage by gradually reducing the amount of health starts with, or reducing the amount of damage that dealt by enemies.

So I was wondering if it's possible to amend this script, to make it so that rather than have unlimited health, just have twice as much health to start with, or three times as much. I haven't coded scripts in ages but the 'nop' makes me wonder if that's just nulling the damage enemies deal.

Code:
aobscanmodule(Get_HP_AOB,SOR4.exe,8B 53 38 89 50 14) // should be unique
alloc(newmem,$1000,"SOR4.exe"+43653A)

label(code)
label(return)

newmem:
  mov [rbx+38],640000
code:
  mov edx,[rbx+38]
  mov [rax+14],edx
  jmp return

Get_HP_AOB:
  jmp newmem
  nop
return:
registersymbol(Get_HP_AOB)

[DISABLE]
Get_HP_AOB:
  db 8B 53 38 89 50 14

unregistersymbol(Get_HP_AOB)
dealloc(newmem)


I just can't remember how to use code well enough and I was hoping someone here could perhaps understand it well enough to know what I'd have to amend to make it so rather than have unlimited health, I just have twice or three times as much.

Thanks in advance guys.

Edit: It's worth noting that the game completely crashes if I attach the debugger when clicking "Find out what accesses this address".
Back to top
View user's profile Send private message
Frouk
Grandmaster Cheater
Reputation: 6

Joined: 22 Jun 2021
Posts: 528

PostPosted: Sun Jan 30, 2022 1:57 am    Post subject: Reply with quote

We don't support online game hacking:
https://forum.cheatengine.org/faq.php#0
Back to top
View user's profile Send private message
Bunny_Wabbit
Newbie cheater
Reputation: 0

Joined: 23 Sep 2017
Posts: 23
Location: United Kingdom

PostPosted: Sun Jan 30, 2022 4:03 am    Post subject: Reply with quote

Frouk wrote:
We don't support online game hacking:
https://forum.cheatengine.org/faq.php#0


Haha I'm sorry but where did you get the idea that Streets of Rage 4 was online? You can play cooperatively or compete on a leaderboard but the vast majority of people are there for the single player.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1072
Location: 0x90

PostPosted: Sun Jan 30, 2022 7:44 am    Post subject: Re: Can someone remind me how the code in this script works? Reply with quote

Bunny_Wabbit wrote:
So I've been looking for Cheat Engine trainers for the current patch of Streets of Rage 4, and I found a table that ColonelRVH made that enabled infinite health, infinite star specials and what not. The thing is, I don't want to complete cheat at this game, but to train myself to get better at a specific stage by gradually reducing the amount of health starts with, or reducing the amount of damage that dealt by enemies.

So I was wondering if it's possible to amend this script, to make it so that rather than have unlimited health, just have twice as much health to start with, or three times as much. I haven't coded scripts in ages but the 'nop' makes me wonder if that's just nulling the damage enemies deal.

Code:
aobscanmodule(Get_HP_AOB,SOR4.exe,8B 53 38 89 50 14) // should be unique
alloc(newmem,$1000,"SOR4.exe"+43653A)

label(code)
label(return)

newmem:
  mov [rbx+38],640000
code:
  mov edx,[rbx+38]
  mov [rax+14],edx
  jmp return

Get_HP_AOB:
  jmp newmem
  nop
return:
registersymbol(Get_HP_AOB)

[DISABLE]
Get_HP_AOB:
  db 8B 53 38 89 50 14

unregistersymbol(Get_HP_AOB)
dealloc(newmem)


I just can't remember how to use code well enough and I was hoping someone here could perhaps understand it well enough to know what I'd have to amend to make it so rather than have unlimited health, I just have twice or three times as much.

Thanks in advance guys.

Edit: It's worth noting that the game completely crashes if I attach the debugger when clicking "Find out what accesses this address".


AOB injection scripts consistently execute the code every time the game accesses that particular function.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 155

Joined: 06 Jul 2014
Posts: 4775

PostPosted: Sun Jan 30, 2022 2:13 pm    Post subject: Reply with quote

The nop instruction is just there for padding. The jmp instruction takes up 5 bytes, but there were 6 bytes there originally. The nop makes up for the 1 byte not overwritten such that the return label is placed at the correct address.

rbx+38 looks interesting. Look at what addresses that instruction accesses- if this script really changes as much as you say it does, that instruction likely accesses many addresses. If you only want to change a few, you might need to differentiate them from other addresses. See step 9 of the CE tutorial for more information.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4196

PostPosted: Sun Jan 30, 2022 7:29 pm    Post subject: Reply with quote

Code:
mov [rbx+38],640000


This is the only code that is doing anything in your script. It is moving 6,553,600 (640000 Hex) into whatever address holds your health value (and many others, probably). If you want to change the amount, simply change the 640000 to something smaller.

That being said, as already mentioned, this code is getting executed all of the time, so your health and other values will never change unless you change your script to allow for that. One simple approach would be to add a switch that only executes this command once, on demand.

I would really recommend completing the CE tutorial, as suggested, since it will help you to develop a better understanding.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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