Skip to content

cdfs: fix createdvd CHD hashing for PS2/PSP RetroAchievements#18955

Merged
LibretroAdmin merged 1 commit intolibretro:masterfrom
lazepeda01:fix-createdvd-chd-primary-track
Apr 19, 2026
Merged

cdfs: fix createdvd CHD hashing for PS2/PSP RetroAchievements#18955
LibretroAdmin merged 1 commit intolibretro:masterfrom
lazepeda01:fix-createdvd-chd-primary-track

Conversation

@lazepeda01
Copy link
Copy Markdown
Contributor

Description

PS2 and PSP games stored as createdvd CHDs fail RetroAchievements hash
generation with "hash generation failed", while the same games boot and
play correctly.

createdvd CHDs have no CD track metadata, only a DVD_METADATA_TAG
entry which sets type="DVD" but leaves frames=0. When
chdstream_find_special_track is called with CHDSTREAM_TRACK_PRIMARY,
it evaluates iter.frames > largest_size as 0 > 0 which is false, so
the DVD track is never selected. The function returns false,
chdstream_open returns NULL, and hashing fails.

This is inconsistent as games whose hashing logic happens to request
CHDSTREAM_TRACK_LAST work correctly (that path returns the last found
track regardless of frame count), while games requesting
CHDSTREAM_TRACK_PRIMARY always fail.

The fix returns DVD tracks immediately when CHDSTREAM_TRACK_PRIMARY is
requested, since a createdvd CHD only ever has one track, and it is
always data.

Related Issues

Solves all concerns with #16145, not just related to PSP games

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.
@LibretroAdmin LibretroAdmin merged commit b431965 into libretro:master Apr 19, 2026
20 of 38 checks passed
@lazepeda01 lazepeda01 deleted the fix-createdvd-chd-primary-track branch April 19, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants