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

CHD v5 support #54

Closed Shoegzer closed 5 years ago

Shoegzer commented 6 years ago

With all the (incredibly awesome) new developments to the Reicast core, I'm wondering if CHD v5 can be added as @rtissera recently did for some of the other cores. This would really boost usefulness, especially given the massive additions recently made to the MAME Dreamcast software list such as this one.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/59867758-chd-v5-support?utm_campaign=plugin&utm_content=tracker%2F49543223&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F49543223&utm_medium=issues&utm_source=github).
blackman91 commented 5 years ago

Yep that did it, all the chds v4 I had are working perfectly again and the chds v5 I created using latest chdman are still working the same, flying head does it again.

blackman91 commented 5 years ago

Every chd v5 I have created so far using the latest chdman has worked in the reicast RetroArch core but I notice there is stuttering in some parts and it is consistent among platforms, it happens on windows and android and it doesn't have to do with performance, it doesn't happen when using the normal .gdi. Anyone else experiencing this?

Kondorito commented 5 years ago

Thanks guys for following up on this matter! The last release fixed my CHDs v4 not running, but the games are running with stuttering, I cannot get a proper core override file (when I select it, it simply wipes my entire reicast core cfg file content), the core is not finding my VMUs on game launches, and it is selecting the mouse as the controller and does not take into account my decision to select and save the gamepad. Don't know if the above is an issue with my set solely, but wanted to share it just in case it adds something to the troubleshoot.

andres-asm commented 5 years ago

@blackman91 so the 0.197 chdman chds don't work but 0.202 works?

blackman91 commented 5 years ago

Don't know if all chv5 work using 0.202 just that the ones I have tested run but with stuttering during various parts, so far I have tested:

Both crazy Taxi games, cannon spike, marvel vs Capcom 2, house of the dead 2, dinocrisis, Dynamite Cop, elemental gimmick gear.

DJoneK commented 5 years ago

chdv5 are behaving just the same as before. Some (3track) discs load. Others don't. All that have more than 3 tracks either don't load or get stuck on the Sega License screen after booting. I suspect it's some sort of offset issue. Maybe it's having trouble reading the IP.bin from the last data tracks.

BTW, @blackman91 my CHDv5 Crazy Taxi 2 does not load. Goes straight to bios screen. Is your CHD file based off TOSEC? Would be interesting if a TOSEC CHD works but a redump.org CHD does not. Also, what region.

baka0815 commented 5 years ago

I did some changes in my PR on mainline reicast which (for me) makes 3-track CHDv5 working (including Sonic 2 which didn't work for me before).

However CHDv5 with more than 3 tracks fail to load (f.e. 102 Dalmatians - Puppies to the Rescue, Alone in the Dark - The New Nightmare or Re-Volt).

See https://github.com/reicast/reicast-emulator/pull/1400

blackman91 commented 5 years ago

I heard the redream open source (before they went closed, it had even a RetroArch core) has the chd v5 support too, any chance its code could help the reicast chd v5 support?

baka0815 commented 5 years ago

Yes, it at least includes the CHD library from @rtissera from last November. So the code in question would be around here: https://github.com/inolen/redream/blob/master/src/guest/gdrom/chd.c

However I don't know if it's working.

blackman91 commented 5 years ago

Yep it works, I tested some chd v5 created using latest chd man on redream gpl retroarch core and they all run on the core, so its code could definitely help the chd v5 reicast support.

blackman91 commented 5 years ago

https://github.com/reicast/reicast-emulator/pull/1400#issuecomment-434479385

DJoneK commented 5 years ago

Latest commit fixed CHDv5 loading. Now everything loads on my end. The only issue left is that Audio Tracks sound like static/white noise.

Awesome to see them load properly though. So close for full CHDv5 implementation!

DJoneK commented 5 years ago

CDDA now apparently got fixed but the buildbot hasn't updated the Windows version so I can't test it out yet.

Seems like the Android version got built though.

Shoegzer commented 5 years ago

Fantastic work, @baka0815 and @flyinghead (and others). I assume all known CHDv5 issues have been resolved and I can close this, but wanted to confirm with either (or both) of you first.

On a related note: I mentioned support for MAME rom sets in this issue thread, however that really belongs as a separate issue, so I opened one here.

newoski commented 5 years ago

You can extract chdman.exe from the latest MAME release on mamedev.org and pair it with this in a .bat file to easily convert a folder full of gdi dumps FYI:

for /r %%i in (*.cue, *.gdi) do chdman createcd -i "%%i" -o "%%~ni.chd

Thank you for this! I just tested it and the output is compressed between 50-80% the size of the original GDI version, is that right? That's a crazy amount of compression! Just want to confirm, before I do my whole set and remove the GDI copies

Awakened0 commented 5 years ago

It varies by game, but it's really good in most cases. I think it might even be better than certain .cdi dumps with lossy compression methods :)

newoski commented 5 years ago

It varies by game, but it's really good in most cases. I think it might even be better than certain .cdi dumps with lossy compression methods :)

Thanks! Now just hoping for final confirmation that CHDs are 100% supported by this core

DJoneK commented 5 years ago

I've tested both Windows and Android and CHDv5 are loading properly with proper CDDA. Everything seems working as intended. It's now a matter of finding any edge cases if any. I believe it can be considered to be implemented and this can finally be put to rest unless it's having some issues on other platforms. I can't test those though.

Kondorito commented 5 years ago

Tested as well, and all works great. I've seen some slow-downs where in previous versions there weren't (most noticeable for me was in Tennis 2k2 - while playing an exhibition match). Besides that; impressive work here!

Awakened0 commented 5 years ago

Tested a Bangai-O CHDv5. It loads and the music plays fine, but it only plays once in a stage, then goes silent. Loaded up the .gdi and that loops the BGM properly. Well, there is a few second pause between loops and initial load of the music, but it's always been that way. That's a bug I've been meaning to report once other stuff gets fixed. Demul and Redream have that problem too.

blackman91 commented 5 years ago

Tested Marcel vs Capcom 2 chd v5 on Android and Pc, the previous stuttering is gone in that game, nice job guys will keep testing.

Shoegzer commented 5 years ago

@Awakened0 that sounds like an upstream bug in the chd library given that other emulators experience the same issue. Have you tested Bangai-O in MAME itself? If so, and you get the same result, consider submitting a bug report on MAMETesters.

Awakened0 commented 5 years ago

@Shoegzer The silence gap between CDDA tracks playing happens in all three emulators whether in gdi or chd format. Doesn't happen on real hardware. Looking at some Youtube videos, it seems like maybe the PAL release doesn't have the issue on emulators. I'm testing the (USA) release.

Demul and Redream stand alone both loop the CDDA music properly as chd and gdi. While the latest Reicast core only loops it in gdi currently.

Shoegzer commented 5 years ago

Ah, when you said "Demul and ReDream have that problem too" for some reason I thought you were referring to the total silence problem but I see what you mean now. So yes, this indeed appears to be an obscure bug with reciast/CHD so I'll leave this open for now. Thanks for clarifying.

Shoegzer commented 5 years ago

@Awakened0 I just tested this myself but could not confirm the sound looping issue. Specifically, I launched the game and did not touch the controls but let the 300-second timer run down to 0 (it kept going into negative values but I felt that was sufficient time), and the music played the entire time. Then I died and continued the game but the music kept playing even then. This was tested against the official MAME dreamcast chd as listed here (search on page for "bangaio") with hashes for chd and source gdi files.

You might try the official dump in case your chd was converted incorrectly, or taken from a source that seemed correct but really wasn't, and therefore wouldn't convert properly (that's happened before as others have posted to mametesters). Also, should something specific be done to trigger the looping issue, that I haven't done?

In any event, given that all other chd v5s seem to be fine except for this very specific edge case which can't be confirmed, I'll probably close this issue soon unless I'm missing something from what you originally reported.

Awakened0 commented 5 years ago

I can sit still on level 1 and the music will stop at about the 122 mark on the timer. If I go up to the infostation (radio looking thing with an M on it) the music for that will play, then when I exit the dialogue the stage music will start playing again. Interestingly, the music on the stage select screen never stops on loops.

My Bangai-O (USA).chd's SHA-1 doesn't match anything in that database. I'm just curious, but if you run chdman info on the MAME official chd, does it show it as a V5? I don't know how up to date MAME's database is, but I just want to make sure it's not referencing a V4 chd.

Shoegzer commented 5 years ago

Ah, good point. However, a "chdman info" reveals it's version 5, which should be the case for all the dc chds (they were all added earlier this year).

Also, a reminder that to get the actual SHA-1 of the data (as opposed to a hash of the chd container) you have to run "chdman info -i ". This should be a different SHA-1 than a file-level hash.

Awakened0 commented 5 years ago

Ok, I went and reconverted the original Redump verified gdi dump to chdv5 using the latest chdman (0.203) and now the BGM loops properly! Thanks for checking on the issue @Shoegzer . I guess you can close this now : D

Here's the chdman info in case anyone is interested: https://hastebin.com/necalodira.makefile

Shoegzer commented 5 years ago

Great to hear it works for you now @Awakened0!

Closing this issue now. This is the end of a long road to CHDv5 support for the reicast core and I just want to thank everyone involved for the hard work in making this important feature happen.

faerot commented 4 years ago

Recent .chds not working for me. I have downloaded redump from archive.org, then used chdman from MAME 0.214b to make .chd and it does not load in RetroArch using latest core flycast_libretro.dll.zip downloaded via core updater.

RetroArch says: G:\Games\Sega Dreamcast\Marvel vs. Capcom - Clash of Super Heroes (USA).chd: Bad image format

I've tried numerous newly converted chds and none of them work.

Can provide full RetroArch log if it helmps.

Any ideas?

rtissera commented 4 years ago

Well sounds like they changed to format again :(

faerot commented 4 years ago

Saturn, Sega CD, 3DO, and CD-i cores work well with chds converted with the same chdman, so maybe its something GD-ROM related? Or they don't use your libchdr?

rtissera commented 4 years ago

If my memories are good, GDROM uses a different codec than CDROM into the CHD

On Sat, Nov 9, 2019 at 5:58 PM faerot notifications@github.com wrote:

Saturn, 3DO, and CD-i cores work well with chds converted with the same chdman, so maybe its something GD-ROM related? Or they don't use your libchdr?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libretro/flycast/issues/54?email_source=notifications&email_token=AAW4WBLW5YJHZHTF34HAVXLQS3T4HA5CNFSM4FFXIP22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDUKMKA#issuecomment-552117800, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAW4WBIQOGAI3DKBXPEODZ3QS3T4HANCNFSM4FFXIP2Q .

DJoneK commented 4 years ago

Download the .gdi files from redump site Download section and use that to create the .chd instead of using the .cue. They will/should work.

faerot commented 4 years ago

Download the .gdi files from redump site Download section and use that to create the .chd instead of using the .cue. They will/should work.

Indeed, creating .chd off .gdi instead of .cue worked, thanks for the heads up