| View previous topic :: View next topic |
| Author |
Message |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Sun Oct 10, 2021 2:18 am Post subject: Re-use void in game with Cheat Engine[solved] |
|
|
Is it possible to re-use void? Let's say that in my game i have void that toggles police, but when it's called bool value isn't changing(i've wanted to find the value but it's unknown,tried all value types)
Last edited by Frouk on Tue Oct 12, 2021 9:37 am; edited 1 time in total |
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Sun Oct 10, 2021 1:01 pm Post subject: |
|
|
| If you mean a function that returns void then it can't return a boolean value since it's a void function i.e. return nothing.
|
|
| Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Mon Oct 11, 2021 2:40 am Post subject: |
|
|
Like in c++ i can use | Code: | | void(*Game_SetCopsEnabled)(bool AreCopsEnabled) = (void(*)(bool))0x6513E0; |
But idk how to use it Cheat Engine
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Mon Oct 11, 2021 3:19 am Post subject: |
|
|
With 7.3 you can do it with the new C compiler tags. Something like this. This is for the old school Minesweeper as just a simple/straight-forward example. This will call the 'ResetGame' function that resets the game board, flags and timer.
| Code: |
{ Game : winmine.exe
Version: Old/Windows XP
Author : atom0s
Cheat Engine 7.3 C compiler tag example to cast to and call a game function.
Creates a cave and invokes it as a thread. (Keep this in mind as it is not
designed to be threadsafe as-is!)
}
[ENABLE]
alloc(cave,1024)
createthread(cave)
cave:
{$ccode temp=eax}
// Create the typedef and cast the known function address..
typedef int (__cdecl *fResetGame)(void);
fResetGame ResetGame = (fResetGame)0x100367A;
// Call the ResetGame function..
ResetGame();
{$asm}
ret
[DISABLE]
dealloc(cave)
|
You can ignore the temp=eax tag for now, this is a bug in the current parser of the current 7.3 release. CE requires at least one register is used in 'ccode' tags at the moment which I believe will be fixed in the next update.
As mentioned in the comment tag, this is not considered threadsafe. Calling game functions from a new thread like this is prone to crashing if you are not careful, do not handle proper locking as needed, and so on. Be sure to handle any thread safety requirements accordingly.
_________________
- Retired. |
|
| Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Mon Oct 11, 2021 3:39 am Post subject: |
|
|
| atom0s wrote: | With 7.3 you can do it with the new C compiler tags. Something like this. This is for the old school Minesweeper as just a simple/straight-forward example. This will call the 'ResetGame' function that resets the game board, flags and timer.
| Code: |
{ Game : winmine.exe
Version: Old/Windows XP
Author : atom0s
Cheat Engine 7.3 C compiler tag example to cast to and call a game function.
Creates a cave and invokes it as a thread. (Keep this in mind as it is not
designed to be threadsafe as-is!)
}
[ENABLE]
alloc(cave,1024)
createthread(cave)
cave:
{$ccode temp=eax}
// Create the typedef and cast the known function address..
typedef int (__cdecl *fResetGame)(void);
fResetGame ResetGame = (fResetGame)0x100367A;
// Call the ResetGame function..
ResetGame();
{$asm}
ret
[DISABLE]
dealloc(cave)
|
You can ignore the temp=eax tag for now, this is a bug in the current parser of the current 7.3 release. CE requires at least one register is used in 'ccode' tags at the moment which I believe will be fixed in the next update.
As mentioned in the comment tag, this is not considered threadsafe. Calling game functions from a new thread like this is prone to crashing if you are not careful, do not handle proper locking as needed, and so on. Be sure to handle any thread safety requirements accordingly. |
Making bool in the function same as c++?
EDIT:
How to create one with bool?
|
|
| Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Tue Oct 12, 2021 1:41 am Post subject: |
|
|
| any1?
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Tue Oct 12, 2021 4:08 am Post subject: |
|
|
DB pointed out on the other forum you posted in that you can add them to the typedef parameters.
If bool won't work use int and define true as 1 or 0xffffffff and false as 0.
Credit: DB, not my suggestion.
|
|
| Back to top |
|
 |
|