hrydgard/ppsspp — pull request #5904 by elsonLee (2014-04-18 10:06:06+00:00)
Title: fix some game don't add stream data when playing atrac3+ problem

This patch is to fix #5882, the origin log trace on PPSSPP v0.9.8-431-g839936d is following:
https://gist.github.com/elsonLee/10633871
When the first part of the music is played, the game doesn't add additional streams to audio engine, it just call ```sceAtracAddStreamData```with ```addtoBytes = 0```. To fix this problem, I wrote a testcase running on real psp machine(Unfortunately JPCSP doesn't work for that audio as well), with the same atrac3+ file extracted from the game iso. log trace is following:
https://gist.github.com/elsonLee/10994911
when the game called ``sceAtracGetStreamDataInfo```, the emulator always return writableBytesAddr equals to readOffsetAddr. That seems ok, it means the audio engine can still receive data now, but the game looks like don't understand (I have no idea about the game logic). But the real psp will update the buffer writable bytes according to the game actions, ie. after decoding a frame, it minus a frame size, after addstreamdata, it just adds that data size. So I wrote this patch just simulate that behaviour, the trace log after fix is following:
https://gist.github.com/elsonLee/11034215
The game will add stream data when he sees it has enough room to feed, and the whole audio is added several times. The whole size transferred is correct, save state is OK, it seems work well.