libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.34k stars 1.84k forks source link

RA v1.8.6 does not properly parse TG-16/PCE CDs under Windows 10 #10639

Open gamescan opened 4 years ago

gamescan commented 4 years ago

Description

When dumping (or playing) an original TG-16 or PCE CD-ROM disc, RetroArch improperly reads the disc layout. The causes in-game CD audio playback to be slightly out of sync with game audio effects. This is most noticeable with games that use voiced cutscenes, like the intro to Castlevania: Rondo of Blood.

Behavior is identical when playing from an original disc or a dump made in RetroArch from that disc.

Multiple dumps were made on two difference drives (one internal, one external) and the results of all the dumps were identical.

The original game CD and the dumps were tested on Beetle PCE Fast and Beetle PCE. Behavior was identical across the cores.

This issue was mentioned once on Reddit about 10 months ago. The solution for that poster was to download a copy from somewhere rather than using RetroArch to dump or play the original disc.

Expected behavior

I will use Rondo of Blood in these examples just because it is very easy to see the issue immediately.

Play from disc:

1) Insert PCE CD (Rondo). 2) Load Beetle PCE Fast core. 3) Load Disc. 4) Run game. 5) Watch game intro. 6) Start playing game.

Dump disc and play:

1) Insert PCE CD (Rondo). 2) Dump Disc to hard drive using RA. 3) Load Beetle PCE Fast core. 4) Load Content (select newly dumped game). 5) Run game. 6) Watch game intro. 7) Start game.

Actual behavior

Play from disc:

1) Insert PCE CD (Rondo). 2) Load Beetle PCE Fast core. 3) Load Disc. 4) Run game. 5) Watch game intro. <----- Audio is not synced with subtitles. Beginning of next audio track briefly (and incorrectly) plays at title screen. 6) Start playing game.

Dump disc and play:

1) Insert PCE CD (Rondo). 2) Dump Disc to hard drive using RA. 3) Load Beetle PCE Fast core. 4) Load Content (select newly dumped game). 5) Run game. 6) Watch game intro. <----- Audio is not synced with subtitles. Beginning of next audio track briefly (and incorrectly) plays at title screen. 7) Start game.

Example CUE file produced by RetroArch

This CUE file was created by RetroArch from an original PCE Rondo of Blood game CD (ring marker FABT). It does not match the ReDump CUE file for the same game.

FILE "cdrom-200511-194511 (Track 01).bin" BINARY
  TRACK 01 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 02).bin" BINARY
  TRACK 02 MODE1/2352
    INDEX 01 00:00:00
FILE "cdrom-200511-194511 (Track 03).bin" BINARY
  TRACK 03 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 04).bin" BINARY
  TRACK 04 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 05).bin" BINARY
  TRACK 05 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 06).bin" BINARY
  TRACK 06 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 07).bin" BINARY
  TRACK 07 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 08).bin" BINARY
  TRACK 08 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 09).bin" BINARY
  TRACK 09 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 10).bin" BINARY
  TRACK 10 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 11).bin" BINARY
  TRACK 11 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 12).bin" BINARY
  TRACK 12 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 13).bin" BINARY
  TRACK 13 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 14).bin" BINARY
  TRACK 14 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 15).bin" BINARY
  TRACK 15 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 16).bin" BINARY
  TRACK 16 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 17).bin" BINARY
  TRACK 17 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 18).bin" BINARY
  TRACK 18 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 19).bin" BINARY
  TRACK 19 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 20).bin" BINARY
  TRACK 20 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 21).bin" BINARY
  TRACK 21 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "cdrom-200511-194511 (Track 22).bin" BINARY
  TRACK 22 MODE1/2352
    INDEX 01 00:00:00

Link to ReDump CUE for comparison: http://redump.org/disc/29878/

Track size comparisons between RA dumped files and ReDump info

Track data sizes are different for selected tracks. All other track file sizes are the same as the ReDump file sizes. None of the MD5s from RetroArch dumped tracks match the values on ReDump. This seems to hint at the fact that RetroArch is starting at an incorrect value when initializing a dump.

Track 1:

Track 2:

Track 3:

Track 21:

Track 22:

Steps to reproduce the bug

  1. Acquire an original TG-16 or PCE game CD.
  2. Dump disc using RetroArch.
  3. Play game using the RetroArch dump with any of the RetroArch PCE cores..

Alternative:

  1. Acquire an original TG-16 or PCE game CD.
  2. Play game from original CD using any of the RetroArch PCE cores.

Bisect Results

I only recently starting using RetroArch with v1.8,6, but this 10 month old Reddit post indicates that the issue may have been ongoing for awhile.

https://www.reddit.com/r/RetroArch/comments/c8f979/akumajou_dracula_x_chi_no_rondo_pc_engine/

Version/Commit

You can find this information under Information/System Information

Environment information

barbudreadmon commented 4 years ago

The issue might be about wrong pregap calculation when the data is on second track. Out of curiosity i tried Last Bronx (Saturn), a game i knew for doing something similar, here is its redump's cue :

FILE "Last Bronx (USA) (Track 01).bin" BINARY
  TRACK 01 MODE1/2352
    INDEX 01 00:00:00
FILE "Last Bronx (USA) (Track 02).bin" BINARY
  TRACK 02 MODE2/2352
    INDEX 00 00:00:00
    INDEX 01 00:03:00
FILE "Last Bronx (USA) (Track 03).bin" BINARY
  TRACK 03 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
...

With real CD, it failed the same way on beetle-saturn & kronos. It might also be worth mentioning that there was a fix last year in Kronos for those games using unusual toc : https://github.com/FCare/Kronos/commit/a1f869dabcb51901641d0dc3426980b76e797423 NB : by unusual i mean the games not having this classic layout : 1st track is data then other tracks are audio

otonoton commented 4 years ago

Many drives do not decode TOC with perfect accuracy due to physical CD design. You need a Plextor drive with special undocumented commands, or a way to read Q subchannel between every track which is slow and difficult (take time) if you just want to play game.

This is why Redump CUEs are more accurate (they use Plextor) I suggest to just using theirs in place of the one generated when dumping from retroarch because it is not accurate.

Some discs even have mismatched pregap that alternates every other track like MegaCD but generic drive's decoded TOC will not see this.

barbudreadmon commented 4 years ago

@otonoton hardware limitations can't be the only problem here : for Last Bronx, Kronos standalone, which has real cd support, is able to read the disc properly, so there is no doubts the cues written by RA are wrongly computed in some cases.

Symos404 commented 2 years ago

I have noticed this too when dumping Mega CD games. Sonic CD Euro and Final Fight CD Euro in particular