Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle resetting atrac play position more correctly when adding data #8176

Merged
merged 4 commits into from
Nov 6, 2015

Conversation

unknownbrackets
Copy link
Collaborator

This ensures we instruct the game to put the data in the same places as the PSP would ask it to. Also, these places make sense. High level:

  • For a fully loaded song: tell the game not to add anything. Makes sense.
  • For a partially loaded song (intended to fit entirely in PSP RAM): tell the game to add sequentially to the end of the existing buffer.
  • For a streaming song: tell the game to add the new data to the start of the buffer, with a bit of leading data. This implies to me the decoder needs to "warm" with a few frames. Also give a minimal size to load for decoding.

This also improves validation. Now both tests pass from hrydgard/pspautotests#177.

Additionally, this fixes music looping in Trails in the Sky SC. The reason is that it first seeks to 0, adding data, and then seeks later into the song. Previously, this would corrupt the data stream because it would add the initial bytes incorrectly. I strongly suspect this is the same problem the games in #8147 have.

-[Unknown]

@daniel229
Copy link
Collaborator

Fixed #8147

It allows some negative values, actually.
This matches tests, although the actual delay is more variable.
This attempts to match the sizes and positions requested by the PSP
firmware APIs.  The two functions have to match: if they don't, it will
start reading incorrect data.
hrydgard added a commit that referenced this pull request Nov 6, 2015
Handle resetting atrac play position more correctly when adding data
@hrydgard hrydgard merged commit a581de7 into hrydgard:master Nov 6, 2015
@daniel229
Copy link
Collaborator

Breaks kurohyo 2

27:20:721 sgx-psp-at3- I[ME]: HW\MediaEngine.cpp:87 FF: Invalid start bit!
27:20:721 sgx-psp-at3- E[ME]: HLE\sceAtrac.cpp:444 avcodec_decode_audio4: Error decoding audio -1094995529 / bebbb1b7
27:20:729 sgx-psp-at3- I[ME]: HLE\sceAtrac.cpp:1437 sceAtracReleaseAtracID(0)

@daniel229
Copy link
Collaborator

I can't reproduce the second time,weird.

@unknownbrackets unknownbrackets deleted the atrac-resetting branch November 6, 2015 15:25
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.

3 participants