View previous topic :: View next topic |
Author |
Message |
LongBeardedLion Expert Cheater
Reputation: 0
Joined: 10 Apr 2020 Posts: 173
|
Posted: Sat Mar 05, 2022 7:15 am Post subject: Finding button functions of Medieval Total War 2 |
|
|
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 |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sat Mar 05, 2022 9:45 am Post subject: |
|
|
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 |
|
 |
LongBeardedLion Expert Cheater
Reputation: 0
Joined: 10 Apr 2020 Posts: 173
|
Posted: Sat Mar 05, 2022 1:05 pm Post subject: |
|
|
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 |
|
 |
danrevella Master Cheater
Reputation: 2
Joined: 11 Jun 2008 Posts: 292
|
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sat Mar 05, 2022 10:04 pm Post subject: |
|
|
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 |
|
 |
LongBeardedLion Expert Cheater
Reputation: 0
Joined: 10 Apr 2020 Posts: 173
|
Posted: Sun Mar 06, 2022 8:02 am Post subject: |
|
|
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.
Description: |
|
Filesize: |
188.38 KB |
Viewed: |
6793 Time(s) |

|
Description: |
|
Filesize: |
99.46 KB |
Viewed: |
6800 Time(s) |

|
Description: |
|
Filesize: |
1.29 MB |
Viewed: |
6800 Time(s) |

|
|
|
Back to top |
|
 |
danrevella Master Cheater
Reputation: 2
Joined: 11 Jun 2008 Posts: 292
|
Posted: Sun Mar 06, 2022 10:29 am Post subject: |
|
|
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...
|
|
Back to top |
|
 |
LongBeardedLion Expert Cheater
Reputation: 0
Joined: 10 Apr 2020 Posts: 173
|
Posted: Mon Mar 07, 2022 1:22 pm Post subject: |
|
|
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 |
|
 |
TsTg Master Cheater
Reputation: 5
Joined: 12 Dec 2012 Posts: 340 Location: Somewhere....
|
Posted: Mon Mar 21, 2022 8:02 pm Post subject: |
|
|
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 |
|
 |
|