libretro-mirrors / beetle-saturn-libretro

Standalone port of Mednafen Saturn to the libretro API.
GNU General Public License v2.0
61 stars 40 forks source link

Last Bronx (USA) - CHD does not load properly #162

Open ner00 opened 4 years ago

ner00 commented 4 years ago

It seems there is an issue with Beetle's CHD support in regards to this particular game. There is also a chance that it is a bad dump, but so far everything indicates the opposite. The BIN/CUE loads fine, the CHD does not. The CHD loads in every other Sega Saturn core except for Beetle. The dump seems to be trustworthy, partially because it's the same one listed in redumps.org, this one in particular: http://redump.org/disc/51689/

I have tried all other redumps (same hashes as the ones in libretro db); the issue is the same in all with the notable exception of the Japanese (disc1) version. In any case, if the CHD is converted back to BIN/CUE it loads fine for every game/region. I don't think this particular issue stands with the dump, and as far as I know there are no other games affected, but then again I have not tested a great deal of CHD derived versions. As it stands, this very narrow issue seems to originate in the core.

Note: First mention of this issue that I could find was over at RetroArch's forum, dating back to April 2018: https://forums.libretro.com/t/bug-in-chd-support-for-beetle-saturn-core/15875

CHD info

chdman - MAME Compressed Hunks of Data (CHD) manager 0.218 (mame0218)
Input file:   Last Bronx (USA).chd
File Version: 5
Logical size: 451,440,576 bytes
Hunk Size:    19,584 bytes
Total Hunks:  23,052
Unit Size:    2,448 bytes
Total Units:  184,412
Compression:  cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)
CHD size:     259,096,103 bytes
Ratio:        57.4%
SHA1:         25017bdb04540e620843de0938c27f79f51b3628
Data SHA1:    ec4b12c7cbf1784b3962e0471c08af15efbfebfd
Metadata:     Tag='CHT2'  Index=0  Length=90 bytes
              TRACK:1 TYPE:MODE1_RAW SUBTYPE:NONE FRAMES:894 PREGAP:0 PGTY
Metadata:     Tag='CHT2'  Index=1  Length=99 bytes
              TRACK:2 TYPE:MODE2_RAW SUBTYPE:NONE FRAMES:45019 PREGAP:225
Metadata:     Tag='CHT2'  Index=2  Length=90 bytes
              TRACK:3 TYPE:AUDIO SUBTYPE:NONE FRAMES:3030 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=3  Length=90 bytes
              TRACK:4 TYPE:AUDIO SUBTYPE:NONE FRAMES:2401 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=4  Length=90 bytes
              TRACK:5 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=5  Length=90 bytes
              TRACK:6 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=6  Length=90 bytes
              TRACK:7 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=7  Length=90 bytes
              TRACK:8 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=8  Length=90 bytes
              TRACK:9 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=9  Length=91 bytes
              TRACK:10 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=10  Length=91 bytes
              TRACK:11 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=11  Length=91 bytes
              TRACK:12 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=12  Length=91 bytes
              TRACK:13 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=13  Length=91 bytes
              TRACK:14 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=14  Length=91 bytes
              TRACK:15 TYPE:AUDIO SUBTYPE:NONE FRAMES:8341 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=15  Length=92 bytes
              TRACK:16 TYPE:AUDIO SUBTYPE:NONE FRAMES:10141 PREGAP:150 PGT
Metadata:     Tag='CHT2'  Index=16  Length=91 bytes
              TRACK:17 TYPE:AUDIO SUBTYPE:NONE FRAMES:3751 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=17  Length=91 bytes
              TRACK:18 TYPE:AUDIO SUBTYPE:NONE FRAMES:4650 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=18  Length=90 bytes
              TRACK:19 TYPE:AUDIO SUBTYPE:NONE FRAMES:450 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=19  Length=90 bytes
              TRACK:20 TYPE:AUDIO SUBTYPE:NONE FRAMES:676 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=20  Length=90 bytes
              TRACK:21 TYPE:AUDIO SUBTYPE:NONE FRAMES:676 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=21  Length=91 bytes
              TRACK:22 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=22  Length=91 bytes
              TRACK:23 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=23  Length=91 bytes
              TRACK:24 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY

Another thing is, if I clear the game memory, I can see that Beetle is (kind of) loading the game, but messes things up in the process, here's an example of what I mean:

BIN/CUE at boot with memory clean

CHD at boot with memory clean (note: the selection rectangle is blinking normally despite having no text on screen, also responds correctly to up/down D-Pad option changes)

I have only tested about a dozen games with Beetle, but this one game seems to show some issue with emulation and CHD support at once, which does not affect other games or cores as far as I know. Logging does not show anything out of the ordinary, the opposite in fact:

[INFO] Loading dynamic libretro core from: "I:\RetroArch\cores\mednafen_saturn_libretro.dll"
[libretro INFO] Loading "I:\RetroArch\roms\Sega - Saturn\Last Bronx (USA).chd"
[libretro INFO] chd_load 'I:\RetroArch\roms\Sega - Saturn\Last Bronx (USA).chd' hunkbytes=19584
[libretro DEBUG] Disc 1
[libretro DEBUG] - Track  1, LBA:      0  DATA
[libretro DEBUG] - Track  2, LBA:   1119  DATA
[libretro DEBUG] - Track  3, LBA:  46063  AUDIO
[libretro DEBUG] - Track  4, LBA:  49093  AUDIO
[libretro DEBUG] - Track  5, LBA:  51494  AUDIO
[libretro DEBUG] - Track  6, LBA:  59520  AUDIO
[libretro DEBUG] - Track  7, LBA:  67546  AUDIO
[libretro DEBUG] - Track  8, LBA:  75572  AUDIO
[libretro DEBUG] - Track  9, LBA:  83598  AUDIO
[libretro DEBUG] - Track 10, LBA:  91624  AUDIO
[libretro DEBUG] - Track 11, LBA:  99650  AUDIO
[libretro DEBUG] - Track 12, LBA: 107676  AUDIO
[libretro DEBUG] - Track 13, LBA: 115702  AUDIO
[libretro DEBUG] - Track 14, LBA: 123728  AUDIO
[libretro DEBUG] - Track 15, LBA: 131754  AUDIO
[libretro DEBUG] - Track 16, LBA: 140095  AUDIO
[libretro DEBUG] - Track 17, LBA: 150236  AUDIO
[libretro DEBUG] - Track 18, LBA: 153987  AUDIO
[libretro DEBUG] - Track 19, LBA: 158637  AUDIO
[libretro DEBUG] - Track 20, LBA: 159087  AUDIO
[libretro DEBUG] - Track 21, LBA: 159763  AUDIO
[libretro DEBUG] - Track 22, LBA: 160439  AUDIO
[libretro DEBUG] - Track 23, LBA: 168465  AUDIO
[libretro DEBUG] - Track 24, LBA: 176491  AUDIO
[libretro DEBUG] Leadout: 184367
[libretro DEBUG] Calculating layout MD5.
[libretro DEBUG] Done calculating layout MD5.
[libretro INFO] Calculating game ID (1 discs)
[libretro INFO] Game ID is: MK-81078
[libretro INFO] This is a Saturn disc.
[libretro INFO] Disc Region: "USA"
[libretro INFO] [Mednafen]: CPU Cache Emulation Mode: Data only
[libretro INFO] [Mednafen]: Region: 0x4.
[libretro INFO] [Mednafen]: Cart: Backup Memory.
[INFO] [RCHEEVOS]: ext_hash 0b8865d4 ('chd')
[INFO] Skipping SRAM load..
[INFO] [RCHEEVOS]: Load task finished
ner00 commented 4 years ago

I have now tried the 4 existing versions of this game, only Japan Disc1 loads in CHD format, all the other ones fail in pretty much the same way, with Japanese Disc2 failing harder for whatever reason:

[libretro INFO] Calculating game ID (1 discs)
[INFO] [Environ]: SET_MESSAGE: Uncorrectable data at sector 425
[libretro ERROR] Uncorrectable data at sector 425
[INFO] [Environ]: SET_MESSAGE: Uncorrectable data at sector 426
[libretro ERROR] Uncorrectable data at sector 426
[INFO] [Environ]: SET_MESSAGE: Uncorrectable data at sector 427
[libretro ERROR] Uncorrectable data at sector 427
[libretro INFO] Game ID is: GS-9152
[libretro INFO] This is a Saturn disc.
[libretro INFO] Disc Region: "Japan"
[libretro INFO] [Mednafen]: CPU Cache Emulation Mode: Data only
[libretro INFO] [Mednafen]: Region: 0x1.
[libretro INFO] [Mednafen]: Cart: Backup Memory.
[INFO] [RCHEEVOS]: ext_hash 0b8865d4 ('chd')
[INFO] Skipping SRAM load..
[INFO] [RCHEEVOS]: Load task finished
  1. Last Bronx (Europe) - BIN/CUE loads fine, but CHD fails (bugs out at memory selection screen) - rom ( name "Last Bronx (Europe) (Track 01).bin" size 2283792 crc 98b3c93a md5 4ac09ea7ade738e5047f9d147ea3dc9a sha1 93c4556a49d00006507d344b69aae438f2c63eaa )

  2. Last Bronx (Japan) (Disc 1) (Arcade Disc) - BIN/CUE loads fine, CHD also loads fine - rom ( name "Last Bronx (Japan) (Disc 1) (Arcade Disc) (Track 01).bin" size 1053696 crc fb1a3516 md5 04e18ea40b07b10a115bc9a4c734d4b7 sha1 685ece7c8d9b5dd9e87fd50fb33bd938054db2bf )

  3. Last Bronx (Japan) (Disc 2) (Special Disc) - BIN/CUE loads fine, but CHD fails (bugs out at memory selection screen), also shows Uncorrectable data sector errors when loading - rom ( name "Last Bronx (Japan) (Disc 2) (Special Disc) (Track 01).bin" size 999600 crc 97c95b96 md5 f793cca5d01111186927024f6cde289a sha1 88fb0aecba795f482a28fa8a92b745b9dfaf2d4d )

  4. Last Bronx (USA) - BIN/CUE loads fine, but CHD fails (bugs out at memory selection screen) - rom ( name "Last Bronx (USA) (Track 01).bin" size 2102688 crc c3cf9622 md5 5b6d9047edfd31f88ec66234592de15a sha1 c8fd7e68b0c42f72298662395c305bbed47ba6e1 )

In all the four versions above, both formats load correctly in all other Sega Saturn cores (YabaSanshiro, Yabause, Kronos).

Info from remaining CHDs

Last Bronx (Europe)

chdman - MAME Compressed Hunks of Data (CHD) manager 0.218 (mame0218)
Input file:   Last Bronx (Europe).chd
File Version: 5
Logical size: 467,254,656 bytes
Hunk Size:    19,584 bytes
Total Hunks:  23,859
Unit Size:    2,448 bytes
Total Units:  190,872
Compression:  cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)
CHD size:     262,710,661 bytes
Ratio:        56.2%
SHA1:         278649fbbef4a6db0f75eda4232b0e0c4e5bce61
Data SHA1:    54b309c54f6524d9640e680f18dd0a12f2809de7
Metadata:     Tag='CHT2'  Index=0  Length=90 bytes
              TRACK:1 TYPE:MODE1_RAW SUBTYPE:NONE FRAMES:971 PREGAP:0 PGTY
Metadata:     Tag='CHT2'  Index=1  Length=99 bytes
              TRACK:2 TYPE:MODE2_RAW SUBTYPE:NONE FRAMES:51401 PREGAP:150
Metadata:     Tag='CHT2'  Index=2  Length=90 bytes
              TRACK:3 TYPE:AUDIO SUBTYPE:NONE FRAMES:3030 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=3  Length=90 bytes
              TRACK:4 TYPE:AUDIO SUBTYPE:NONE FRAMES:2401 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=4  Length=90 bytes
              TRACK:5 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=5  Length=90 bytes
              TRACK:6 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=6  Length=90 bytes
              TRACK:7 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=7  Length=90 bytes
              TRACK:8 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=8  Length=90 bytes
              TRACK:9 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=9  Length=91 bytes
              TRACK:10 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=10  Length=91 bytes
              TRACK:11 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=11  Length=91 bytes
              TRACK:12 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=12  Length=91 bytes
              TRACK:13 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=13  Length=91 bytes
              TRACK:14 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=14  Length=91 bytes
              TRACK:15 TYPE:AUDIO SUBTYPE:NONE FRAMES:8341 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=15  Length=92 bytes
              TRACK:16 TYPE:AUDIO SUBTYPE:NONE FRAMES:10141 PREGAP:150 PGT
Metadata:     Tag='CHT2'  Index=16  Length=91 bytes
              TRACK:17 TYPE:AUDIO SUBTYPE:NONE FRAMES:3751 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=17  Length=91 bytes
              TRACK:18 TYPE:AUDIO SUBTYPE:NONE FRAMES:4650 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=18  Length=90 bytes
              TRACK:19 TYPE:AUDIO SUBTYPE:NONE FRAMES:450 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=19  Length=90 bytes
              TRACK:20 TYPE:AUDIO SUBTYPE:NONE FRAMES:676 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=20  Length=90 bytes
              TRACK:21 TYPE:AUDIO SUBTYPE:NONE FRAMES:676 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=21  Length=91 bytes
              TRACK:22 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=22  Length=91 bytes
              TRACK:23 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY
Metadata:     Tag='CHT2'  Index=23  Length=91 bytes
              TRACK:24 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:150 PGTY

Last Bronx (Japan) (Disc 1) (Arcade Disc)

chdman - MAME Compressed Hunks of Data (CHD) manager 0.218 (mame0218)
Input file:   Last Bronx (Japan) (Disc 1) (Arcade Disc).chd
File Version: 5
Logical size: 432,091,584 bytes
Hunk Size:    19,584 bytes
Total Hunks:  22,064
Unit Size:    2,448 bytes
Total Units:  176,508
Compression:  cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)
CHD size:     254,922,636 bytes
Ratio:        59.0%
SHA1:         30c56ae7559c973707b60468de3b5f7ecd796b3c
Data SHA1:    e76e70aa9c67f528a1c25475a9e40fc0bfbfe902
Metadata:     Tag='CHT2'  Index=0  Length=90 bytes
              TRACK:1 TYPE:MODE1_RAW SUBTYPE:NONE FRAMES:448 PREGAP:0 PGTY
Metadata:     Tag='CHT2'  Index=1  Length=99 bytes
              TRACK:2 TYPE:MODE2_RAW SUBTYPE:NONE FRAMES:37561 PREGAP:300
Metadata:     Tag='CHT2'  Index=2  Length=90 bytes
              TRACK:3 TYPE:AUDIO SUBTYPE:NONE FRAMES:3031 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=3  Length=90 bytes
              TRACK:4 TYPE:AUDIO SUBTYPE:NONE FRAMES:2401 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=4  Length=90 bytes
              TRACK:5 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=5  Length=90 bytes
              TRACK:6 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=6  Length=90 bytes
              TRACK:7 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=7  Length=90 bytes
              TRACK:8 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=8  Length=90 bytes
              TRACK:9 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=9  Length=91 bytes
              TRACK:10 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=10  Length=91 bytes
              TRACK:11 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=11  Length=91 bytes
              TRACK:12 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=12  Length=91 bytes
              TRACK:13 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=13  Length=91 bytes
              TRACK:14 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=14  Length=91 bytes
              TRACK:15 TYPE:AUDIO SUBTYPE:NONE FRAMES:8341 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=15  Length=92 bytes
              TRACK:16 TYPE:AUDIO SUBTYPE:NONE FRAMES:10141 PREGAP:149 PGT
Metadata:     Tag='CHT2'  Index=16  Length=91 bytes
              TRACK:17 TYPE:AUDIO SUBTYPE:NONE FRAMES:3751 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=17  Length=91 bytes
              TRACK:18 TYPE:AUDIO SUBTYPE:NONE FRAMES:4650 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=18  Length=90 bytes
              TRACK:19 TYPE:AUDIO SUBTYPE:NONE FRAMES:450 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=19  Length=90 bytes
              TRACK:20 TYPE:AUDIO SUBTYPE:NONE FRAMES:676 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=20  Length=90 bytes
              TRACK:21 TYPE:AUDIO SUBTYPE:NONE FRAMES:676 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=21  Length=91 bytes
              TRACK:22 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=22  Length=91 bytes
              TRACK:23 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=23  Length=91 bytes
              TRACK:24 TYPE:AUDIO SUBTYPE:NONE FRAMES:8025 PREGAP:149 PGTY

Last Bronx (Japan) (Disc 2) (Special Disc)

chdman - MAME Compressed Hunks of Data (CHD) manager 0.218 (mame0218)
Input file:   Last Bronx (Japan) (Disc 2) (Special Disc).chd
File Version: 5
Logical size: 491,421,312 bytes
Hunk Size:    19,584 bytes
Total Hunks:  25,093
Unit Size:    2,448 bytes
Total Units:  200,744
Compression:  cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)
CHD size:     290,421,659 bytes
Ratio:        59.1%
SHA1:         2859748985c93a4adc0b77d10aecf2bec38ee918
Data SHA1:    55ae185b4959d363e3c5930e269b6e50773cfca3
Metadata:     Tag='CHT2'  Index=0  Length=90 bytes
              TRACK:1 TYPE:MODE1_RAW SUBTYPE:NONE FRAMES:425 PREGAP:0 PGTY
Metadata:     Tag='CHT2'  Index=1  Length=99 bytes
              TRACK:2 TYPE:MODE2_RAW SUBTYPE:NONE FRAMES:61817 PREGAP:300
Metadata:     Tag='CHT2'  Index=2  Length=90 bytes
              TRACK:3 TYPE:AUDIO SUBTYPE:NONE FRAMES:3031 PREGAP:150 PGTYP
Metadata:     Tag='CHT2'  Index=3  Length=90 bytes
              TRACK:4 TYPE:AUDIO SUBTYPE:NONE FRAMES:2401 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=4  Length=90 bytes
              TRACK:5 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=5  Length=90 bytes
              TRACK:6 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=6  Length=90 bytes
              TRACK:7 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=7  Length=90 bytes
              TRACK:8 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=8  Length=90 bytes
              TRACK:9 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=9  Length=91 bytes
              TRACK:10 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=10  Length=91 bytes
              TRACK:11 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=11  Length=91 bytes
              TRACK:12 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=12  Length=91 bytes
              TRACK:13 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=13  Length=91 bytes
              TRACK:14 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=14  Length=91 bytes
              TRACK:15 TYPE:AUDIO SUBTYPE:NONE FRAMES:8341 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=15  Length=92 bytes
              TRACK:16 TYPE:AUDIO SUBTYPE:NONE FRAMES:10141 PREGAP:149 PGT
Metadata:     Tag='CHT2'  Index=16  Length=91 bytes
              TRACK:17 TYPE:AUDIO SUBTYPE:NONE FRAMES:3751 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=17  Length=91 bytes
              TRACK:18 TYPE:AUDIO SUBTYPE:NONE FRAMES:4650 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=18  Length=90 bytes
              TRACK:19 TYPE:AUDIO SUBTYPE:NONE FRAMES:450 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=19  Length=90 bytes
              TRACK:20 TYPE:AUDIO SUBTYPE:NONE FRAMES:676 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=20  Length=90 bytes
              TRACK:21 TYPE:AUDIO SUBTYPE:NONE FRAMES:676 PREGAP:149 PGTYP
Metadata:     Tag='CHT2'  Index=21  Length=91 bytes
              TRACK:22 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=22  Length=91 bytes
              TRACK:23 TYPE:AUDIO SUBTYPE:NONE FRAMES:8026 PREGAP:149 PGTY
Metadata:     Tag='CHT2'  Index=23  Length=91 bytes
              TRACK:24 TYPE:AUDIO SUBTYPE:NONE FRAMES:8025 PREGAP:149 PGTY
ner00 commented 4 years ago

@rtissera , @twinaphex would appreciate if you guys could look at the CHD implementation in this core, seems it has some quirks that prevent some games from loading, the one mentioned in this issue's title being the one I've come across thus far. I think the issue is not the medium, but you guys could confirm that. I can also help with testing and debugging if needed.

rtissera commented 4 years ago

I will try to have a look, it's a very narrow issue. Any other issues on CHD support on various other Saturn games or other cores you could point me to ?

ner00 commented 4 years ago

Thanks. I understand @rtissera , it's very niche. Anyway, while testing stuff around I also found the issue #163 mentioned above your reply, which is something that even though affects more broadly the format (all games?), is something that in practice... well, no one wants to use uncompressed CHD, it's just that it might be a lead as to why there are other issues with CHD.

Apart from that, Kronos and YabaSanshiro have no issue at all with any game or CHD compression type from my tests; weirdly enough Yabause hangs at boot with an uncompressed CHD of Last Bronx (USA/EUR), but will not hang with a compressed one or uncompressed CHD of any other game I tested, as I mentioned in issue #163

Thanks in advance.

EDIT: I tested v4 and v5 of CHD, did not make any difference in this matter.

rtissera commented 4 years ago

Now that's get interesting.... I'm not sure uncompressed hunks are implemented (EDIT: correctly) :) Maybe Last Bronx is affected by the issue compressed or not because the deflate or LZMA compression can't get it smaller (at least for some hunks), so CHDMAN choose to keep the data uncompressed for first data tracks (or parts of it).

ner00 commented 4 years ago

That is very interesting indeed... so the explains why uncompressed hunks won't work, that could be just tagged as an enhancement and left for later, but if you're right then the lack of uncompressed hunk support is the reason why the CHD isn't loading. In other words, the Japanese version works just because the size happened to fit the compression and no seemingly important data was left uncompressed. EDIT: On the other hand, the USA/EUR versions were unfortunate enough because (important) parts of it's data couldn't be shrinked further and were left uncompressed, hence Beetle can't read it. Bu then shouldn't it register an error in the logs as it does with fully uncompressed hunks as demonstrated in #163 ?

Sanaki commented 4 years ago
     Hunks  Percent  Name
----------  -------  ------------------------------------
       412     1.8%  Copy from self
     5,709    24.8%  CD LZMA
        57     0.2%  CD Deflate
    16,874    73.2%  CD FLAC

None of it is uncompressed. You can verify with your own by adding -v to your info check. That said, for most games only the first track is data, not the first two (indeed, for every other game I personally have). It could be related to that. The only system where I've seen multiple data tracks often is Dreamcast, and from what I've been told (but haven't tested), cue-based chds won't function, while gdi-based chds will. Based on that, I would assume cue chds and multiple data tracks don't get along for some unknown reason. Could be as simple as a cuefile tweak to fix it if so, if we knew what caused that.

Last Bronx track 2:

Metadata:     Tag='CHT2'  Index=1  Length=99 bytes
              TRACK:2 TYPE:MODE2_RAW SUBTYPE:NONE FRAMES:45019 PREGAP:225 PGTYPE:VMODE2_RAW PGSUB:NONE POSTGAP:0.

Radiant Silvergun track 2 for comparison:

Metadata:     Tag='CHT2'  Index=1  Length=90 bytes
              TRACK:2 TYPE:AUDIO SUBTYPE:NONE FRAMES:1739 PREGAP:150 PGTYPE:VAUDIO PGSUB:NONE POSTGAP:0.
ner00 commented 4 years ago

@Sanaki That's interesting, but there are two questions that are not answered by that theory:

  1. Why the same CHD will work fine in both Kronos and YabaSanshiro?
  2. Why the Japanese version has no issues since it shares the same traits as its USA/EUR counterparts?

Last Bronx (Japan) (Disc 1) (Arcade Disc) - track 2:

Metadata:     Tag='CHT2'  Index=1  Length=99 bytes
              TRACK:2 TYPE:MODE2_RAW SUBTYPE:NONE FRAMES:37561 PREGAP:300 PGTYPE:VMODE2_RAW PGSUB:NONE POSTGAP:0.

JAP CHD verbose output:

     Hunks  Percent  Name
----------  -------  ------------------------------------
       422     1.9%  Copy from self
     4,711    21.4%  CD LZMA
        50     0.2%  CD Deflate
    16,881    76.5%  CD FLAC
Sanaki commented 4 years ago

No idea. I'm just saying that's the only thing I see myself that's particularly unique and relates to the chd format. Since the jp version has the same trait and doesn't exhibit the same behavior, figuring out what sets them apart should help answer that, but I have no answer myself.

ner00 commented 4 years ago

Sure, I understand. In the end I think the issue must be in the core, even though some peculiarity of the game may be involved. It's not as if the other cores load the game properly by parsing inaccurately the CHD.

Just for testing I swapped the last 22 out of 24 tracks from the US version with JP's, BIN/CUE still work, CHD still doesn't. All the data is still in tracks 1 and 2, swapping one and not the other will glitch the boot, changing the disc region does not change anything either.

US version has 142 more files in track1; 3 main EXEs different in content and a 4th EXE not present in the JP version, the rest is the same. track2 I don't know what's the format and its contents, but that's where the bulk of data is and the US version is some 15MB bigger. Anyway, this isn't helpful at all, just some curiosity.

Mr-Jake commented 3 years ago

libchdr was recently updated for the Saturn core in https://github.com/libretro/beetle-saturn-libretro/pull/171

Could you test to see if it solves the issue?

ner00 commented 3 years ago

@Mr-Jake Thanks for the heads-up. I tried the latest available version of the core (v1.22.2 24c62b7) and unfortunately the same glitch happens.

negativeExponent commented 3 years ago

issue is probably similar to this: https://github.com/libretro/beetle-saturn-libretro/issues/163 we need the whole thing from libchdr updated.

https://github.com/libretro/beetle-pce-fast-libretro/pull/163

@rtissera whats the test case for the alignment issue? i see this only change lzma and flac, but i cant remember chd issue related to those, at least for pce disks and psx (pcsx). i mainly compressed files with cdlz, nothing else.

rtissera commented 3 years ago

I am on it

Le mar. 3 nov. 2020 à 12:57, negativeExponent notifications@github.com a écrit :

issue is probably similar to this: #163 https://github.com/libretro/beetle-saturn-libretro/issues/163 we need the whole thing from libchdr updated.

@rtissera https://github.com/rtissera whats the test case for the alignment issue? i see this only change lzma and flac, but i cant remember chd issue related to those, at least for pce disks and psx (pcsx). i mainly compressed files with cdlz, nothing else.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libretro/beetle-saturn-libretro/issues/162#issuecomment-721072917, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAW4WBOXZR3QKNQAQORSM6LSN7V3LANCNFSM4K4QXQOQ .

Sanaki commented 3 years ago

Seems it now freezes retroarch. Not sure when that started. (Rewind issue, not related) That aside, I just tested and the US chd of the game does hang in Yabause as well now. Perhaps figuring out when that started could identify what's causing it for both cores.

On a whim, I did try updating to the newest libchdr. No change from that.

ner00 commented 3 years ago

I have not had this issue with RetroARch freezing. So far the only actual issue I had was RA 1.9.1 screwing CG shader support accross the board. The game does get stuck after the boot logo at a black screen with Yabause. On Beetle Saturn it still behaves as before, with the blinking red cursor at boot (make sure to delete Saturn RAM files, otherwise it'll just be stuck like Yabause).

With Kronos it boots fine but performance is terrible. YabaSanshiro boots fine and is the best emulation for this game at the moment (obviously also accounting for proper CHD loading of this particular game).

Sanaki commented 3 years ago

Hmm... the retroarch freeze seems to be another stacked issue. Based on a comment made in the discord server I checked Virtual Hydlide (Japan) (2M) and got a freeze there with chd as well, but that one works in Yabause. I'll identify what I can and open a different issue regarding that.

EDIT: It was rewind being enabled. Please disregard the freeze aspect.