Romhacking => Newcomer's Board => Topic started by: xaryC on April 20, 2021, 06:40:13 am

Title: Mortal kombat attract sounds
Post by: xaryC on April 20, 2021, 06:40:13 am
Hello everyone,

I've been a mk fan since a few decades now, I own 3 arcade machines (2,3 and 4).

a few days ago I looked into rom hacking, there is a thing I want to "alter" to my mk games.

When the attract mode plays, the sound cuts off after 3 or 4 loops of the attract mode. I would like to turn that off so the sounds keep playing as long as the machine is on...

Can this be done trough rom hacking?

I read and watched some tutorials on youtube and managed to change some text and colors using the mame debugger and a hex editor.

I tried some things like setting watchpoints on where I tought the game tries to acces sound, looking into the dipswitsch adress that toggles the attract sounds on/off but no luck yet...

I acctually don't know where I have to keep looking...

Is there anyone who can help me with this matter?

Thanks in advance!
Title: Re: Mortal kombat attract sounds
Post by: FAST6191 on April 20, 2021, 07:35:19 pm
The limits of ROM hacking tend to be you can change any game to do anything within the limits of the system (or indeed emulator if you are rolling that way, though around here things tend to be considered best if they work on the original hardware). Though obviously difficulty varies massively so practical day to day hacking tends to be focused on rather more mundane things (you could have the mid round screen instead be a match of tetris or change the whole thing to a driving game with RPG elements but using some of the original assets, though it would be very annoying and take a long time to code in and get the game to do it). This is squarely in that mundane region (it is a thing the game already does after all), though will potentially have to get your hands dirty with some assembly rather than the text and graphics stuff you did so far (though if you learned that off your own back then that puts you ahead of many newcomers around here).

In this case the DIP switch settings are likely not going to get you too far here. You could do something with them but there are probably better means. The DIP switch likely then being an all or nothing affair and nothing to do with the attract mode limitation.

What the game likely does is have a little counter every time it goes round attract mode and if no player input happened in the meantime it would stop it to save the sanity of whatever worker was in the same room as it for a 12 hour shift or whatever (the people doing the thing with screens telling you of a radical new way to clean your windows/car/clothes/... you get in supermarkets and whatnot had similar problems where the checkout peeps would reach over and turn it off after so long).
In an ideal world you would be able to find it much like you find a cheat (if it is a counter then theoretically no real difference to finding infinite potions/health/ammo/...), however if you only have a few goes through it is harder than health/potions/ammo where you might start with 99 and thus have 99 chances to find it. You might get lucky here and also use a few nothing changed searches* to narrow it down further. is my usual choice for a basic guide to cheat finding in case you needed one.

*as well as the changed thing after each loop through or start thereof you can wait for a few frames of it and search for nothing changed. That will eliminate things like any graphics that moved, audio controls that played, level data or similar and hopefully reduce the list to a manageable level. I have found things in 3 searches before when looking to make cheats, and you have a bit going for you here if you can just leave it alone while it does its thing, but I am not going to wager anything serious on it. That said I am also not inclined to underestimate determination -- I have seen people comb through big lists of possibilities to find the one. You could possibly also use savestates to go back to an earlier time and compare again (theoretically the counter would be lower if the basic counter is done -- who knows if they decided to subtract from 99 because it is funny, and we have seen many occasions of such things in cheat world).

Alternatively it might be a bug, though solving it would act much the same way as you get to figure out why the music is not playing this time around.

If you do have to get your hands dirty then yeah I would see either a sound test menu or return to the DIP switches. You would want to find where the sound is stored (though if they are MAME games then the docs there might even tell you -- unlike most emulators then MAME source code takes special pains to document games, which is a more viable proposition when a given board might only have 20 games total).
The code that reads the DIP switch** to play it or not would lead eventually to the thing deciding to play the audio.
If not then the sound test should be able to follow a button press from there to where the audio is. Anything that plays the audio in the normal game will then hopefully have a check on the still hypothetical counter before it does. You can then force this counter to zero every frame or something (one of the ways of hardcoding a cheat if you find the vblank routine that runs every vblank and chuck in a write this to this memory location), or you can disable the check entirely as you would presumably have the code dealing with that area.

**I don't know how arcade games tend to roll for external switches but for buttons then systems in general tend to have states be copied to normal memory once a frame, and same on systems where user settings might shine through (think DS games that might read the name/birthday/favourite colour from the firmware) this is also copied to memory rather than having to reach out the hardware and wait for it to respond, or maybe be in the middle of making its mind up. This is called debouncing, if you have ever had a mouse switch start double clicking on you when you only clicked once then you have met this after it has got bad enough to be called a failure. Same thing applies to normal buttons in well programmed games. To that end if you are sitting there dutifully waiting for some part of the game code to read wherever the DIP switches are in memory the game might have copied the state at boot time or something and is operating from that.
Title: Re: Mortal kombat attract sounds
Post by: xaryC on April 21, 2021, 09:56:50 am
Thank you for the reply!

I will check out the link for the cheat tutorial.

It is certainly not a bug. Likley all midway arcade games have this "feature".

I'm using the mame debugger to search a work-around, but eventually would like to edit the roms on my real hardware.

First things first, I'm gonna dig into that link you posted...  :thumbsup: