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 


Finding button functions of Medieval Total War 2

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 173

PostPosted: Sat Mar 05, 2022 7:15 am    Post subject: Finding button functions of Medieval Total War 2 Reply with quote

Im practicing with Medieval Total War 2.
I reversed quite a lot already.
And was able to call many functions and find many useful pointers.

But im stuck trying to find functions that trigger buttons.
I searched for the typical boolean that is true when a button is clicked.
And found it.
But then i cannot find a proper function that triggers the button.

Is it possible that this function is not reachable or impossible to find?
Or is it lost somewhere in the soup of functions.

Pls any tips on how can i find this function and trigger the buttons to work?
Because for now im using a PostMessage to click on menus, and that is unreliable.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sat Mar 05, 2022 9:45 am    Post subject: Reply with quote

Finding the function is likely not the problem, since you can do that by simply right-clicking on the value to see what reads/writes to it, as you probably know already.

Depending on the target, there may be many values/addresses that pertain to button presses, but only a few (or one) of them will actually work to send a particular button press. You will need to find the right one(s).

One thing to keep in mind is that the value may not always work as a simple 1/0 bool, so you will want to search for changed/unchanged for best results. Another thing to keep in mind is that trigger-type buttons may be in float, with values that fluctuate in a range. And lastly, some targets may handle button presses individually, while some may handle them collectively.

Once you have a group of promising results, add them to your cheat table and manually change the values to a pressed state, and see if the input is sent to the target.

There are also other ways to send inputs, but this response is assuming that you are wanting to use the game's code for it.
Back to top
View user's profile Send private message
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 173

PostPosted: Sat Mar 05, 2022 1:05 pm    Post subject: Reply with quote

Thank you. But i tried that already.
That doesnt work. Changing the bool itself doesnt do anything.

What i did was finding what writes to the address. And got all the functions in the stack call.

And tried them all using breakpoints. And studying them.

It doesnt work. But this worked before in other games.

Changing a value alone doesnt do anything most of the time.

Because the function is called and it overwrites your value. So unless you call the function or make a detour it wont work.

The issue is really finding the function that does this, is like trying to find a needle in a haystack. And apparently you can even leave with no results.
Back to top
View user's profile Send private message
danrevella
Master Cheater
Reputation: 2

Joined: 11 Jun 2008
Posts: 292

PostPosted: Sat Mar 05, 2022 1:21 pm    Post subject: This post has 1 review(s) Reply with quote

Please give a try to this:
https://x64dbg.com/blog/2017/07/07/messages-breakpoints-in-x64dbg.html
I have ask in the past if is it possible implement something like this in cheat engine, but..... no answer.
Usually I use x64dbg to locate the routine, then come back to CE to prosegue my job...
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sat Mar 05, 2022 10:04 pm    Post subject: Reply with quote

LongBeardedLion wrote:
Thank you. But i tried that already.
That doesnt work. Changing the bool itself doesnt do anything.
-As mentioned, it may depend on the target. You may need to make sure that you have found the correct address. The value will, of course, be overwritten, so freezing the values in their pressed state may be necessary so that you do not miss anything, especially if you are batch-editing large amounts.

You can also try ultimap. If the target has a keyboard/controller-only option, it might make things even easier.

Probably goes without saying, but be sure to search using byte type, but do not be afraid to expand on the data types in case the target is using something unusual.
Back to top
View user's profile Send private message
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 173

PostPosted: Sun Mar 06, 2022 8:02 am    Post subject: Reply with quote

danrevella wrote:
Please give a try to this:
https://x64dbg.com/blog/2017/07/07/messages-breakpoints-in-x64dbg.html
I have ask in the past if is it possible implement something like this in cheat engine, but..... no answer.
Usually I use x64dbg to locate the routine, then come back to CE to prosegue my job...


Im trying to follow through the steps.
But so far im not being able to achieve much.

I show you a screen of the Main Menu. Im trying to click on Single Player.
Im on the handles now in x32dbg. And i made a refresh, because it was not showing anything.

In the article it says that i should look for a !check. Which means, the title word related to the button that you are clicking.

I didnt find anything like Single Player so i went for the Medieval 2.
I have done the message breakpoint. And it breaks when i click.

In the stack it shows the message number related to WM_LBUTTONUP, that is 0x202.

I tried changing it to 0x204 that is the right button to see if this would have any effect, and if the button would not be clicked. But it still clicked.

I tried going forward in x32dbg, looking for a function or something that does not look totally obscure with hopes that could be the function i need to call to activate the button.

But so far i was not lucky, and this does look very hard.



3.png
 Description:
 Filesize:  188.38 KB
 Viewed:  6791 Time(s)

3.png



2.png
 Description:
 Filesize:  99.46 KB
 Viewed:  6798 Time(s)

2.png



1.png
 Description:
 Filesize:  1.29 MB
 Viewed:  6798 Time(s)

1.png


Back to top
View user's profile Send private message
danrevella
Master Cheater
Reputation: 2

Joined: 11 Jun 2008
Posts: 292

PostPosted: Sun Mar 06, 2022 10:29 am    Post subject: Reply with quote

uhm....
Is this a freeware game?
I may not promise, but if you wanna give me "the exactelly version " you utilize, and what is the button you wanna intercept, I'll give it an eye... Wink
Back to top
View user's profile Send private message
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 173

PostPosted: Mon Mar 07, 2022 1:22 pm    Post subject: Reply with quote

I succeeded in making the message breakpoint. But in the website you have shown it is hard to understand the next steps.

So im stuck there.

I found the 0x202, that is the left button in the stack.
But after that, i cant seem to find anything useful, even though i check and tried all the functions that appear after.

I press ctrl+f9, that is to run until return. And like 4 functions down the line the program simply resumes.
Back to top
View user's profile Send private message
TsTg
Master Cheater
Reputation: 5

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

PostPosted: Mon Mar 21, 2022 8:02 pm    Post subject: Reply with quote

while digging through the window message proc routine is a good start, it might be a tedious process to do, depending on how the game is designed to handle input.

also, the mouse WM_LBUTTONUP and other similar ones, give the co-ordinates of the mouse cursor when it was clicked

anyways, you need to look into the window proc and see what happens when the code jumps at medival2.F0CFA2 (where ECX = 0x202)

also can you write the messages you are currently using via PostMessage ?
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