libretro / flycast

Flycast is a multiplatform Sega Dreamcast emulator. NOTE: No longer actively developed, use upstream repo for libretro from now on - https://github.com/flyinghead/flycast
http://reicast.com
GNU General Public License v2.0
155 stars 77 forks source link

Support for proper MAME rom sets for dc-based arcade systems #371

Closed Shoegzer closed 5 years ago

Shoegzer commented 5 years ago

This would permit RA to read the ROM versions of dc-based arcade games (naomi/naomi2/atomiswave) in their proper MAME formats (as opposed to reading from .lst files as RA now does). Might be good timing now that CHDv5 support has been completed.

Many dc-based arcade games were commonly available in both ROM and GDROM formats. I assume that currently, RA only supports the MAME versions of GDROM-based arcade games, since those would be compressed to CHDv5 (though I haven't personally tested any of those). However, I understand that due to the current lack of libzip support in RA's reicast core, the ROM-based systems will currently not load.

It is important for preservation efforts that proper, best-known good dumps which are documented in MAME are supported here, as these will be in widespread use given RA's significant userbase. The faster the older, .lst-based roms are deprecated (and eventually eliminated), the better it will be for history's sake. For this reason hopefully a solution can be found relatively quickly.

@barbudreadmon A while ago you mentioned possibly being able to help with this. Is your kind offer still on the table?

Note: Current status as I understand it, will close when all are supported (please let me know of any inaccuracies):

barbudreadmon commented 5 years ago

I think kronos's code for reading st-v games might be of help here. We got some code to read zips, and we got some code to decrypt roms (st-v seems to use similar decrypting mecanism). Imho we should start by adding the "read from zip stuff", so we'll be able to read zipped stuff (like reference redump iso set), then move to the mame rom stuff.

zerojay commented 5 years ago

By the way, .lst files are no longer needed by this core as of about a week ago.

Shoegzer commented 5 years ago

Thanks @zerojay, I realize that, but unless I'm mistaken RA currently only loads sets that were originally .lst-based (i.e. .rom files that were originally loaded from an .lst file), rather than proper MAME dumps. The only difference now is that instead of requiring the .lst file, RA can now load the .rom files directly. However, RA still cannot load for example, MAME's pstone.zip (for Power Stone) which includes files such as epr-21597.ic22 in addition to loading the separate naomi bios as included in naomi.zip. This is the reason for this issue.

flyinghead commented 5 years ago

See #377. Still a work-in-progress but feedback is welcome

barbudreadmon commented 5 years ago

@flyinghead happy to see the st-v code from kronos was of some help :).

newoski commented 5 years ago

Happy to test, but could someone share a list/link of M2 titles?

flyinghead commented 5 years ago

See https://github.com/libretro/reicast-emulator/blob/master/core/hw/naomi/naomi_roms.h

flyinghead commented 5 years ago

and https://github.com/mamedev/mame/blob/master/src/mame/drivers/naomi.cpp for more games

newoski commented 5 years ago

Will report back, asap. Any reason Atomiswave aren't included in this?

barbudreadmon commented 5 years ago

Any reason Atomiswave aren't included in this?

Because that's another machine, current reicast doesn't emulate atomiswave at all, it emulates naomiswave (= atomiswave games ported to naomi)

newoski commented 5 years ago

Ah ok, thank you

Shoegzer commented 5 years ago

@flyinghead Thanks so much! However, it doesn't seem to work. Core information shows Naomi bios as "present" (as required); however loading "pstone.zip" just causes RA to list a bunch of cores that aren't reicast. Any ideas?

barbudreadmon commented 5 years ago

@Shoegzer most likely, update your info files

Edit : actually, the info file wasn't updated yet

barbudreadmon commented 5 years ago

@Shoegzer now it should work if you update your info files

newoski commented 5 years ago

Wrong place, I know, but what do info files do?

barbudreadmon commented 5 years ago

they give informations like "this emulator is allowed to launch roms with the xxx extension", and a lot of other things

blisstik commented 5 years ago

Here's a pretty good list of Naomi variants

http://emulation.gametechwiki.com/index.php/Sega_NAOMI_and_variants

Shoegzer commented 5 years ago

@barbudreadmon Thanks, that did the trick. NAOMI Power Stone MAME roms do run now. What remains to close:

1) NAOMI GDROMs (loading these just starts dreamcast BIOS rather than naomi BIOS and game itself doesn't launch) 2) NAOMI2 GDROMS / ROMs (does reicast even support these?) 3) AtomisWave ROMs (from this thread it seems native AW sets aren't supported yet - how difficult would it be to add such support?)

barbudreadmon commented 5 years ago

NAOMI GDROMs (loading these just starts dreamcast BIOS rather than naomi BIOS and game itself doesn't launch)

I'm worried DC chd support will get in the way for those

NAOMI2 GDROMS / ROMs (does reicast even support these?)

No, and i don't think we are close

AtomisWave ROMs (from this thread it seems native AW sets aren't supported yet - how difficult would it be to add such support?)

No idea what will be needed.

Naomi M1 roms are also missing, we got some issues decrypting them.

Shoegzer commented 5 years ago

Removed (details moved to issue summary)

newoski commented 5 years ago

For ease of testing, I've put together a list of all games from those two links @flyinghead provided. I believe I boiled these down to just the games (not the bios files etc)

18wheelr alienfnt alpilota aw1w aw2c crackndj crakndj2 crzytaxi csmash cspike deathcoxo dybbnao f355dlx gundmct gwing2 hotd2 jambo marstv monkeyba mvsc2u pstone pstone2 puyoda ringout samba samba2k sgtetris shaktamb slasho smarinef sstrkfgt suchie3 totd toyfight virnba vonot wrungp zerogu2 zombrvn zombrvno

newoski commented 5 years ago

Latest blog post lists the follow as working??

NAOMI M1 cartridge support NAOMI M2 cartridge support NAOMI M4 cartridge support

Shoegzer commented 5 years ago

Ah got it - thanks @newoski. I had no idea M4 roms even existed (I guess that implies there are such things as M3 roms but I really don't know). Support details are now in the issue summary, someone please let me know of any inaccuracies there.

blisstik commented 5 years ago

Hey guys - not all roms are supported but we have the framework. Please see the list here:

Naomi M1 - https://pastebin.com/raw/v6hV0wuu Naomi M2 - https://pastebin.com/raw/u4kJShKv Naomi M4 - https://pastebin.com/raw/BQxZu7FK

If anybody wants to help convert some code so it can be put into naomi_roms.h, it would speed up support for all other roms.

Here's what needs to be done.

From the page below: https://raw.githubusercontent.com/mamedev/mame/master/src/mame/drivers/naomi.cpp

Find the rom name, for example: capsnk

// ver 000904
ROM_START( capsnk )
    NAOMI_BIOS
    NAOMI_DEFAULT_EEPROM

    ROM_REGION( 0x7800000, "rom_board", ROMREGION_ERASEFF)
    ROM_LOAD( "epr-23511c.ic22", 0x000000, 0x400000, CRC(3dbf8eb2) SHA1(1f7b89ba99e018cc85022fa852d56d4e345e1bd2) )
    ROM_LOAD( "mpr-23504.ic1", 0x0800000, 0x1000000, CRC(e01a31d2) SHA1(e00e138f6a20175c7aadb6500f6d7541b91def14) )
    ROM_LOAD( "mpr-23505.ic2", 0x1800000, 0x1000000, CRC(3a34d5fe) SHA1(f3c5f6fcbaa7004d371923eb412ea1fcf3fa461a) )
    ROM_LOAD( "mpr-23506.ic3", 0x2800000, 0x1000000, CRC(9cbab27d) SHA1(f166352355a03c9ccafbc15f926330b3622ec040) )
    ROM_LOAD( "mpr-23507.ic4", 0x3800000, 0x1000000, CRC(363c1734) SHA1(16b0485f1aacc8925b3c6d6152680139748e6df8) )
    ROM_LOAD( "mpr-23508.ic5", 0x4800000, 0x1000000, CRC(0a3590aa) SHA1(84c0e1853f069b003d09b268caee97e58c4dacb6) )
    ROM_LOAD( "mpr-23509.ic6", 0x5800000, 0x1000000, CRC(281d633d) SHA1(d773be8e95f7bf9212ee1061f3076220d4fce9e0) )
    ROM_LOAD( "mpr-23510.ic7", 0x6800000, 0x1000000, CRC(b856fef5) SHA1(0634f86740c438b40286256a0269570d24cb845a) )

    // 841-0011    2000     317-5059-COM   Naomi
    ROM_PARAMETER( ":rom_board:segam2crypt:key", "00000000" )
ROM_END

Then convert it in this format (remove the arrow notes):

// Capcom Vs. SNK Millennium Fight 2000 (Rev C)
    {
        "capsnk.zip",
        0x78000000,  <-- ROM_REGION
        0x00000000, <-- this is the crypt key
        NULL, <-- leave at NULL
        M2, <-- change as necessary
        {
            { "epr-23511c.ic22", 0x0000000, 0x4000000 },
            { "mpr-23504.ic1",   0x0800000, 0x1000000 },
            { "mpr-23505.ic2",   0x1800000, 0x1000000 },
            { "mpr-23506.ic3",   0x2800000, 0x1000000 },
            { "mpr-23507.ic4",   0x3800000, 0x1000000 },
            { "mpr-23508.ic5",   0x4800000, 0x1000000 },
            { "mpr-23509.ic6",   0x5800000, 0x1000000 },
            { "mpr-23510.ic7",   0x6800000, 0x1000000 },
            { NULL, 0, 0 },
        }
    }

If someone can get started on the //TODO M1 and M4 list from pastebin links above, that would be a good start. Paste them on pastebin when done and I can compile them for flyinghead.

I can get started on M2 list. This is a huge undertaking! Any volunteers?

EDIT - Use instructions I have below this thread!

newoski commented 5 years ago

I'm not a coder, so this sounds like something I could help with. I'll get started from the top of the list, if anyone else wants to work from the bottom...

blisstik commented 5 years ago

Use the above as a template. Basically the *.icX files are what we need to extract. Just look at the two blocks. If you want to chat, ping me on Discord with the same name here.

Shoegzer commented 5 years ago

@6alileo could you replace your link to naomi.c with this link please: https://github.com/mamedev/mame/blob/master/src/mame/drivers/naomi.cpp

The one you provided above is almost certainly outdated and only a fork, not an official part of the project. Thanks.

blisstik commented 5 years ago

@Shoegzer - done

newoski commented 5 years ago

All crypt keys get a preface of 0x?

newoski commented 5 years ago

Can you ping me on discord? Same username. Just signed up

newoski commented 5 years ago

The M1 and M2 pastebin links are identical. Deliberate?

blisstik commented 5 years ago

@newoski - fixed

Hold tight. I will have a scraped version. It's not perfect but will speed things up.

newoski commented 5 years ago

Holding. Ready to start tonight, once you update

blisstik commented 5 years ago

I basically did a ton of search and replace from a copy of naomi.cpp so nothing was manually edited but it still needs to be organized but should be a lot faster than starting from scratch.

So use the link below instead of naomi.cpp link above. Start with gram2000 in the M1 list then paste it here. It should look very similar to below. Note that there are 4 spaces for each indent.

https://pastebin.com/raw/EDz6XT25

// Capcom Vs. SNK Millennium Fight 2000 (Rev C)
    {
        "capsnk.zip",
        0x78000000,  <-- ROM_REGION
        0x00000000, <-- this is the crypt key
        NULL, <-- leave at NULL
        M2, <-- change as necessary
        {
            { "epr-23511c.ic22", 0x0000000, 0x4000000 },
            { "mpr-23504.ic1",   0x0800000, 0x1000000 },
            { "mpr-23505.ic2",   0x1800000, 0x1000000 },
            { "mpr-23506.ic3",   0x2800000, 0x1000000 },
            { "mpr-23507.ic4",   0x3800000, 0x1000000 },
            { "mpr-23508.ic5",   0x4800000, 0x1000000 },
            { "mpr-23509.ic6",   0x5800000, 0x1000000 },
            { "mpr-23510.ic7",   0x6800000, 0x1000000 },
            { NULL, 0, 0 },
        }
    }
blisstik commented 5 years ago

@newoski - see this detailed example

{ "cspike.zip", <-- from the quote, move to next line with 4 spaces; remove extra space after {
        NULL, <-- adjust 4 spaces
        M2, <-- adjust 4 spaces
<-- remove extra space
        0x6800000,{ <-- this line should go on top of _crypt_key; move { to separate line after M2 with 4 spaces
        { "epr-23210.ic22", 0x0000000, 0x0400000 },
        { "mpr-23198.ic1",  0x0800000, 0x0800000 },
        { "mpr-23199.ic2",  0x1000000, 0x0800000 },
        { "mpr-23200.ic3",  0x1800000, 0x0800000 },
        { "mpr-23201.ic4",  0x2000000, 0x0800000 },
        { "mpr-23202.ic5",  0x2800000, 0x0800000 },
        { "mpr-23203.ic6",  0x3000000, 0x0800000 },
        { "mpr-23204.ic7",  0x3800000, 0x0800000 },
        { "mpr-23205.ic8",  0x4000000, 0x0800000 },
        { "mpr-23206.ic9",  0x4800000, 0x0800000 },
        { "mpr-23207.ic10", 0x5000000, 0x0800000 },
        { "mpr-23208.ic11", 0x5800000, 0x0800000 },
        { "mpr-23209.ic12s",0x6000000, 0x0800000 },
        { NULL, 0, 0 }, <-- add this new line after last IC line
<-- remove extra line
<-- remove extra line        
        000e2010, _crypt_key <- this should go on top of NULL; add 0x in front; remove _crypt_key marker
    <-- one of the brackets go here, 4 spaces
}}
newoski commented 5 years ago

@6alileo how do I paste maintaining the formatting?

blisstik commented 5 years ago

@newoski - it's close - try practicing using the comment above

newoski commented 5 years ago

OK, here we go


// Capcom Vs. SNK Millennium Fight 2000 (Rev C)
    {
        "capsnk.zip",
    0x7800000,
    0x0000000,
        NULL,
        M2,
        {
           { "epr-23511c.ic22", 0x000000, 0x400000 },
           { "mpr-23504.ic1", 0x0800000, 0x1000000 },
           { "mpr-23505.ic2", 0x1800000, 0x1000000 },
           { "mpr-23506.ic3", 0x2800000, 0x1000000 },
           { "mpr-23507.ic4", 0x3800000, 0x1000000 },
           { "mpr-23508.ic5", 0x4800000, 0x1000000 },
           { "mpr-23509.ic6", 0x5800000, 0x1000000 },
           { "mpr-23510.ic7", 0x6800000, 0x1000000 },
           { NULL, 0, 0}
    }
}
newoski commented 5 years ago

Formatting is wrong, above, as I don't lknow how to maintain that formatting in GitHub... but otherwise I think I'm there, minus the last 3 lines which I need an explanation of

blisstik commented 5 years ago

Get on Discord please

newoski commented 5 years ago

OK, I've got it now I think:

// Capcom Vs. SNK Millennium Fight 2000 (Rev C) { "capsnk.zip", 0x7800000, 0x0000000, NULL, M2, { { "epr-23511c.ic22", 0x000000, 0x400000 }, { "mpr-23504.ic1", 0x0800000, 0x1000000 }, { "mpr-23505.ic2", 0x1800000, 0x1000000 }, { "mpr-23506.ic3", 0x2800000, 0x1000000 }, { "mpr-23507.ic4", 0x3800000, 0x1000000 }, { "mpr-23508.ic5", 0x4800000, 0x1000000 }, { "mpr-23509.ic6", 0x5800000, 0x1000000 }, { "mpr-23510.ic7", 0x6800000, 0x1000000 }, { NULL, 0, 0} } }

flyinghead commented 5 years ago

@Shoegzer I edited this issue to add support for Naomi M3 and AtomisWave ROMs. M3 carts are a variation of M2 and are supported.

newoski commented 5 years ago

Is there a list of M3 that needs to be prepped, like the other variants?

flyinghead commented 5 years ago

No, they are identified as M2 in mame

cubatilles commented 5 years ago

Hi,

Thank you all for all the work. I have a question for you. I was looking a the file /core/hw/naomi/naomi_roms.h to see which roms are already supported in the mame format, and saw that Dolphin Blue (atomiswave) has this comment: "dolphin.zip", // FIXME freezes when in-game

Does it mean this game freezes when ingame? Or is it something that has been already fixed? I remember playing dolphin blue some weeks ago in the old naomiswave/.lst converted roms format, and it was working fine. Could the problem be specific to the mame-formatted rom?

Thanks!

barbudreadmon commented 5 years ago

I remember playing dolphin blue some weeks ago in the old naomiswave/.lst converted roms format, and it was working fine.

You finished it ? iirc this game was freezing in lvl 5

cubatilles commented 5 years ago

Ah, no, I didin't get that far in the game. Sorry, I assumed the freeze was going to happen early on the game. I successfully finished levels 1 and 2.

Greetings.

flyinghead commented 5 years ago

Yes, there's a issue with the AtomisWave version of Dolphin Blue. The game freezes after a few seconds in-game. This doesn't happen on the Naomi conversion of the same game although the freeze on level 5 could very well be the same problem.

Shoegzer commented 5 years ago

@flyinghead thanks once again. Unfortunately though, there's a similar problem as before; i.e. loading an atomiswave zip results in dropping back to the RA menu without actually running it. This was resolved before by ensuring that the latest info file existed, so that was done again, but to no effect. I noticed that the MAME "awbios.zip" (atomiswave bios) is not listed in the info file. Could this be a reason?

newoski commented 5 years ago

@Shoegzer I just testing ggisuka, after updating my core, info, and databases and adding awbios.zip to my /System/DC folder. Game launched without issue and 4 players worked. Not sure if this helps get you going