Jump to content

An old topic about searches in the console...


Recommended Posts

I had the funny idea to try to restore an old backup from rainemu to look at old posts... It's now in a horrible state, mysql was bought by oracle which made most distribution move to mariadb instead, php is mostly incompatible with itself and it's impossible to load the old site unless you want to spend hours fixing all the bugs... !

And the sql dump is probably unusable because the table names still use "yabbse" when it was changed to "smf" quite a long time ago already... !
Finally I just took a text editor to search directly in the ascii dump of the database, and here it is :

--- start ---

How to find the location of the weapon for metal slug in ram ?
Welcome to the relative searches we started to talk about in the other topic...

So just start the game as usual, and open the console just before picking the machine gun, and close it immediately. In doing so it takes a snapshot of the ram, and you'll be able to look for differences later. Now take the machine gun and type:
search !=
which will search all the bytes which are different.
Well there a few hundreds of differences, so it will take time.
The idea is to wait a little in game, then return to the console and type
search ==
to look for the areas which didn't change. Half of the results are gone, but you still have a lot of them. Play a little until the flame thrower and just before picking it up, type :
search ==
and after picking it up :
search !=
normally when you pick the machine gun again and you type search !=, you'll get only 2 results which are both valid :


After a few tests, the 2nd address is the one you want, putting 4 in it gives the machine gun and 2 is the flame thrower (I didn't test all the weapons !).

This is a lot harder than the simple life counter... !!!
But it works well. Todo : mouse support in the console (too tiresome to type all these addresses), history for the console to access the previous commands, and the scripts I talked about in the other topic to be able to save what we find.

Now with the old cheat system, you would have to add 1 cheat/weapon, which is not very convinient. Here you can add a single cheat using the alert function. First here are the weapons you can get :
 - 00 : Normal Gun

 - 01 : Shotgun
 - 02 : Flamer
 - 03 : Rocket Launcher
 - 04 : Machine Gun
the alert function works like this :
and returns the number of the button you selected starting at 1, or 0 if you pressed ESC or used the 2nd button of your mouse.
So you can type :


  poke $1004d1 alert("select weapon (ESC for normal gun)|Shotgun|Flamer|Rocket launcher|Machine gun")
  dpoke $1004e2 999

The 2nd line gives 999 munitions at the same time, it's more convenient. Once you have tested, you can add it to your scripts using the script command, and it will appear in the cheats dialog (which you can now call directly using a key from the game).

--- end ---

Luckily it's probably the only post really worth retrieving, and I even found the image. Notice that now mouse support is ok in the console, and by default it's less transparent than that for readability reasons.

And the topic which started this one, which was probably the 1st one on the console, posted in march 2008 apparently, "console basics" :

--- start ---

I know a command line is quite intimidating, but it will be much more powerful for what I want, and also it will be much easier to add new features this way.

So here in mslug, I wanted to look for the number of lifes, so I started by search 3 just at the beginning of the game and there were more than 39000 results.
So I lost a life, typed 'search 2' and I was down to 4 results already !
Lost another life, and this time 'search 1' sent back only 1 result : 100397.

This is the very first beta for this, I want to add other functions like the ability to modify any address in ram (to test the result by putting any life number for example), to be able to explore the ram at any address to see if there are other interesting addresses nearby, and so on...

As you see the syntax for the command line is extremely simple, and should remain as simple as possible...
And this thing could probably be used as a debuger too (68000/z80 debuger).
--- end ---

This one was extracted using a script, way faster !
Well all this has been done since then, you see a few commands in the 1st post like poke and alert.
There are also debug functions like list to see the assembler code, break for breakpoints, and so on... + the integrated help for everything, mandatory here.
It's been a long time, but it was fun !

... and I just found a 3rd pat, now that I have repaired my old backup after some heroic fight and some help from MikeDX who happened to have a backup (I destroyed a big part of mine while trying to upgrade, I would never have thought it would be so hard !!!).
Anyway here is the 3rd part, this time on invulnerability :

--- start ---
This one is possible mainly because of the explanations from Stephh about how it works.

You probably noticed by now that almost every arcade game makes your character to blink when it first appears, and while it blinks it is invulnerable... This is the secret of invulnerability : while it works, there is a counter in ram which goes down to 0, and once it reaches 0 you are vulnerable again, so the idea is to use a script which will be called for each frame to prevent the counter from reaching 0.

It's a lilttle tricky in mslug because of the little animation when the player 1st appears in the level. For the 1st level, it starts to blink while it is still in the air, then stops blinking for a short time (it is vulnerable at this point), and then starts blinking again when reaching the floor. In fact the counter is set to a high value 3 times during this animation if I am not mistaken !
It's easier to loose a life and then start the search for the 2nd life because the counter is initialised only once then...
So : as soon as you see the player is starting to appear, go in pause mode (p key). Then call the console to take a first snapshot of the ram (using its key, default is tilde), and then exit immediately from the console. Press the space bar while still in pause mode, and the game will run exactly 1 frame. Do that until you see the player character has changed its color. It shows the invulnerability counter just changed. You can then type :
search <
It will give you a lot of results of course, there are a lot of things which change at every frame in mslug. So you can repeat the same process a few times, calling the console every time the character changes on screen and type "search <", until the results shrink.
Then once it has stopped to blink, you can type :
search 0
because then the counter should be at 0.

In the end, you should have only 2 or 3 results if you made enough searches.
To test this, just poke a big value inside. Since the value goes down by 1 for every frame, if you put 180 inside you will be invincible for 3s (60 frames/s). You should find quite quickly that $1004a5 works great for that.
Notice that you have a different invulnerability when you are in the tank. In this case, $1005e5 is the address you want.
--- end ---

Edited by Tux
  • Like 1
Link to comment
Share on other sites

  • Tux pinned this topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...