[GH-ISSUE #3805] Grand Theft Auto Chinatown Wars (ULES01347):- Game crashes at the opening plane sequence since v0.9.1-842-g00f8ae5 (Atrac3+ issue) #1565

Closed
opened 2026-03-18 00:51:49 +03:00 by kerem · 77 comments
Owner

Originally created by @solarmystic on GitHub (Sep 16, 2013).
Original GitHub issue: https://github.com/hrydgard/ppsspp/issues/3805

Issue is as stated in the title.

First singular responsible build/commit found via bisecting is v0.9.1-833-gcf8a3e4 github.com/hrydgard/ppsspp@cf8a3e4df1 which was merged into master with v0.9.1-842-g00f8ae5 github.com/hrydgard/ppsspp@00f8ae5f2d https://github.com/hrydgard/ppsspp/pull/3772

bisect

Last unaffected revision is the one right before the commit was merged into master, v0.9.1-841-g26f935b github.com/hrydgard/ppsspp@26f935bbe5

Problem reproduction:-

  1. Download any 32 or 64 bit build from v0.9.1-842-g00f8ae onwards on the buildbot. (Self compilers can skip straight to the first responsible commit, v0.9.1-833-gcf8a3e4 by using the git reset --hard cf8a3e4df1 command). Make sure you've obtained the at3+ audio plugin and have it enabled in the Audio settings of the emulator.
  2. Start a new game using default settings. If you have any previously created savedata for the game, move it elsewhere temporarily for the purposes of this reproduction.
  3. During the opening white plane sequence that occurs right after the autosave screens, the game will crash, taking down the emulator with it and producing a Windows Error Report.

untitled

Windows Error Report:-

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: PPSSPPWindows64test0833unkat3.exe
  Application Version:  0.0.9.1
  Application Timestamp:    523737bd
  Fault Module Name:    at3plusdecoder64.dll
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp:   51af42d5
  Exception Code:   c0000005
  Exception Offset: 000000000000191a
  OS Version:   6.1.7601.2.1.0.256.48
  Locale ID:    1033
  Additional Information 1: a32a
  Additional Information 2: a32a948565dd0feee1241d919b183e78
  Additional Information 3: d926
  Additional Information 4: d926d33c8a125bedaf5c40a6fc624afa

Stack Trace from affected 64bit debug build:-

bovr
64debugstacktrace

Stack Trace from affected 32bit debug build:-

ue32debug
32debugstacktrace

Logfile from an affected 64bit debug build until it crashes:-
http://www.mediafire.com/download/9g0wbo629ngccuq/ppssppDebug64.7z

Logfile from an affected 32bit debug build until it crashes:-
http://www.mediafire.com/download/623e117assjgycz/ppssppDebug32.7z

Temporary solution:-

Play through that entire section without the atrac3+ plugin enabled. Game will not crash if the plugin is either disabled or missing from your ppsspp directory. Game will lack BGM if you do that though.

Originally created by @solarmystic on GitHub (Sep 16, 2013). Original GitHub issue: https://github.com/hrydgard/ppsspp/issues/3805 Issue is as stated in the title. First singular responsible build/commit found via bisecting is v0.9.1-833-gcf8a3e4 https://github.com/hrydgard/ppsspp/commit/cf8a3e4df1cb8f0b6cd1dec8c23952faf2cf19c9 which was merged into master with v0.9.1-842-g00f8ae5 https://github.com/hrydgard/ppsspp/commit/00f8ae5f2d07e8103c3e0eb838ae93762ce6dbdd https://github.com/hrydgard/ppsspp/pull/3772 ![bisect](https://f.cloud.github.com/assets/4345150/1150849/1190f992-1ef1-11e3-8396-ff6757f5fe89.PNG) Last unaffected revision is the one right before the commit was merged into master, v0.9.1-841-g26f935b https://github.com/hrydgard/ppsspp/commit/26f935bbe58d971831b88a97aec6d48995b65997 Problem reproduction:- 1. Download any 32 or 64 bit build from v0.9.1-842-g00f8ae onwards on the buildbot. (Self compilers can skip straight to the first responsible commit, v0.9.1-833-gcf8a3e4 by using the git reset --hard cf8a3e4df1cb8f0b6cd1dec8c23952faf2cf19c9 command). Make sure you've obtained the at3+ audio plugin and have it enabled in the Audio settings of the emulator. 2. Start a new game using default settings. If you have any previously created savedata for the game, move it elsewhere temporarily for the purposes of this reproduction. 3. During the opening white plane sequence that occurs right after the autosave screens, the game will crash, taking down the emulator with it and producing a Windows Error Report. ![untitled](https://f.cloud.github.com/assets/4345150/1150881/9fa8a6a8-1ef1-11e3-81b4-038ebe943fef.jpg) Windows Error Report:- ``` Problem signature: Problem Event Name: APPCRASH Application Name: PPSSPPWindows64test0833unkat3.exe Application Version: 0.0.9.1 Application Timestamp: 523737bd Fault Module Name: at3plusdecoder64.dll Fault Module Version: 0.0.0.0 Fault Module Timestamp: 51af42d5 Exception Code: c0000005 Exception Offset: 000000000000191a OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: a32a Additional Information 2: a32a948565dd0feee1241d919b183e78 Additional Information 3: d926 Additional Information 4: d926d33c8a125bedaf5c40a6fc624afa ``` Stack Trace from affected 64bit debug build:- ![bovr](https://f.cloud.github.com/assets/4345150/1150981/6ee5f2b2-1ef3-11e3-818d-9e1d0ff47229.PNG) ![64debugstacktrace](https://f.cloud.github.com/assets/4345150/1150978/684fd10c-1ef3-11e3-9bb4-914abf7cec14.PNG) Stack Trace from affected 32bit debug build:- ![ue32debug](https://f.cloud.github.com/assets/4345150/1151032/26f55014-1ef4-11e3-963c-c217894fcebd.PNG) ![32debugstacktrace](https://f.cloud.github.com/assets/4345150/1151029/1f1ab816-1ef4-11e3-9e67-dfac2895b9af.PNG) Logfile from an affected 64bit debug build until it crashes:- http://www.mediafire.com/download/9g0wbo629ngccuq/ppssppDebug64.7z Logfile from an affected 32bit debug build until it crashes:- http://www.mediafire.com/download/623e117assjgycz/ppssppDebug32.7z Temporary solution:- Play through that entire section without the atrac3+ plugin enabled. Game will not crash if the plugin is either disabled or missing from your ppsspp directory. Game will lack BGM if you do that though.
kerem 2026-03-18 00:51:49 +03:00
  • closed this issue
  • added the
    Atrac3+
    label
Author
Owner

@hrydgard commented on GitHub (Sep 16, 2013):

I bet something causes it to try to decode invalid data as atrac3. The plugin is very intolerant to that unfortunately.

<!-- gh-comment-id:24531243 --> @hrydgard commented on GitHub (Sep 16, 2013): I bet something causes it to try to decode invalid data as atrac3. The plugin is very intolerant to that unfortunately.
Author
Owner

@unknownbrackets commented on GitHub (Sep 16, 2013):

As far as I can tell from tests, this function basically asks the question, "where do I need to seek to in the file to start at this sample offset?"

The previous code said "the end." Always. Ys Seven got super confused by this answer, it's well above the range it expected to get. Now it returns the proper offset into the file where that sample starts. This number matches what the PSP outputs for the test files I tried.

I changed a few other things:

  • If the entire file is already loaded into sceAtrac's memory, then the answer is always 0, which I implemented. Again, matches tests.
  • If the sample offset is bogus (higher than the file's samples), an error code should be returned. Again, matches tests.
  • If an invalid / unallocated atrac ID is passed, it shouldn't say "0" for everything, but instead return an error code without touching the memory. Again, matches tests.

It could be another syscall not handling errors properly, leading to bad data passed to this one or other ones in a way the game did not anticipate. Or, maybe for some types of atrac files these outputs are totally different (this is why I hate the atrac/mpeg/sas stuff.) I also noticed that the values of writeable bytes / min write bytes were wrong before (and they're still wrong.) Maybe with the correct file offset, games are now noticing this flaw.

Or it could even just be a bug in this atrac plugin thing.

-[Unknown]

<!-- gh-comment-id:24551329 --> @unknownbrackets commented on GitHub (Sep 16, 2013): As far as I can tell from tests, this function basically asks the question, "where do I need to seek to in the file to start at this sample offset?" The previous code said "the end." Always. Ys Seven got super confused by this answer, it's well above the range it expected to get. Now it returns the proper offset into the file where that sample starts. This number matches what the PSP outputs for the test files I tried. I changed a few other things: - If the entire file is already loaded into sceAtrac's memory, then the answer is always 0, which I implemented. Again, matches tests. - If the sample offset is bogus (higher than the file's samples), an error code should be returned. Again, matches tests. - If an invalid / unallocated atrac ID is passed, it shouldn't say "0" for everything, but instead return an error code without touching the memory. Again, matches tests. It could be another syscall not handling errors properly, leading to bad data passed to this one or other ones in a way the game did not anticipate. Or, maybe for some types of atrac files these outputs are totally different (this is why I hate the atrac/mpeg/sas stuff.) I also noticed that the values of writeable bytes / min write bytes were wrong before (and they're still wrong.) Maybe with the correct file offset, games are now noticing this flaw. Or it could even just be a bug in this atrac plugin thing. -[Unknown]
Author
Owner

@sum2012 commented on GitHub (Sep 17, 2013):

Does ppsspp have a check this as JPCSP ?

protected static final int atracIDMask = 0x000000FF;

public int checkAtracID(int atID) {
            atID &= atracIDMask;

            if (!atracIDs.containsKey(atID)) {
        log.warn(String.format("Unknown atracID=0x%X", atID));
        throw new SceKernelErrorException(SceKernelErrors.ERROR_ATRAC_BAD_ID);
    }

    return atID;
}

@HLEFunction(nid = 0xE23E3A35, version = 150, checkInsideInterrupt = true)
public int sceAtracGetNextDecodePosition(@CheckArgument("checkAtracID") int atID, TPointer32 posAddr) {
<!-- gh-comment-id:24591821 --> @sum2012 commented on GitHub (Sep 17, 2013): Does ppsspp have a check this as JPCSP ? ``` protected static final int atracIDMask = 0x000000FF; public int checkAtracID(int atID) { atID &= atracIDMask; if (!atracIDs.containsKey(atID)) { log.warn(String.format("Unknown atracID=0x%X", atID)); throw new SceKernelErrorException(SceKernelErrors.ERROR_ATRAC_BAD_ID); } return atID; } @HLEFunction(nid = 0xE23E3A35, version = 150, checkInsideInterrupt = true) public int sceAtracGetNextDecodePosition(@CheckArgument("checkAtracID") int atID, TPointer32 posAddr) { ```
Author
Owner

@unknownbrackets commented on GitHub (Sep 17, 2013):

Definitely that mask business is not correct, per the audio/atrac/ids test there are a lot less and they are affected by sceAtracReinit().

sceAtracGetNextDecodePosition() does not return a proper error with a bad id.

-[Unknown]

<!-- gh-comment-id:24592704 --> @unknownbrackets commented on GitHub (Sep 17, 2013): Definitely that mask business is not correct, per the audio/atrac/ids test there are a lot less and they are affected by sceAtracReinit(). sceAtracGetNextDecodePosition() does not return a proper error with a bad id. -[Unknown]
Author
Owner

@dbz400 commented on GitHub (Sep 17, 2013):

Humm GTA seems to be much more easier to reproduce .

<!-- gh-comment-id:24592909 --> @dbz400 commented on GitHub (Sep 17, 2013): Humm GTA seems to be much more easier to reproduce .
Author
Owner

@dbz400 commented on GitHub (Sep 17, 2013):

Alright .Everytime it crashed , sample is 0

<!-- gh-comment-id:24592934 --> @dbz400 commented on GitHub (Sep 17, 2013): Alright .Everytime it crashed , sample is 0
Author
Owner

@dbz400 commented on GitHub (Sep 17, 2013):

This is the log after i change this

    if ((u32)sample + atracSamplesPerFrame > (u32)atrac->endSample || sample == 0) {
        WARN_LOG(ME, "sceAtracGetBufferInfoForResetting(%i, %i, %08x): invalid sample position", atracID, sample, bufferInfoAddr);
        return ATRAC_ERROR_BAD_SAMPLE;
    }

36:30:069 idle0 I[SCEGE]: GLES\Framebuffer.cpp:1248 Decimating FBO for 04000000 (64 x 64 x 0), age 6
36:30:080 mix sound th I[ME]: HLE\sceAtrac.cpp:986 sceAtracReleaseAtracID(0)
36:30:089 mix sound th I[ME]: HLE\sceAtrac.cpp:1292 0=sceAtracSetHalfwayBufferAndGetID(08bfec80, 00001000, 00040000)
36:30:089 mix sound th W[ME]: HLE\sceAtrac.cpp:1173 This is an atrac3+ stereo audio
36:30:089 mix sound th W[ME]: HLE\sceAtrac.cpp:764 sceAtracGetBufferInfoForResetting(0, 0, 09fcf238): invalid sample position
36:30:090 mix sound th I[ME]: HLE\sceAtrac.cpp:992 sceAtracResetPlayPosition(0, 0, 0, 0)
36:30:090 mix sound th I[ME]: HLE\sceAtrac.cpp:1307 sceAtracSetLoopNum(0, -1)
36:30:128 threadmain I[SCEGE]: GLES\Framebuffer.cpp:603 Creating FBO for 04000000 : 64 x 64 x 0
36:30:131 threadmain I[SCEGE]: GLES\Framebuffer.cpp:603 Creating FBO for 04044000 : 64 x 64 x 0
36:42:145 idle0 I[SCEGE]: GLES\Framebuffer.cpp:1275 Destroying FBO for 00178000 : 480 x 272 x 3

<!-- gh-comment-id:24593067 --> @dbz400 commented on GitHub (Sep 17, 2013): This is the log after i change this ``` if ((u32)sample + atracSamplesPerFrame > (u32)atrac->endSample || sample == 0) { WARN_LOG(ME, "sceAtracGetBufferInfoForResetting(%i, %i, %08x): invalid sample position", atracID, sample, bufferInfoAddr); return ATRAC_ERROR_BAD_SAMPLE; } ``` 36:30:069 idle0 I[SCEGE]: GLES\Framebuffer.cpp:1248 Decimating FBO for 04000000 (64 x 64 x 0), age 6 36:30:080 mix sound th I[ME]: HLE\sceAtrac.cpp:986 sceAtracReleaseAtracID(0) 36:30:089 mix sound th I[ME]: HLE\sceAtrac.cpp:1292 0=sceAtracSetHalfwayBufferAndGetID(08bfec80, 00001000, 00040000) 36:30:089 mix sound th W[ME]: HLE\sceAtrac.cpp:1173 This is an atrac3+ stereo audio 36:30:089 mix sound th W[ME]: HLE\sceAtrac.cpp:764 sceAtracGetBufferInfoForResetting(0, 0, 09fcf238): invalid sample position 36:30:090 mix sound th I[ME]: HLE\sceAtrac.cpp:992 sceAtracResetPlayPosition(0, 0, 0, 0) 36:30:090 mix sound th I[ME]: HLE\sceAtrac.cpp:1307 sceAtracSetLoopNum(0, -1) 36:30:128 threadmain I[SCEGE]: GLES\Framebuffer.cpp:603 Creating FBO for 04000000 : 64 x 64 x 0 36:30:131 threadmain I[SCEGE]: GLES\Framebuffer.cpp:603 Creating FBO for 04044000 : 64 x 64 x 0 36:42:145 idle0 I[SCEGE]: GLES\Framebuffer.cpp:1275 Destroying FBO for 00178000 : 480 x 272 x 3
Author
Owner

@unknownbrackets commented on GitHub (Sep 17, 2013):

What is Sampleoffset in that case?

I don't think 0 is an invalid sample offset at all. But maybe getDecodePosBySample() is giving an incorrect number for sample offset 0 in some files.

-[Unknown]

<!-- gh-comment-id:24593150 --> @unknownbrackets commented on GitHub (Sep 17, 2013): What is Sampleoffset in that case? I don't think 0 is an invalid sample offset at all. But maybe getDecodePosBySample() is giving an incorrect number for sample offset 0 in some files. -[Unknown]
Author
Owner

@dbz400 commented on GitHub (Sep 17, 2013):

Sampleoffset is 96

<!-- gh-comment-id:24593520 --> @dbz400 commented on GitHub (Sep 17, 2013): Sampleoffset is 96
Author
Owner

@unknownbrackets commented on GitHub (Sep 17, 2013):

What happens if you force it to 0?

-[Unknown]

<!-- gh-comment-id:24593676 --> @unknownbrackets commented on GitHub (Sep 17, 2013): What happens if you force it to 0? -[Unknown]
Author
Owner

@dbz400 commented on GitHub (Sep 17, 2013):

int Sampleoffset = 0; ?

<!-- gh-comment-id:24593909 --> @dbz400 commented on GitHub (Sep 17, 2013): int Sampleoffset = 0; ?
Author
Owner

@unknownbrackets commented on GitHub (Sep 17, 2013):

Yeah. Maybe when sample is 0, the offset should be 0 also.

-[Unknown]

<!-- gh-comment-id:24594148 --> @unknownbrackets commented on GitHub (Sep 17, 2013): Yeah. Maybe when sample is 0, the offset should be 0 also. -[Unknown]
Author
Owner

@sum2012 commented on GitHub (Sep 17, 2013):

My Stack Trace is difficult
1

<!-- gh-comment-id:24594210 --> @sum2012 commented on GitHub (Sep 17, 2013): My Stack Trace is difficult ![1](https://f.cloud.github.com/assets/2177532/1157848/a3bdbb7c-1fa8-11e3-8a9b-710403dbbd1d.png)
Author
Owner

@dbz400 commented on GitHub (Sep 17, 2013):

Humm still crash

    if (sample == 0)
        Sampleoffset = 0;
<!-- gh-comment-id:24594276 --> @dbz400 commented on GitHub (Sep 17, 2013): Humm still crash ``` if (sample == 0) Sampleoffset = 0; ```
Author
Owner

@sum2012 commented on GitHub (Sep 17, 2013):

I have tried this code.But still crash in release mode.(debug mode no crash)

sceAtrac3plus.cpp
bool Decode(Context context, void* inbuf, int inbytes, int outbytes, void outbuf) {
...
void* buf;
__try {
int ret = frame_decoder(context, inbuf, inbytes, &channels, &buf);
if (ret != 0) {
*outbytes = 0;
return false;
}
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
return false;
}

2

<!-- gh-comment-id:24597138 --> @sum2012 commented on GitHub (Sep 17, 2013): I have tried this code.But still crash in release mode.(debug mode no crash) sceAtrac3plus.cpp bool Decode(Context context, void\* inbuf, int inbytes, int _outbytes, void_ outbuf) { ... void\* buf; __try { int ret = frame_decoder(context, inbuf, inbytes, &channels, &buf); if (ret != 0) { *outbytes = 0; return false; } } __except( EXCEPTION_EXECUTE_HANDLER ) { return false; } ![2](https://f.cloud.github.com/assets/2177532/1158079/5205f20e-1fad-11e3-95b2-182b7a498cb9.png)
Author
Owner

@sum2012 commented on GitHub (Sep 17, 2013):

This is JPCSP trace log of this setting
sceAtracGetNextDecodePosition 0xE23E3A35 2
https://gist.github.com/sum2012/e8634c5443f8b007ba92
Seem PSP do not return error in sceAtracGetNextDecodePosition

<!-- gh-comment-id:24601084 --> @sum2012 commented on GitHub (Sep 17, 2013): This is JPCSP trace log of this setting sceAtracGetNextDecodePosition 0xE23E3A35 2 https://gist.github.com/sum2012/e8634c5443f8b007ba92 Seem PSP do not return error in sceAtracGetNextDecodePosition
Author
Owner

@unknownbrackets commented on GitHub (Sep 18, 2013):

And sceAtracGetBufferInfoForResetting never returns an error either, right? (might need to trace sceAtracGetBufferInfoForReseting also.)

https://code.google.com/p/jpcsp/source/browse/trunk/src/jpcsp/HLE/modules150/sceAtrac3plus.java#556

JPCSP seems to put the same value in writable bytes as in min write bytes, which is definitely not what the PSP actually does. But it also seems to use the sample offset.

AFAICT JPCSP never returns an error either. Does this game work in JPCSP and play music fine? I realize it does not use the plugin thing.

Does it help to set atrac->currentSample = 0 or anything? Maybe it needs to reset the packets it's already sent to the decoder when this function is called, or somewhere else? Maybe it's crashing because of a mix of old packets + new packets after seeking?

-[Unknown]

<!-- gh-comment-id:24634201 --> @unknownbrackets commented on GitHub (Sep 18, 2013): And sceAtracGetBufferInfoForResetting never returns an error either, right? (might need to trace sceAtracGetBufferInfoForReseting also.) https://code.google.com/p/jpcsp/source/browse/trunk/src/jpcsp/HLE/modules150/sceAtrac3plus.java#556 JPCSP seems to put the same value in writable bytes as in min write bytes, which is definitely not what the PSP actually does. But it also seems to use the sample offset. AFAICT JPCSP never returns an error either. Does this game work in JPCSP and play music fine? I realize it does not use the plugin thing. Does it help to set atrac->currentSample = 0 or anything? Maybe it needs to reset the packets it's already sent to the decoder when this function is called, or somewhere else? Maybe it's crashing because of a mix of old packets + new packets after seeking? -[Unknown]
Author
Owner

@dbz400 commented on GitHub (Sep 18, 2013):

I will try this out shortly to set atrac->currentSample = 0

<!-- gh-comment-id:24644422 --> @dbz400 commented on GitHub (Sep 18, 2013): I will try this out shortly to set atrac->currentSample = 0
Author
Owner

@sum2012 commented on GitHub (Sep 18, 2013):

Yes,sceAtracGetBufferInfoForReseting never returns an error in JPCSP trace log.
https://gist.github.com/anonymous/3f0bc7c3ee5130c4ab05
edit:JPCSP play the music fine

<!-- gh-comment-id:24657229 --> @sum2012 commented on GitHub (Sep 18, 2013): Yes,sceAtracGetBufferInfoForReseting never returns an error in JPCSP trace log. https://gist.github.com/anonymous/3f0bc7c3ee5130c4ab05 edit:JPCSP play the music fine
Author
Owner

@dbz400 commented on GitHub (Sep 18, 2013):

@unknownbrackets , tried atrac->currentSample = 0 or atrac->currentSample = sample , also crash .

<!-- gh-comment-id:24658589 --> @dbz400 commented on GitHub (Sep 18, 2013): @unknownbrackets , tried atrac->currentSample = 0 or atrac->currentSample = sample , also crash .
Author
Owner

@solarmystic commented on GitHub (Sep 18, 2013):

This is related to the issue so I'll post it here instead of opening another redundant issue report page.

Apparently Grand Theft Auto: Vice City Stories (ULUS10160) also has the same exact issue as this game, with the same reponsible original commit github.com/hrydgard/ppsspp@cf8a3e4df1

gtavcsat3

I discovered it purely by accident when testing the game for this particular @DanyalZia pull request https://github.com/hrydgard/ppsspp/pull/3822

Problem reproduction:-

Same as GTA Chinatown Stories, start a New Game with the atrac3+ codec enabled in any 32 or 64bit build from v0.9.1-842-g00f8ae5 onwards with default settings, skip through the opening cutscenes and the game will crash, taking down the emulator with it.

Disabling the atrac3+ plugin will mitigate the issue for now.

Stack Trace from 32bit debug build :-

32bitstacktrace

Stack Trace from 64bit debug build :-

64bitstacktrace

Logfile from an affected 64bit debug build:-
http://www.mediafire.com/?w27q4xjn4i6nzdk

Logfile from an affected 32bit debug build:-
http://www.mediafire.com/?dcvg710v3mxz9e1

<!-- gh-comment-id:24659414 --> @solarmystic commented on GitHub (Sep 18, 2013): This is related to the issue so I'll post it here instead of opening another redundant issue report page. Apparently Grand Theft Auto: Vice City Stories (ULUS10160) also has the same exact issue as this game, with the same reponsible original commit https://github.com/hrydgard/ppsspp/commit/cf8a3e4df1cb8f0b6cd1dec8c23952faf2cf19c9 ![gtavcsat3](https://f.cloud.github.com/assets/4345150/1163469/7c3f4d82-203d-11e3-9d8c-6bcc152a890e.jpg) I discovered it purely by accident when testing the game for this particular @DanyalZia pull request https://github.com/hrydgard/ppsspp/pull/3822 Problem reproduction:- Same as GTA Chinatown Stories, start a New Game with the atrac3+ codec enabled in any 32 or 64bit build from v0.9.1-842-g00f8ae5 onwards with default settings, skip through the opening cutscenes and the game will crash, taking down the emulator with it. Disabling the atrac3+ plugin will mitigate the issue for now. Stack Trace from 32bit debug build :- ![32bitstacktrace](https://f.cloud.github.com/assets/4345150/1163607/fcea76b6-2040-11e3-9a8a-f44afc3c9407.PNG) Stack Trace from 64bit debug build :- ![64bitstacktrace](https://f.cloud.github.com/assets/4345150/1163613/16a4b2c4-2041-11e3-9080-90b34674f04a.PNG) Logfile from an affected 64bit debug build:- http://www.mediafire.com/?w27q4xjn4i6nzdk Logfile from an affected 32bit debug build:- http://www.mediafire.com/?dcvg710v3mxz9e1
Author
Owner

@sum2012 commented on GitHub (Sep 18, 2013):

Stack Trace from from 32 bit (of Grand Theft Auto Chinatown Wars ) of at3plusdecoder.dll
3
@raven02 Window 32 bit debug at3plusdecoder.dll
you can test more to debug
https://docs.google.com/file/d/0B3OaSdeV0L8kNnEwaldyQlFOODA/edit?usp=sharing

<!-- gh-comment-id:24659721 --> @sum2012 commented on GitHub (Sep 18, 2013): Stack Trace from from 32 bit (of Grand Theft Auto Chinatown Wars ) of at3plusdecoder.dll ![3](https://f.cloud.github.com/assets/2177532/1164604/d6100b6c-205b-11e3-85fb-20a4b81edab2.png) @raven02 Window 32 bit debug at3plusdecoder.dll you can test more to debug https://docs.google.com/file/d/0B3OaSdeV0L8kNnEwaldyQlFOODA/edit?usp=sharing
Author
Owner

@dbz400 commented on GitHub (Sep 19, 2013):

I'm wondering if Memory::Write_U32(1, outposAddr); helps when invalid ID detected. (I cannot test it right now unfornaturely)

In sceAtracGetNextDecodePosition()

if (!atrac) {
        if (Memory::IsValidAddress(outposAddr))
            Memory::Write_U32(1, outposAddr);
     } else {
<!-- gh-comment-id:24715083 --> @dbz400 commented on GitHub (Sep 19, 2013): I'm wondering if Memory::Write_U32(1, outposAddr); helps when invalid ID detected. (I cannot test it right now unfornaturely) In sceAtracGetNextDecodePosition() ``` if (!atrac) { if (Memory::IsValidAddress(outposAddr)) Memory::Write_U32(1, outposAddr); } else { ```
Author
Owner

@sum2012 commented on GitHub (Sep 19, 2013):

@raven02 no help

<!-- gh-comment-id:24731538 --> @sum2012 commented on GitHub (Sep 19, 2013): @raven02 no help
Author
Owner

@dbz400 commented on GitHub (Sep 19, 2013):

Ooops . Thanks for testing

<!-- gh-comment-id:24731706 --> @dbz400 commented on GitHub (Sep 19, 2013): Ooops . Thanks for testing
Author
Owner

@dbz400 commented on GitHub (Sep 20, 2013):

When crash , i got more detail on the values of Sampleoffset ,sample , minWritebytes

    int Sampleoffset = atrac->getDecodePosBySample(sample);
    int minWritebytes = std::max(Sampleoffset - (int)atrac->first.size, 0);
    INFO_LOG(HLE,"Sampleoffset = %i, sample = %i , minWritebytes = %i", Sampleoffset, sample, minWritebytes);
<!-- gh-comment-id:24784739 --> @dbz400 commented on GitHub (Sep 20, 2013): When crash , i got more detail on the values of Sampleoffset ,sample , minWritebytes ``` int Sampleoffset = atrac->getDecodePosBySample(sample); int minWritebytes = std::max(Sampleoffset - (int)atrac->first.size, 0); INFO_LOG(HLE,"Sampleoffset = %i, sample = %i , minWritebytes = %i", Sampleoffset, sample, minWritebytes); ```
Author
Owner

@dbz400 commented on GitHub (Sep 20, 2013):

14:40:130 I[HLE]: HLE\sceAtrac.cpp:770 Sampleoffset = 29743376, sample = 108776854 , minWritebytes = 29741328
14:40:181 I[HLE]: HLE\sceAtrac.cpp:770 Sampleoffset = 18855296, sample = 68957323 , minWritebytes = 18853248
14:53:949 I[HLE]: HLE\sceAtrac.cpp:770 Sampleoffset = 96, sample = 0 , minWritebytes = 0

<!-- gh-comment-id:24784792 --> @dbz400 commented on GitHub (Sep 20, 2013): 14:40:130 I[HLE]: HLE\sceAtrac.cpp:770 Sampleoffset = 29743376, sample = 108776854 , minWritebytes = 29741328 14:40:181 I[HLE]: HLE\sceAtrac.cpp:770 Sampleoffset = 18855296, sample = 68957323 , minWritebytes = 18853248 14:53:949 I[HLE]: HLE\sceAtrac.cpp:770 Sampleoffset = 96, sample = 0 , minWritebytes = 0
Author
Owner

@unknownbrackets commented on GitHub (Sep 20, 2013):

Hmm, I think that value of minWritebytes is crazy.

What is atrac->first.writableBytes in this case?

I'm not really sure I understand these values, but it sounds like it's running against a very long atrac3+ file with a relatively small buffer, so that's probably what we should test against.

-[Unknown]

<!-- gh-comment-id:24785111 --> @unknownbrackets commented on GitHub (Sep 20, 2013): Hmm, I think that value of minWritebytes is crazy. What is atrac->first.writableBytes in this case? I'm not really sure I understand these values, but it sounds like it's running against a very long atrac3+ file with a relatively small buffer, so that's probably what we should test against. -[Unknown]
Author
Owner

@dbz400 commented on GitHub (Sep 20, 2013):

This is the values before crash

33:32:950 mix sound th W[ME]: HLE\sceAtrac.cpp:1174 This is an atrac3+ stereo audio
33:32:950 mix sound th I[HLE]: HLE\sceAtrac.cpp:772 atrac->first.filesize = 845976 , atrac->first.size = 4096, atrac->atracBufSize = 262144, atrac->first.writableBytes = 262144

<!-- gh-comment-id:24785331 --> @dbz400 commented on GitHub (Sep 20, 2013): This is the values before crash 33:32:950 mix sound th W[ME]: HLE\sceAtrac.cpp:1174 This is an atrac3+ stereo audio 33:32:950 mix sound th I[HLE]: HLE\sceAtrac.cpp:772 atrac->first.filesize = 845976 , atrac->first.size = 4096, atrac->atracBufSize = 262144, atrac->first.writableBytes = 262144
Author
Owner

@dbz400 commented on GitHub (Sep 20, 2013):

I just tried to revert this line and seems to be it crashes on this line previously

from

          bufferInfo->first.filePos = atrac->first.fileoffset;

to

          bufferInfo->first.filePos = Sampleoffset;
<!-- gh-comment-id:24786040 --> @dbz400 commented on GitHub (Sep 20, 2013): I just tried to revert this line and seems to be it crashes on this line previously from ``` bufferInfo->first.filePos = atrac->first.fileoffset; ``` to ``` bufferInfo->first.filePos = Sampleoffset; ```
Author
Owner

@dbz400 commented on GitHub (Sep 20, 2013):

Therefore , we are passing 96 to bufferInfo->first.filePos now while previously we are passing 4096 to bufferInfo->first.filePos.

bufferInfo->first.filePos = atrac->first.fileoffset;
INFO_LOG(HLE,"atrac->first.fileoffset = %i , Sampleoffset = %i", atrac->first.fileoffset , Sampleoffset);

     00:58:798 mix sound th I[HLE]: HLE\sceAtrac.cpp:786 atrac->first.fileoffset = 4096 , Sampleoffset = 96
<!-- gh-comment-id:24786161 --> @dbz400 commented on GitHub (Sep 20, 2013): Therefore , we are passing 96 to bufferInfo->first.filePos now while previously we are passing 4096 to bufferInfo->first.filePos. bufferInfo->first.filePos = atrac->first.fileoffset; INFO_LOG(HLE,"atrac->first.fileoffset = %i , Sampleoffset = %i", atrac->first.fileoffset , Sampleoffset); ``` 00:58:798 mix sound th I[HLE]: HLE\sceAtrac.cpp:786 atrac->first.fileoffset = 4096 , Sampleoffset = 96 ```
Author
Owner

@unknownbrackets commented on GitHub (Sep 20, 2013):

Well, atrac->first.fileoffset is for sure wrong, at least in the common cases I tested. Just to clarify, are you saying that 4096 also crashes, or does not crash?

-[Unknown]

<!-- gh-comment-id:24787564 --> @unknownbrackets commented on GitHub (Sep 20, 2013): Well, `atrac->first.fileoffset` is for sure wrong, at least in the common cases I tested. Just to clarify, are you saying that 4096 also crashes, or does not crash? -[Unknown]
Author
Owner

@dbz400 commented on GitHub (Sep 20, 2013):

4096 doeesn't crash . I also think bufferInfo->first.filePos = atrac->first.fileoffset; is wrong.

<!-- gh-comment-id:24787599 --> @dbz400 commented on GitHub (Sep 20, 2013): 4096 doeesn't crash . I also think bufferInfo->first.filePos = atrac->first.fileoffset; is wrong.
Author
Owner

@solarmystic commented on GitHub (Sep 22, 2013):

Apparently Class of Heroes also has the exact same issue, according to mr.chya from the ppsspp forums, which I verified by asking him to do some further testing.

http://forums.ppsspp.org/showthread.php?tid=419&pid=49712#pid49712

http://forums.ppsspp.org/showthread.php?tid=419&pid=49782#pid49782

Logfile courtesy of mr.chya from the forums:-
http://forums.ppsspp.org/attachment.php?aid=8640

<!-- gh-comment-id:24879071 --> @solarmystic commented on GitHub (Sep 22, 2013): Apparently Class of Heroes also has the exact same issue, according to mr.chya from the ppsspp forums, which I verified by asking him to do some further testing. http://forums.ppsspp.org/showthread.php?tid=419&pid=49712#pid49712 http://forums.ppsspp.org/showthread.php?tid=419&pid=49782#pid49782 Logfile courtesy of mr.chya from the forums:- http://forums.ppsspp.org/attachment.php?aid=8640
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

For this issue .I'm wondering if we can use a workaround with comment here at least temporarily avoid this issue as there are few games already affected by this bug .

    // Workaround when sample <=0 for issue #3805
    if (sample <=0) {
        WARN_LOG(ME, "sceAtracGetBufferInfoForResetting(%i, %i, %08x): bad sample ", atracID, sample, bufferInfoAddr);
        return ATRAC_ERROR_BAD_SAMPLE;
    }
<!-- gh-comment-id:24973080 --> @dbz400 commented on GitHub (Sep 24, 2013): For this issue .I'm wondering if we can use a workaround with comment here at least temporarily avoid this issue as there are few games already affected by this bug . ``` // Workaround when sample <=0 for issue #3805 if (sample <=0) { WARN_LOG(ME, "sceAtracGetBufferInfoForResetting(%i, %i, %08x): bad sample ", atracID, sample, bufferInfoAddr); return ATRAC_ERROR_BAD_SAMPLE; } ```
Author
Owner

@unknownbrackets commented on GitHub (Sep 24, 2013):

Wait, is sample negative? It's 0, right?

I expect other games to use sample=0 in very normal ways and probably wig out if it returns an error and fails to update the buffer properly.

-[Unknown]

<!-- gh-comment-id:24977171 --> @unknownbrackets commented on GitHub (Sep 24, 2013): Wait, is sample negative? It's 0, right? I expect other games to use sample=0 in very normal ways and probably wig out if it returns an error and fails to update the buffer properly. -[Unknown]
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

Should be 0 .I just put < in case there is sample indeed return negative though i'm not sure any games will do .

<!-- gh-comment-id:24977379 --> @dbz400 commented on GitHub (Sep 24, 2013): Should be 0 .I just put < in case there is sample indeed return negative though i'm not sure any games will do .
Author
Owner

@unknownbrackets commented on GitHub (Sep 24, 2013):

Well, for example in the audio/atrac/reseting test (which you can run in ppsspp without even a psp):

O 1: write=p+0x0, writable=00005a84, min=00000000, file=00000060
E 1: write=p+0x0, writable=00005998, min=000002f0, file=00000060

So, in that case, it's expecting minWriteBytes to be 0x2f0, and writable is off by a bit (too high by 0xEC.) I'm not sure why. But it does use 0x60 (96) for 0. What happens if you use minWriteBytes = 0x2f0? There's probably more to it, but I don't have the game to reproduce the crash...

-[Unknown]

<!-- gh-comment-id:24982555 --> @unknownbrackets commented on GitHub (Sep 24, 2013): Well, for example in the audio/atrac/reseting test (which you can run in ppsspp without even a psp): O 1: write=p+0x0, writable=00005a84, min=00000000, file=00000060 E 1: write=p+0x0, writable=00005998, min=000002f0, file=00000060 So, in that case, it's expecting minWriteBytes to be 0x2f0, and writable is off by a bit (too high by 0xEC.) I'm not sure why. But it does use 0x60 (96) for 0. What happens if you use minWriteBytes = 0x2f0? There's probably more to it, but I don't have the game to reproduce the crash... -[Unknown]
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

Humm do you mean simply change the following to see if it still crash ?

 int minWritebytes = std::max(Sampleoffset - (int)atrac->first.size, 0);

to

   int minWritebytes = 0x2f0;
<!-- gh-comment-id:24983292 --> @dbz400 commented on GitHub (Sep 24, 2013): Humm do you mean simply change the following to see if it still crash ? ``` int minWritebytes = std::max(Sampleoffset - (int)atrac->first.size, 0); ``` to ``` int minWritebytes = 0x2f0; ```
Author
Owner

@unknownbrackets commented on GitHub (Sep 24, 2013):

Yes. Just want to see what variables might be involved.

-[Unknown]

<!-- gh-comment-id:24983352 --> @unknownbrackets commented on GitHub (Sep 24, 2013): Yes. Just want to see what variables might be involved. -[Unknown]
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

Alright .I will test it soon .

<!-- gh-comment-id:24983394 --> @dbz400 commented on GitHub (Sep 24, 2013): Alright .I will test it soon .
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

I don't have the testing env this moment .However , if 0x2f0 didn't crash , that's mean
Sampleoffset - (int)atrac->first.size return negtaive value then .

14:53:949 I[HLE]: HLE\sceAtrac.cpp:770 Sampleoffset = 96, sample = 0 , minWritebytes = 0

<!-- gh-comment-id:24983680 --> @dbz400 commented on GitHub (Sep 24, 2013): I don't have the testing env this moment .However , if 0x2f0 didn't crash , that's mean Sampleoffset - (int)atrac->first.size return negtaive value then . 14:53:949 I[HLE]: HLE\sceAtrac.cpp:770 Sampleoffset = 96, sample = 0 , minWritebytes = 0
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

0X2f0 is 752 . If (int)atrac->first.size = 848 then make sense (assume it is (int)atrac->first.size - Sampleoffset) = 848(atrac->first.size) - 96(SampleOffset) = 752(minWritebytes)

<!-- gh-comment-id:24984410 --> @dbz400 commented on GitHub (Sep 24, 2013): 0X2f0 is 752 . If (int)atrac->first.size = 848 then make sense (assume it is (int)atrac->first.size - Sampleoffset) = 848(atrac->first.size) - 96(SampleOffset) = 752(minWritebytes)
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

Humm no luck .Tried minWritebytes = 0x2f0 , still crash

<!-- gh-comment-id:24992725 --> @dbz400 commented on GitHub (Sep 24, 2013): Humm no luck .Tried minWritebytes = 0x2f0 , still crash
Author
Owner

@sum2012 commented on GitHub (Sep 24, 2013):

@raven02 I try your hack code but don't work ?

      if (sample <=0) {
    WARN_LOG(ME, "sceAtracGetBufferInfoForResetting(%i, %i, %08x): bad sample ", atracID, sample, bufferInfoAddr);
    return ATRAC_ERROR_BAD_SAMPLE;
<!-- gh-comment-id:24998090 --> @sum2012 commented on GitHub (Sep 24, 2013): @raven02 I try your hack code but don't work ? ``` if (sample <=0) { WARN_LOG(ME, "sceAtracGetBufferInfoForResetting(%i, %i, %08x): bad sample ", atracID, sample, bufferInfoAddr); return ATRAC_ERROR_BAD_SAMPLE; ```
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

Humm it should work .Let me try again .

<!-- gh-comment-id:24998625 --> @dbz400 commented on GitHub (Sep 24, 2013): Humm it should work .Let me try again .
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

Just tried .It is okay and no crash.

<!-- gh-comment-id:24998802 --> @dbz400 commented on GitHub (Sep 24, 2013): Just tried .It is okay and no crash.
Author
Owner

@sum2012 commented on GitHub (Sep 24, 2013):

@raven02
Copy your code inside
u32 sceAtracGetBufferInfoForResetting(int atracID, int sample, u32 bufferInfoAddr) ?

<!-- gh-comment-id:24999086 --> @sum2012 commented on GitHub (Sep 24, 2013): @raven02 Copy your code inside u32 sceAtracGetBufferInfoForResetting(int atracID, int sample, u32 bufferInfoAddr) ?
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

Yes, right after

    if ((u32)sample + atracSamplesPerFrame > (u32)atrac->endSample) {
        WARN_LOG(ME, "sceAtracGetBufferInfoForResetting(%i, %i, %08x): invalid sample position", atracID, sample, bufferInfoAddr);
        return ATRAC_ERROR_BAD_SAMPLE;
    }
<!-- gh-comment-id:24999420 --> @dbz400 commented on GitHub (Sep 24, 2013): Yes, right after ``` if ((u32)sample + atracSamplesPerFrame > (u32)atrac->endSample) { WARN_LOG(ME, "sceAtracGetBufferInfoForResetting(%i, %i, %08x): invalid sample position", atracID, sample, bufferInfoAddr); return ATRAC_ERROR_BAD_SAMPLE; } ```
Author
Owner

@sum2012 commented on GitHub (Sep 24, 2013):

Not sure don't work ...
Maybe I am using Win32 build and you are using Win 64 build ?

<!-- gh-comment-id:24999791 --> @sum2012 commented on GitHub (Sep 24, 2013): Not sure don't work ... Maybe I am using Win32 build and you are using Win 64 build ?
Author
Owner

@sum2012 commented on GitHub (Sep 24, 2013):

@raven02
I just another try.Can you try this code hack work or not ? (I work)
if (inbytes > 0 && inbytes == atrac->atracBytesPerFrame) change to
if (inbytes > 0 && inbytes == atrac->atracBytesPerFrame && SamplesNum < finish) {

<!-- gh-comment-id:24999927 --> @sum2012 commented on GitHub (Sep 24, 2013): @raven02 I just another try.Can you try this code hack work or not ? (I work) if (inbytes > 0 && inbytes == atrac->atracBytesPerFrame) change to if (inbytes > 0 && inbytes == atrac->atracBytesPerFrame && SamplesNum < finish) {
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

I'm using 32bit build as well .Will try your code.

<!-- gh-comment-id:25000145 --> @dbz400 commented on GitHub (Sep 24, 2013): I'm using 32bit build as well .Will try your code.
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

It works well and no crash . @unknownbrackets , what do you think ?

<!-- gh-comment-id:25000206 --> @dbz400 commented on GitHub (Sep 24, 2013): It works well and no crash . @unknownbrackets , what do you think ?
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

The following one seems to be the function called to crash

Atrac3plus_Decoder::Decode(atrac->decoder_context, atrac->data_buf + atrac->decodePos, inbytes, &decodebytes, buf);

int ret = frame_decoder(context, inbuf, inbytes, &channels, &buf);

<!-- gh-comment-id:25000291 --> @dbz400 commented on GitHub (Sep 24, 2013): The following one seems to be the function called to crash Atrac3plus_Decoder::Decode(atrac->decoder_context, atrac->data_buf + atrac->decodePos, inbytes, &decodebytes, buf); int ret = frame_decoder(context, inbuf, inbytes, &channels, &buf);
Author
Owner

@dbz400 commented on GitHub (Sep 24, 2013):

@sum2012 , i think it just somehow skipped the decoding at all as there should be conversation among those soliders as well as background music.

<!-- gh-comment-id:25000606 --> @dbz400 commented on GitHub (Sep 24, 2013): @sum2012 , i think it just somehow skipped the decoding at all as there should be conversation among those soliders as well as background music.
Author
Owner

@sum2012 commented on GitHub (Sep 24, 2013):

@raven02 So that I call this one is a hack code.

<!-- gh-comment-id:25001488 --> @sum2012 commented on GitHub (Sep 24, 2013): @raven02 So that I call this one is a hack code.
Author
Owner

@unknownbrackets commented on GitHub (Sep 25, 2013):

Does it work fine in JPCSP still? I noticed some of the results from the tests I did were implemented in JPCSP:

http://code.google.com/p/jpcsp/source/detail?r=3392
(again I realize it uses a different decoder...)

-[Unknown]

<!-- gh-comment-id:25063575 --> @unknownbrackets commented on GitHub (Sep 25, 2013): Does it work fine in JPCSP still? I noticed some of the results from the tests I did were implemented in JPCSP: http://code.google.com/p/jpcsp/source/detail?r=3392 (again I realize it uses a different decoder...) -[Unknown]
Author
Owner

@dbz400 commented on GitHub (Sep 25, 2013):

Yep, JPCSP seems to be changed the logic for BufferInfoForResetting. Trying to figure out hw to translate them to here

           // Assuming "atracBytesPerFrame" bytes in the input file for each "maxSamples" samples.
            int inputFileSampleOffset = inputBuffer.isFileEnd() ? 0 : inputFileDataOffset + sample / maxSamples * atracBytesPerFrame;
            int resetWritableBytes = inputBuffer.isFileEnd() ? 0 : inputBuffer.getMaxSize();
            int resetNeededBytes = inputBuffer.isFileEnd() ? 0 : atracBytesPerFrame * 2;
<!-- gh-comment-id:25066100 --> @dbz400 commented on GitHub (Sep 25, 2013): Yep, JPCSP seems to be changed the logic for BufferInfoForResetting. Trying to figure out hw to translate them to here ``` // Assuming "atracBytesPerFrame" bytes in the input file for each "maxSamples" samples. int inputFileSampleOffset = inputBuffer.isFileEnd() ? 0 : inputFileDataOffset + sample / maxSamples * atracBytesPerFrame; int resetWritableBytes = inputBuffer.isFileEnd() ? 0 : inputBuffer.getMaxSize(); int resetNeededBytes = inputBuffer.isFileEnd() ? 0 : atracBytesPerFrame * 2; ```
Author
Owner

@unknownbrackets commented on GitHub (Sep 28, 2013):

Seems to be affecting Tales of the World Radiant Mythology 3 as well, most likely.

http://forums.ppsspp.org/showthread.php?tid=1807&pid=50652#pid50652

-[Unknown]

<!-- gh-comment-id:25306367 --> @unknownbrackets commented on GitHub (Sep 28, 2013): Seems to be affecting Tales of the World Radiant Mythology 3 as well, most likely. http://forums.ppsspp.org/showthread.php?tid=1807&pid=50652#pid50652 -[Unknown]
Author
Owner

@sum2012 commented on GitHub (Sep 28, 2013):

I think that should fix\work arround this before major release

<!-- gh-comment-id:25309181 --> @sum2012 commented on GitHub (Sep 28, 2013): I think that should fix\work arround this before major release
Author
Owner

@dbz400 commented on GitHub (Oct 9, 2013):

I think it would be good to know if the new atrac3+ ffmpeg implementation did same crash here.

<!-- gh-comment-id:25949358 --> @dbz400 commented on GitHub (Oct 9, 2013): I think it would be good to know if the new atrac3+ ffmpeg implementation did same crash here.
Author
Owner

@solarmystic commented on GitHub (Oct 17, 2013):

This issue should be labelled with the atrac3+ label.

<!-- gh-comment-id:26543517 --> @solarmystic commented on GitHub (Oct 17, 2013): This issue should be labelled with the atrac3+ label.
Author
Owner

@solarmystic commented on GitHub (Oct 19, 2013):

This game no longer crashes upon starting a New Game after https://github.com/hrydgard/ppsspp/pull/4221 was merged into master.

However, it cannot be considered fixed yet, as the BGM just stops playing instead at that segment instead of crashing, so a bug is still present.

Notably, the crash related to atrac3+ when loading a savegame in GTA Vice City Stories https://github.com/hrydgard/ppsspp/issues/3805#issuecomment-24659414 also no longer occurs after the maxim stuff got merged to master as well, consider that one fixed.

<!-- gh-comment-id:26659765 --> @solarmystic commented on GitHub (Oct 19, 2013): This game no longer crashes upon starting a New Game after https://github.com/hrydgard/ppsspp/pull/4221 was merged into master. However, it cannot be considered fixed yet, as the BGM just stops playing instead at that segment instead of crashing, so a bug is still present. Notably, the crash related to atrac3+ when loading a savegame in GTA Vice City Stories https://github.com/hrydgard/ppsspp/issues/3805#issuecomment-24659414 also no longer occurs after the maxim stuff got merged to master as well, consider that one fixed.
Author
Owner

@solarmystic commented on GitHub (Oct 19, 2013):

Logfile is also spamming these lines repeatedly too:

48:08:716 mix sound th I[ME]: HW\MediaEngine.cpp:108 FF: GHA amplitude mode 0
48:08:716 mix sound th I[ME]: HW\MediaEngine.cpp:108 FF:  is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
48:08:716 mix sound th E[ME]: HLE\sceAtrac.cpp:605 avcodec_decode_audio4: Error decoding audio -1163346256
48:08:716 mix sound th E[ME]: HLE\sceAtrac.cpp:793 UNIMPL sceAtracGetInternalErrorInfo(0, 09fcf274)
48:08:716 mix sound th I[ME]: HLE\sceAtrac.cpp:929 sceAtracReleaseAtracID(0)
48:08:816 mix sound th I[ME]: HLE\sceAtrac.cpp:1233 0=sceAtracSetHalfwayBufferAndGetID(08bfec80, 00001000, 00040000)
48:08:816 mix sound th W[ME]: HLE\sceAtrac.cpp:1114 This is an atrac3+ stereo audio
48:08:817 mix sound th I[ME]: HLE\sceAtrac.cpp:735 0=sceAtracGetBufferInfoForResetting(0, 0, 09fcf238)
48:08:848 mix sound th I[ME]: HLE\sceAtrac.cpp:935 sceAtracResetPlayPosition(0, 0, 262144, 0)
48:08:849 mix sound th I[ME]: HLE\sceAtrac.cpp:1248 sceAtracSetLoopNum(0, -1)
<!-- gh-comment-id:26660662 --> @solarmystic commented on GitHub (Oct 19, 2013): Logfile is also spamming these lines repeatedly too: ``` 48:08:716 mix sound th I[ME]: HW\MediaEngine.cpp:108 FF: GHA amplitude mode 0 48:08:716 mix sound th I[ME]: HW\MediaEngine.cpp:108 FF: is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented. 48:08:716 mix sound th E[ME]: HLE\sceAtrac.cpp:605 avcodec_decode_audio4: Error decoding audio -1163346256 48:08:716 mix sound th E[ME]: HLE\sceAtrac.cpp:793 UNIMPL sceAtracGetInternalErrorInfo(0, 09fcf274) 48:08:716 mix sound th I[ME]: HLE\sceAtrac.cpp:929 sceAtracReleaseAtracID(0) 48:08:816 mix sound th I[ME]: HLE\sceAtrac.cpp:1233 0=sceAtracSetHalfwayBufferAndGetID(08bfec80, 00001000, 00040000) 48:08:816 mix sound th W[ME]: HLE\sceAtrac.cpp:1114 This is an atrac3+ stereo audio 48:08:817 mix sound th I[ME]: HLE\sceAtrac.cpp:735 0=sceAtracGetBufferInfoForResetting(0, 0, 09fcf238) 48:08:848 mix sound th I[ME]: HLE\sceAtrac.cpp:935 sceAtracResetPlayPosition(0, 0, 262144, 0) 48:08:849 mix sound th I[ME]: HLE\sceAtrac.cpp:1248 sceAtracSetLoopNum(0, -1) ```
Author
Owner

@hrydgard commented on GitHub (Oct 19, 2013):

probably another case of the game playing junk data, confusing instead of crashing the new Atrac3+ code.

<!-- gh-comment-id:26660778 --> @hrydgard commented on GitHub (Oct 19, 2013): probably another case of the game playing junk data, confusing instead of crashing the new Atrac3+ code.
Author
Owner

@solarmystic commented on GitHub (Nov 12, 2013):

Finally properly fixed with https://github.com/hrydgard/ppsspp/pull/4483 with the github.com/hrydgard/ppsspp@225f8efbb9 commit provided by @papel

The game no longer crashes at the aforementioned spot, and the BGM doesn't cut off either, it continues to play throughout the entire sequence.

https://github.com/hrydgard/ppsspp/issues/3805#issuecomment-24659414 in GTA VCS is also properly fixed, with game now playing the appropriate dialogue during that opening scene, with no crashes.

Big thanks to @papel for the responsible commit that fixed it.

Closed.

<!-- gh-comment-id:28290765 --> @solarmystic commented on GitHub (Nov 12, 2013): Finally properly fixed with https://github.com/hrydgard/ppsspp/pull/4483 with the https://github.com/hrydgard/ppsspp/commit/225f8efbb9e8c4209723b9ce50b114c263a54403 commit provided by @papel The game no longer crashes at the aforementioned spot, and the BGM doesn't cut off either, it continues to play throughout the entire sequence. https://github.com/hrydgard/ppsspp/issues/3805#issuecomment-24659414 in GTA VCS is also properly fixed, with game now playing the appropriate dialogue during that opening scene, with no crashes. Big thanks to @papel for the responsible commit that fixed it. Closed.
Author
Owner

@sum2012 commented on GitHub (Nov 12, 2013):

It is a good news :)

<!-- gh-comment-id:28291064 --> @sum2012 commented on GitHub (Nov 12, 2013): It is a good news :)
Author
Owner

@unknownbrackets commented on GitHub (Nov 12, 2013):

Just to say, I'm pretty certain I can create a test that shows this is not "properly" fixed. It may be fine for now, but that doesn't mean it's what the PSP does, but I don't like things that aren't at all what the PSP does being called "proper." The only proper fix is to make it work the way the PSP observably does. An unknown quantity (possibly zero, probably less than before) of games could depend on correct behavior.

-[Unknown]

<!-- gh-comment-id:28303871 --> @unknownbrackets commented on GitHub (Nov 12, 2013): Just to say, I'm pretty certain I can create a test that shows this is not "properly" fixed. It may be fine for now, but that doesn't mean it's what the PSP does, but I don't like things that aren't at all what the PSP does being called "proper." The only proper fix is to make it work the way the PSP observably does. An unknown quantity (possibly zero, probably less than before) of games could depend on correct behavior. -[Unknown]
Author
Owner

@hrydgard commented on GitHub (Nov 12, 2013):

Agree, but was the previous behaviour matching the PSP in all cases? If not we are choosing between two hacks, and if we're at that stage, might as well choose the one that fixes the most games. Ideally of course we should match the PSP's behaviour, we need a better testsuite.

<!-- gh-comment-id:28304970 --> @hrydgard commented on GitHub (Nov 12, 2013): Agree, but was the previous behaviour matching the PSP in all cases? If not we are choosing between two hacks, and if we're at that stage, might as well choose the one that fixes the most games. Ideally of course we should match the PSP's behaviour, we need a better testsuite.
Author
Owner

@unknownbrackets commented on GitHub (Nov 12, 2013):

Again, I'm just saying it's not a "proper" fix. It may be a "good hack."

-[Unknown]

<!-- gh-comment-id:28305542 --> @unknownbrackets commented on GitHub (Nov 12, 2013): Again, I'm just saying it's not a "proper" fix. It may be a "good hack." -[Unknown]
Author
Owner

@hrydgard commented on GitHub (Nov 12, 2013):

Right, yeah.

<!-- gh-comment-id:28305688 --> @hrydgard commented on GitHub (Nov 12, 2013): Right, yeah.
Author
Owner

@ydamigos commented on GitHub (Nov 12, 2013):

@unknownbrackets and @hrydgard if you own a PSP which is the best tool to examine PSP's behaviour? pspautotests, jpcsptrace?

<!-- gh-comment-id:28306551 --> @ydamigos commented on GitHub (Nov 12, 2013): @unknownbrackets and @hrydgard if you own a PSP which is the best tool to examine PSP's behaviour? pspautotests, jpcsptrace?
Author
Owner

@unknownbrackets commented on GitHub (Nov 12, 2013):

The combination of the two. However, pspautotests is probably better for testing how something should work. JpcspTrace is better for seeing how it's being used.

-[Unknown]

<!-- gh-comment-id:28306850 --> @unknownbrackets commented on GitHub (Nov 12, 2013): The combination of the two. However, pspautotests is probably better for testing how something should work. JpcspTrace is better for seeing how it's being used. -[Unknown]
Author
Owner

@ydamigos commented on GitHub (Nov 12, 2013):

I'll give it a try to find out how sceAtracGetBufferInfoForResetting should work. First thing to find documentation of these tools.

<!-- gh-comment-id:28307180 --> @ydamigos commented on GitHub (Nov 12, 2013): I'll give it a try to find out how sceAtracGetBufferInfoForResetting should work. First thing to find documentation of these tools.
Author
Owner
<!-- gh-comment-id:28307547 --> @unknownbrackets commented on GitHub (Nov 12, 2013): http://forums.ppsspp.org/showthread.php?tid=2822&pid=56026#pid56026 https://github.com/hrydgard/pspautotests#readme https://github.com/hrydgard/pspautotests/blob/master/tests/audio/atrac/resetting.expected -[Unknown]
Author
Owner

@ydamigos commented on GitHub (Nov 12, 2013):

@unknownbrackets thank you!!!

<!-- gh-comment-id:28310745 --> @ydamigos commented on GitHub (Nov 12, 2013): @unknownbrackets thank you!!!
Author
Owner

@solarmystic commented on GitHub (Nov 12, 2013):

Sorry for the improper use of "proper", I should've clarified what I meant.

What I meant by "proper" was that the game just exhibits the correct behaviour since the commit instead of being muted like before, not that the fix itself is "proper".

<!-- gh-comment-id:28329132 --> @solarmystic commented on GitHub (Nov 12, 2013): Sorry for the improper use of "proper", I should've clarified what I meant. What I meant by "proper" was that the game just exhibits the correct behaviour since the commit instead of being muted like before, not that the fix itself is "proper".
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ppsspp#1565
No description provided.