farmerbb / RED-Project

ROM Extraction Documentation Project
181 stars 8 forks source link

PS2 Namco Museum 50th Anniversary #119

Open arpruss opened 8 months ago

arpruss commented 8 months ago

This one took me a long time to get the ROMs out of. I wrote a bunch of Unixy tools (actually I'm running them on Cygwin on Windows) for it: https://github.com/arpruss/xsr

First, in the CLASSIC directory there is a NAMCO.SR archive file. The SR file is pretty self-explanatory: there is a plain text directory at the beginning, and file offsets counting from the end of the directory, with file sizes. I wrote a little xsr.py script to extract the data. Put the extracted .rom and .ROM files in an extracted/ subdirectory.

I then wrote some python scripts that convert the roms to mame format. Unfortunately, some of the roms use Namco 5xxx chips, but don't include the dumps from these chips, I assume because the ps2-based emulator just emulates the chips' functionality. But current mame versions need the binaries for these chips for more accurate emulation. Old mame versions, 0.131u2 and earlier, emulate the chips' functionality, and so everything works. I made three shall scripts: one for generating roms for mame2003-libretro (which I use on my Raspberry PI), one for older mames like 0.131u2, and one for current mames (but not including the roms that need the 5xxx chip data). The scripts call python code that searches for the roms by checksum. But sometimes the checksums don't match the ones in the mame database. I correct most of that.

The one thing I haven't been able to do is find all the sound effects for Rolling Thunder. I end up generating a blank sound effects file. Other than that, everything works in mame2003-libretro and 0.131u2.

Interestingly, the root directory of the disc has a very big NAMCO50.VOL file which contains a second copy of the NAMCO.SR archive file. So if your disc has some damage in the NAMCO.SR file, you can get a second copy out of the VOL file.

kjetil-f commented 8 months ago

This is awesome. Do you have any knowledge on how to extract other PS2 arcade collections as well?

arpruss commented 8 months ago

The only other PS2 collection I have is the Activision Atari 2600 anthology.

kjetil-f commented 8 months ago

I see. I know the Activision ROMs can be extracted. Maybe a similar method you did will work on other arcade compilations as well, but it seems like a lot of work.

arpruss commented 8 months ago

Well, you can just run the makezip.py script with an xml file (you can dump them from mame, e.g., mame -lx pacman) and a rom file and see what happens. As long as the file's CRCs match the ones in the xml, makezip will extract them. But if it's like with Namco's files, there will be a lot of mismatched CRCs.

By the way, amusingly, the Ms Pac-Man rom in the collection matched a bootleg Ms Pac-Man in mame.

kjetil-f commented 8 months ago

I think I saw a reference to bootleg with Ms Pac-Man when I looked on the files with a hex editor, so not surprised. But cool to get access to a Ms Pac-Man ROM. That's the only one from the Arcade Game Series on Steam that doesn't seem to work.

I'll see if I get around to test the makezip script on some of the other compilations. Thanks for the suggestion.

kjetil-f commented 5 months ago

I finally tested this out, and it worked. The only ones that didn't work one the MAME versions I tested was Xevious and Pac-Man.

I also briefly tested the xsr.py script on some of the other compilations that uses that that file format, like Midway Arcade Treasures and Capcom Classic Collection, and it extracted the content.

Other compilations uses files like .POD, .RPF or IRX, so I have no idea how to extract those at the moment.

stuckinstyx commented 5 months ago

I've been playing a little bit with xzr.py on the Midwat Arcade Treasures.

I'm looking at Spyhunter, and starting to compare the spyhunt.dat from the PS2 disc to the Mame archive. I see what looks like an exact copy of spy-hunter_cpu_pg0_2=9-84.6d early starting at byte 16 of spyhunt.dat. This makes me wonder if all of the ROM is contained in the file and if it can be extracted similarly to the Namco scripts above.

Does anyone have a good way to automatically find the position of a binary file within a larger binary file?

arpruss commented 5 months ago

Well, in my xsr archive there is findcrcpy.py ( https://github.com/arpruss/xsr/blob/main/findcrc.py ). So just get the CRC of the ROM component you are searching for and the length, and it'll search a file for it.

kjetil-f commented 5 months ago

Can you please elaborate a bit on on how you actually find ROM specific xml files for a game?

arpruss commented 5 months ago

I either pull the relevant section out of Mame source course for the game driver, or use Mame to dump its dat file.