From 917f5897bd09106ca00e2e69e96596c1ed2b715e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 29 Apr 2024 19:58:11 +0200 Subject: [PATCH] Add back a lost-in-refactoring hack for the SasAudio/sceAtrac integration. Fixes #19075 --- Core/HLE/AtracCtx.h | 4 ++++ Core/HLE/sceAtrac.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Core/HLE/AtracCtx.h b/Core/HLE/AtracCtx.h index 0f5245c259..8f2bf38fda 100644 --- a/Core/HLE/AtracCtx.h +++ b/Core/HLE/AtracCtx.h @@ -216,6 +216,10 @@ public: int GetOutputChannels() const { return outputChannels_; } + void SetOutputChannels(int channels) { + // Only used for sceSas audio. To be refactored away in the future. + outputChannels_ = channels; + } int atracID_ = -1; diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index 278002c196..75fd75a430 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -1007,6 +1007,11 @@ u32 AtracSasDecodeData(int atracID, u8* outbuf, u32 outbufPtr, u32 *SamplesNum, int AtracSasGetIDByContext(u32 contextAddr) { int atracID = (int)Memory::Read_U32(contextAddr + 0xfc); + // Restored old hack here that forces outputChannels_ to 1, since sceSas expects mono output, unlike normal usage. + // This is for savestate compatibility. + // I think it would be better to simply pass in a 1 as a parameter to atrac->DecodeData in AtracSasDecodeData above. + AtracBase *atrac = getAtrac(atracID); + atrac->SetOutputChannels(1); return atracID; }