cdfs: fix createdvd CHD hashing for PS2/PSP RetroAchievements#18955
Merged
LibretroAdmin merged 1 commit intolibretro:masterfrom Apr 19, 2026
Merged
Conversation
DVD-format CHDs created with `chdman createdvd` have no CD track metadata. The DVD metadata tag sets track type to "DVD" but leaves frames=0, causing chdstream_find_special_track to skip the track when selecting CHDSTREAM_TRACK_PRIMARY since 0 > 0 is false. Fix by immediately returning DVD tracks as the primary data track, since a createdvd CHD only ever has one track and it is always data. Fixes hash generation failed for PS2/PSP games stored as createdvd CHDs when using RetroAchievements. Closes libretro#16145.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PS2 and PSP games stored as
createdvdCHDs fail RetroAchievements hashgeneration with "hash generation failed", while the same games boot and
play correctly.
createdvdCHDs have no CD track metadata, only aDVD_METADATA_TAGentry which sets
type="DVD"but leavesframes=0. Whenchdstream_find_special_trackis called withCHDSTREAM_TRACK_PRIMARY,it evaluates
iter.frames > largest_sizeas0 > 0which is false, sothe DVD track is never selected. The function returns false,
chdstream_openreturns NULL, and hashing fails.This is inconsistent as games whose hashing logic happens to request
CHDSTREAM_TRACK_LASTwork correctly (that path returns the last foundtrack regardless of frame count), while games requesting
CHDSTREAM_TRACK_PRIMARYalways fail.The fix returns DVD tracks immediately when
CHDSTREAM_TRACK_PRIMARYisrequested, since a
createdvdCHD only ever has one track, and it isalways data.
Related Issues
Solves all concerns with #16145, not just related to PSP games