Mortal Kombat II Restored

Mortal Kombat II Restored 2.1

So tl;dr, it's patching the game to change it's A-Bus settings, as I already told you. You can even dig further into Saroo's firmware and see they modified the BIOS to call their patching when a CD is used, because if they didn't running the game from a CD would also have these issues. So your AI is now mostly agreeing with me.

And no, setting the 4MB option in the Saroo config doesn't resolve this, the patch to change the A-Bus settings is still needed. Don't believe me? Change the product ID in IP.BIN for a game like Vampire Savior and then boot it with the Saroo set to 4MB mode. It's still going to be a glitchy mess because the A-Bus setting patch wont get applied.
No I understand that Saroo is 4MB by default and all I need to do is check for the 4MB or RAM. If the RAM isn't found then configure for a RAM cartridge. If I want the Sega RAM cartridge to work for the Saroo, its got to be setup saroo side. Config set to 4MB and if required the code bypass for the A-Bus timings to stop them being set. The Saroo has all the support you need you just have to set it up first.

Want to try and setup the Saroo so the demo works?

I've written the patch in the X-Men style without touching out.iso: the Saroo applies it in RAM when the demo boots. I haven't tested it on the Saroo.
It's simpler than the X-Men patch. The demo is a single program with no loaded modules, so it needs no loader hooks or jump handlers. Like xmvsf_handle2, it turns each instruction that writes the RAM-cart setup into a nop (0x0009) inside dram_cart_init:
AddressOriginalWrites
0x0600471A21210x257EFFFE = 1 (cart enable)
0x060047242212ASR0 = 0x23301FF0 (A-Bus timing)
0x0600472C2212AREF = 0x13 (refresh)
0x0600474E2192ASR0 restore (only if detection fails)
0x060047522182AREF restore (only if detection fails)
I read these bytes and the product ID EXRAMTEST V1.000 from out.iso without changing it. None of the five instructions sits in a branch delay slot, so replacing them is safe. The ID check and bank test run as before, and the Saroo answers 5C with 4 MB.
Option 1: /SAROO/saroocfg.txt, no firmware rebuild. Four-digit M_ values are 16-bit writes, applied at boot once the program is in RAM.
# 4MBRAM Test - skip the official RAM cart bus setup
[EXRAMTEST V1.000]
exmem_4M
M_0600471A=0009
M_06004724=0009
M_0600472C=0009
M_0600474E=0009
M_06004752=0009
Option 2: Firm_Saturn/game_patch.c, needs a firmware rebuild.
/**********************************************************/
// 4MBRAM Test (EXRAMTEST V1.000)
// 0x060047EC: 23301ff0

void exramtest_patch(void)
{
ssctrl_set(MASK_EXMEM, CS0_RAM4M); // the default, made explicit
*(u16*)(0x0600471A) = 0x0009; // 0x257EFFFE = 1 (cart enable)
*(u16*)(0x06004724) = 0x0009; // ASR0 = 0x23301FF0
*(u16*)(0x0600472C) = 0x0009; // AREF = 0x13
*(u16*)(0x0600474E) = 0x0009; // ASR0 restore (failure path)
*(u16*)(0x06004752) = 0x0009; // AREF restore (failure path)
}
plus {"EXRAMTEST", "EXRAMTEST", exramtest_patch}, in game_dbs[].
 

Attachments

Testing option 1 and see if it works with the original out.iso.

[OUT]
exmem_4M
M_0600471A=0009
M_06004724=0009
M_0600472C=0009
M_0600474E=0009
M_06004752=0009

No corruption onscreen but freezes. Working on it.
 
No I understand that Saroo is 4MB by default and all I need to do is check for the 4MB or RAM. If the RAM isn't found then configure for a RAM cartridge. If I want the Sega RAM cartridge to work for the Saroo, its got to be setup saroo side. Config set to 4MB and if required the code bypass for the A-Bus timings to stop them being set. The Saroo has all the support you need you just have to set it up first.

Want to try and setup the Saroo so the demo works?

And the libraries that many of us use like SBL, SGL, Yaul, etc. don't do that because they're built around the official spec. So if we are using those libraries our code wont work on Saroo. And no, just setting the config to 4MB wont work, that's why the other games have patches. And adding homebrew to the patch list becomes a nightmare because who's going to tell us homebrew devs what product IDs have been used by other devs? It's a mess and the correct solution is for Saroo to fix it's problems and follow the official spec for 1MB and 4MB RAM cart compatibility.

Testing option 1 and see if it works with the original out.iso.

Setting the config mode was already tested:

 
Testing option 1 and see if it works with the original out.iso.

[OUT]
exmem_4M
M_0600471A=0009
M_06004724=0009
M_0600472C=0009
M_0600474E=0009
M_06004752=0009
So the A-Bus settings don't work and you needed to patch the executable. In other words Saroo isn't compatible with the official RAM carts as I already stated multiple times now.
No corruption onscreen but freezes. Working on it.

So it didn't even work then? This isn't solving the problem, at best it's masking it. Plus are you going to do this for every homebrew game that gets made and supports the RAM cart?
 
Last edited:
Adding the following to Saroo's config works. Setting saroo config works.

# 4MBRAM Test (out.iso) - for the SAROO
# 0600471A..06004752: skip the official RAM cart setup (enable, ASR0, AREF, restores)
# 060050A4: background images to High Work RAM (SCU DMA cannot read Low Work RAM)
[EXRAMTEST V1.000]
M_0600471A=0009
M_06004724=0009
M_0600472C=0009
M_0600474E=0009
M_06004752=0009
M_060050A4=0606F300


Saroo is it's own RAM cartridge. Each game that requires a Sega Saturn RAM cartridge works. The issue is your demo isn't setup to work on the Saroo. The saroo bypasses the normal Sega Saturn cartridge RAM setup, as it doesn't need or require it to work. Your demo needs to be configured Saroo side to do this. That's what the issue is and the code you used isn't designed to work with Saroo out of the box. All the games that require the detection of a Sega RAM cartridge have there own code to make them run in Saroo's config or firmware. This is how saroo can work with original software.

This wasn't easy to fix but we avoided editing the firmware. Saroo is compatible but not globally with software that isn't original released discs.

The config fixes two things at boot:
  1. The cart setup: five nops over the demo's official RAM-cart setup (the enable write, the ASR0 timing, the AREF refresh and the two restores). The Saroo doesn't need these writes, and the timing write is what made it hang during playback.
  2. The background images: the buffer address at 0x060050A4 is moved from Low Work RAM to High Work RAM, because SCU DMA can't read Low Work RAM on a real Saturn. Sega Documents as source.
This is very useful for my Doom project. Thank you for pushing back until the end.
 

Attachments

Last edited:
Back
Top