mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
sceAtrac: Crashfix in sas integration
This commit is contained in:
parent
6d69dfa45d
commit
2fb10fb5d9
1 changed files with 7 additions and 6 deletions
|
@ -1092,17 +1092,18 @@ u32 AtracSasDecodeData(int atracID, u8* outbuf, u32 outbufPtr, u32 *SamplesNum,
|
|||
// Ugly hack, but needed to support both old and new contexts.
|
||||
int AtracSasGetIDByContext(u32 contextAddr) {
|
||||
int atracID = (int)Memory::Read_U32(contextAddr + 0xfc);
|
||||
if (atracID < PSP_MAX_ATRAC_IDS && atracContexts[atracID]->GetContextVersion() == 1) {
|
||||
if (atracID < PSP_MAX_ATRAC_IDS && atracContexts[atracID] && atracContexts[atracID]->GetContextVersion() == 1) {
|
||||
// We can assume the old atracID hack was used, and atracID is valid.
|
||||
} else {
|
||||
// Let's just loop around the contexts and find it.
|
||||
atracID = -1;
|
||||
for (int i = 0; i < PSP_MAX_ATRAC_IDS; i++) {
|
||||
if (atracContexts[i]) {
|
||||
if (atracContexts[i]->GetContextVersion() == 2 && atracContexts[i]->context_.Equals(contextAddr)) {
|
||||
atracID = i;
|
||||
break;
|
||||
}
|
||||
if (!atracContexts[i]) {
|
||||
continue;
|
||||
}
|
||||
if (atracContexts[i]->GetContextVersion() == 2 && atracContexts[i]->context_.Equals(contextAddr)) {
|
||||
atracID = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_dbg_assert_(atracID != -1);
|
||||
|
|
Loading…
Add table
Reference in a new issue