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 


[Newbie needs help]Trainer that changes values of addresses?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials
View previous topic :: View next topic  
Author Message
Gou
Cheater
Reputation: 0

Joined: 02 Oct 2017
Posts: 39

PostPosted: Mon Oct 02, 2017 5:48 am    Post subject: [Newbie needs help]Trainer that changes values of addresses? Reply with quote

Hello guys!
So the other day, i was messing around with CE and pcsx2, and now i want to make a couple of trainers for some ps2 games.
I already found most of the addresses that i need, but i dont understand how i can make a trainer that will change their values.
The addresses are static, and they dont change after i restart pcsx2. So if i understand this correctly, i wont need to mess with pointers.
The basic idea is to make a trainer that can give you infinite ammo for a weapon with the click of a checkbox.
Can somebody give me an example for the code?
Lets say that i want the value of 2013D58C to stay at 50, when the checkbox is checked.
I can just add this address manually on CE and change my ammo number. But a trainer would be nice.
I have some C knowledge, but from what i've seen, it wont help me Razz
I also have some very very basic knowledge of assembly.
Thanks, and sorry for the newbie questions!

edit: please move this thread. posted in this section by accident


Last edited by Gou on Mon Oct 02, 2017 8:14 am; edited 1 time in total
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Mon Oct 02, 2017 6:07 am    Post subject: Reply with quote

You create a form (or use the one that comes from File->"Generate generic trainer lua script from table"), add a checkbox, goto the events tab with that checkbox selected and add an onchange event (click the ...s) and make it look like this
Code:
function CECheckbox1Change(sender)
  getAddressList().getMemoryRecordByDescription("ammo").Active = sender.Checked
end


Then, as long as you have a memory record named "ammo" with the address of the ammo, checking the checkbox on the trainer gui will do the same thing as checking the checkbox on CE's main gui next to the memory record (ie. freeze the value). If you want to set the value at the same time you could use

Code:
function CECheckbox1Change(sender)
  local ammoMemrec = getAddressList().getMemoryRecordByDescription("ammo")
  ammoMemrec.Active = sender.Checked
  if sender.Checked then ammoMemrec.Value = 99 end
end
Back to top
View user's profile Send private message
Gou
Cheater
Reputation: 0

Joined: 02 Oct 2017
Posts: 39

PostPosted: Mon Oct 02, 2017 7:02 am    Post subject: Reply with quote

damn! now i feel stupid.
thanks man! i appreciate it!

edit:

well, i need some more help on making a script Rolling Eyes

so in the game ratchet and clank, you can change the value of an address(2015F6A8) to 4294967295, and you will access the debug menu.
problem is that i dont know how to make the script for it.
so i'm trying to use auto asseble, by first inserting cheat table framework template, and then code injection template.
i added the highlighted line, to change the value(see pic), but when i run the script the value is way off from what i wanted.
i removed tha line that i added, and it still returns the same number in the address value.
what am i missing?



Capture.JPG
 Description:
 Filesize:  62.55 KB
 Viewed:  13029 Time(s)

Capture.JPG


Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Mon Oct 02, 2017 12:40 pm    Post subject: Reply with quote

Code:
[ENABLE]
2015F6A8: // address to change
  dw 4294967295 // dword/4-byte value to write
[DISABLE]
2015F6A8:
  dw 0


You can't use assembly code like mov unless you're hooking a function (or creating your own to be called with createThread)
Back to top
View user's profile Send private message
Gou
Cheater
Reputation: 0

Joined: 02 Oct 2017
Posts: 39

PostPosted: Mon Oct 02, 2017 1:53 pm    Post subject: Reply with quote

Thanks man!
This works with everything else that dont need such a big number.
But i am still getting a value that is waay off with this one.
Instead of 4294967295, it returns 29333 in the address value.
Sorry for the stupid questions, but i haven't used CE before.
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Mon Oct 02, 2017 4:05 pm    Post subject: This post has 1 review(s) Reply with quote

Gou wrote:
Instead of 4294967295, it returns 29333 in the address value.
hm, well since 2933 is 7295 in hex that would make sense for a 2 byte value (because for some reason I typed dw (define word) instead of dd (define doubleword)) when 4294967295 was read as hex because I forgot the (int) to tell CE to use decimal/base 10.

so... all my fault, I hadn't even just woken up so no real excuses for that... Embarassed, sorry!

Code:
[ENABLE]
2015F6A8: // address to change
  dd (int)4294967295 // double word/4-byte value to write
[DISABLE]
2015F6A8:
  dd 0
Back to top
View user's profile Send private message
Gou
Cheater
Reputation: 0

Joined: 02 Oct 2017
Posts: 39

PostPosted: Mon Oct 02, 2017 4:19 pm    Post subject: Reply with quote

Dude! Are you serious? Saying sorry n shit hahaha. I should be the one asking sorry, not you!
Everything works like a charm!
You rock! Thanks for everything, once again!

Edit: I appreciate all of your help man!
I just have one last question Laughing
How can i insert a value, and freeze it? I've been searching on google for like day, but i cant find anything that applies to my case.
Thanks once again!
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 Tutorials 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