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 


is there a way to preload code?

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

Joined: 13 Feb 2024
Posts: 17

PostPosted: Tue Feb 20, 2024 4:00 pm    Post subject: is there a way to preload code? Reply with quote

So I've been enjoying making scripts for a little while and I've been having this issue, so when I use other peoples cheat tables they have a script that activates the whole table and each script works right away but when I make a small cheat table most of them don't work until I do a certain action in game, how can I make a script that will preload those AOB injection scripts so I don't have to do an action and so they can work right away?
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Feb 20, 2024 4:27 pm    Post subject: Reply with quote

You can create an injector or hard-coded patch, but typically, code that requires pre-action is usually the result of using injection points that 'write' to code in lieu of 'accessing' code. When accessing code, you can utilize 'read' instructions that may not require a write (action).
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 150

Joined: 06 Jul 2014
Posts: 4657

PostPosted: Tue Feb 20, 2024 4:30 pm    Post subject: Reply with quote

All code injections take place immediately. The game must actually run the original code for your code injection to do anything.

When you look at the "Find out what instructions access this address" window, some instructions pop up immediately and continuously access the value (the count keeps increasing). Other instructions only pop up when you do certain actions: e.g. for money, maybe buying something or opening your inventory makes certain instructions access your money. In such cases, the game is only running that code in that specific circumstance, and if you inject code there, your code will only be run in that specific circumstance too.

If you don't like that, try using a different injection point. Specifically one that continuously accesses the address you want. Make sure it doesn't access any other addresses.

_________________
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
xenowyaa
Newbie cheater
Reputation: 0

Joined: 13 Feb 2024
Posts: 17

PostPosted: Tue Feb 20, 2024 4:47 pm    Post subject: Reply with quote

ParkourPenguin wrote:
All code injections take place immediately. The game must actually run the original code for your code injection to do anything.

When you look at the "Find out what instructions access this address" window, some instructions pop up immediately and continuously access the value (the count keeps increasing). Other instructions only pop up when you do certain actions: e.g. for money, maybe buying something or opening your inventory makes certain instructions access your money. In such cases, the game is only running that code in that specific circumstance, and if you inject code there, your code will only be run in that specific circumstance too.

If you don't like that, try using a different injection point. Specifically one that continuously accesses the address you want. Make sure it doesn't access any other addresses.


oh that makes sense thanks for explaining that clearly, I know you had said that my code will only run when in a specific circumstance but, is there a slight possibility I can create a script that will run that code even when that certain action isn't made? cause as I've mentioned before I've seen other cheat table creators make a script that makes all scripts in that table ready to use with no need to do certain actions
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Feb 20, 2024 4:56 pm    Post subject: Reply with quote

xenowyaa wrote:
is there a slight possibility I can create a script that will run that code even when that certain action isn't made?
-Yes, but it probably isn't necessary. Just use an injection point that is being accessed constantly.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 150

Joined: 06 Jul 2014
Posts: 4657

PostPosted: Tue Feb 20, 2024 5:19 pm    Post subject: Reply with quote

Technically yes, but if you had the information required to do that, you probably wouldn't need to use a code injection in the first place. e.g. if you're using a code injection to get an address, a pointer to the address would work just as well.

The other cheat table creators probably use better injection points.

_________________
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
xenowyaa
Newbie cheater
Reputation: 0

Joined: 13 Feb 2024
Posts: 17

PostPosted: Tue Feb 20, 2024 7:03 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Technically yes, but if you had the information required to do that, you probably wouldn't need to use a code injection in the first place. e.g. if you're using a code injection to get an address, a pointer to the address would work just as well.

The other cheat table creators probably use better injection points.


if you don't mind explaining how would I go about finding better injection points?

like I know how to see what writes/accesses instructions/address but lets say I did find something that constantly accesses my address, what would I do? do I just make an auto-assembled AOB injection script and tweak the code section? or a different template? (I want this to work every time the game is loaded up)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 150

Joined: 06 Jul 2014
Posts: 4657

PostPosted: Tue Feb 20, 2024 8:53 pm    Post subject: Reply with quote

xenowyaa wrote:
lets say I did find something that constantly accesses my address, what would I do?
1) Check to make sure it doesn't access other addresses (right click in disassembler -> Find out what addresses this instruction accesses)
2) Inject there instead

Copying and pasting the injected code for some other injection point isn't a good idea. You'll probably need to change at least the original code, and maybe your code too. e.g. use a different register

If you're confused, just throw out your old work and start again at this new injection point

_________________
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: 4197

PostPosted: Tue Feb 20, 2024 9:24 pm    Post subject: Reply with quote

xenowyaa wrote:
if you don't mind explaining how would I go about finding better injection points?
-It is poor etiquette to ignore people that go out of their way to try to help. It creates a bad climate and discourages others to want to help at all.
Back to top
View user's profile Send private message
xenowyaa
Newbie cheater
Reputation: 0

Joined: 13 Feb 2024
Posts: 17

PostPosted: Tue Feb 20, 2024 9:54 pm    Post subject: Reply with quote

++METHOS wrote:
xenowyaa wrote:
if you don't mind explaining how would I go about finding better injection points?
-It is poor etiquette to ignore people that go out of their way to try to help. It creates a bad climate and discourages others to want to help at all.


hey sorry man I didn't mean to ignore your comments, I actually wrote a reply earlier then for some reason it asked me to sign back into the forum and it completely erased my response, please forgive me for that it was not my intent to brush you off that way, your responses were very helpful and I am very appreciative of you taking time out of your day to help me a stranger on the internet with a problem, please don't take it as disrespect as that was not my goal I'm just here looking to solve an issue, forgive me if I came off ignorant.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Feb 20, 2024 10:12 pm    Post subject: Reply with quote

No worries.
Back to top
View user's profile Send private message
xenowyaa
Newbie cheater
Reputation: 0

Joined: 13 Feb 2024
Posts: 17

PostPosted: Wed Feb 21, 2024 1:04 am    Post subject: Reply with quote

ParkourPenguin wrote:
xenowyaa wrote:
lets say I did find something that constantly accesses my address, what would I do?
1) Check to make sure it doesn't access other addresses (right click in disassembler -> Find out what addresses this instruction accesses)
2) Inject there instead

Copying and pasting the injected code for some other injection point isn't a good idea. You'll probably need to change at least the original code, and maybe your code too. e.g. use a different register

If you're confused, just throw out your old work and start again at this new injection point


here's the issue I've ran into, you said find an address that always accesses my instruction but how could i modify that without it crashing? idk what to do i cant just nop it cause since its always running it will crash any tips?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 150

Joined: 06 Jul 2014
Posts: 4657

PostPosted: Wed Feb 21, 2024 1:37 am    Post subject: Reply with quote

What is your code injection even doing? If you're just replacing an instruction with nops, then you have to use the original injection point. Such a script "not working until you do a certain action" isn't even a problem.

The only time you're at liberty to choose which injection point you want is when you only want an instruction that accesses a certain address- nothing else matters. e.g. an "injection copy" script that copies an address (an alternative to pointers).

_________________
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
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