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 


CreateThread or not? enable vs disable+restore val? (solved)

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

Joined: 03 May 2022
Posts: 23

PostPosted: Tue May 03, 2022 12:47 pm    Post subject: CreateThread or not? enable vs disable+restore val? (solved) Reply with quote

I was hoping somebody can help with a big problem I face. What is the method to write this idea? I can only ever get one or the other to work. If enable works, disable doesn't; Aka nothing happens at disable. Alternatively sometimes I got a result where when I enable it, it performs the disable routine and ignores the enable section.

I've tried dozens of variations but would like to start from scratch with most basic way to do this--

Code:
Enable:
Write a value of 5 to [game.exe+123456]

Disable:
Write a value of 1 to that same exact address from above


Is create thread even what I should use, or something else for just this?

Like I say upon dozens of tries sometimes I get enable to work but disable won't. Other times enabling it does the disable part but skips the enable part. How to make it do both as expected? I want to start fresh from least amount of code plz so I don't even want to have someone fix mine if that makes sense.


Last edited by Devon999 on Wed May 04, 2022 11:11 am; edited 2 times in total
Back to top
View user's profile Send private message
TsTg
Master Cheater
Reputation: 5

Joined: 12 Dec 2012
Posts: 334
Location: Somewhere....

PostPosted: Tue May 03, 2022 12:56 pm    Post subject: Reply with quote

Code:

[ENABLE]
game.exe+123456:
dd 5    //or you can used dq 5 for a 64-bit

[DISABLE]
game.exe+123456:
dd 1

this is the most basic code to edit a value in a address, no thread required
if this does not work everytime, it means the pointer/address you use is not static, and probably need to locate a valid one.


Last edited by TsTg on Tue May 03, 2022 12:59 pm; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4297

PostPosted: Tue May 03, 2022 12:57 pm    Post subject: Reply with quote

Code:
[ENABLE]
game.exe+123456:
  dd 5

[DISABLE]
game.exe+123456:
  dd 1

Or Lua:
Code:
[ENABLE]
{$lua}
if syntaxcheck then return end

writeInteger('game.exe+123456', 5)
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end

writeInteger('game.exe+123456', 1)
{$asm}

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

Joined: 03 May 2022
Posts: 23

PostPosted: Tue May 03, 2022 1:24 pm    Post subject: Reply with quote

The short version you both suggested is working great.

Now I have a 2nd one to do and I'm done. But the 2nd one has to store the original value of game.exe+123456 upon enable so it can restore that value upon disable.

Perhaps because I was doing both at once is how I ended up being taken to search results about creat thread. Is this where create thread becomes necessary or can I implement this into the easier code you guys both agreed on above?

Enable:
Save original value
Change value to 5

Disable:
Restore original value
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4297

PostPosted: Tue May 03, 2022 2:49 pm    Post subject: Reply with quote

Code:
[ENABLE]
alloc(originalValue, 4)
registerSymbol(originalValue) // needed for readmem in disable

originalValue:
  readmem(game.exe+123456, 4)

game.exe+123456:
  dd 5

[DISABLE]

game.exe+123456:
  readmem(originalValue, 4)

dealloc(originalValue)
unregisterSymbol(originalValue)

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

Joined: 03 May 2022
Posts: 23

PostPosted: Tue May 03, 2022 2:58 pm    Post subject: Reply with quote

Thank you that works and has solved what was turning into many many hours of struggle.

May I ask? This still doesn't seem like I needed anything I kept running into re:creating threads. I wonder why my searches kept making me think I had to turn to create thread for this? This is way more direct and simple than any of the stuff I kept finding lol

Can you give quick example of when this solution today works vs when I'd need to use create thread instead? After seeing it come up so many times in my searches yesterday and today I feel like I will run into it again. :Shrug: but at any rate thanks for helping me crack this tricky (to me) case today.
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