Repository navigation
pbp: fix last track length computation (lead-out) - #951
Merged
Merged
Conversation
The last track length is lead-out minus the track INDEX 01 start. handlepbp() used start_offset, which is the INDEX 00 pregap start, so the last track (and the reported lead-out) included the pregap and was two seconds (150 sectors) too long for the usual 2 s pregap. The trackinfo comment says length excludes gaps, and games that check the TOC with GetTD can hang when the lead-out is wrong. With this change GetTD(0) matches the lead-out from the PBP TOC.
Author
|
The uncompressed-block loader patch for the image used in the test: #952. |
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.
handlepbp()computes the last track's length fromstart_offset, which isthe INDEX 00 (pregap) start:
cd_lengthis the lead-out from the PBP TOC (a2), andti[].startis thetrack's INDEX 01.
trackinfo.lengthis documented as "readable sectors,excludes gaps", so the length should be:
As written, the last track includes its 2 s pregap, and
GetTD(0)reports alead-out that is 150 sectors too long.
For example, a multi-track PBP whose TOC lead-out is
30:00:00currentlyreturns
30:02:00fromGetTD(0). Games that sanity-check the TOC can hang:"大富翁之笑笑江湖" (a Chinese bootleg with a fake SLUS-01272 ID) stops on a
black screen right after the intro with the old code, and reaches the title
and character-select screens with this change.
Tested with the libretro core on an RK3566 / Mali-G52;
CAPCOM VS SNKstillboots normally. Build-tested with
make -f Makefile.libretro platform=unix.Note: the image used for the test stores its PBP blocks uncompressed
(PSX2PSP with compression off); loading it additionally needs a small local
loader patch that is not part of this PR. The TOC arithmetic is independent
of that.