SDL: PS2: Preserve real-error detection in PlayDevice (follow-up to #16413)

From 766d798f5a67c224cf5628ed236224123689e66b Mon Sep 17 00:00:00 2001
From: Ifcaro <[EMAIL REDACTED]>
Date: Thu, 1 Oct 2026 17:51:50 +0200
Subject: [PATCH] PS2: Preserve real-error detection in PlayDevice (follow-up
 to #16413)

#16413 fixed the zombie-device bug by ignoring audsrv_play_audio()'s
return value entirely. That also silently swallows its one real error
case: a negative return when audsrv isn't initialized
(-AUDSRV_ERR_NOT_INITIALIZED, iop/sound/audsrv/src/audsrv.c). Keep
treating a negative return as fatal; a short write is still tolerated
as the normal, by-design case it is.
---
 src/audio/ps2/SDL_ps2audio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/audio/ps2/SDL_ps2audio.c b/src/audio/ps2/SDL_ps2audio.c
index 92dc78b9fcd07..2b015489f1c04 100644
--- a/src/audio/ps2/SDL_ps2audio.c
+++ b/src/audio/ps2/SDL_ps2audio.c
@@ -89,10 +89,9 @@ static bool PS2AUDIO_OpenDevice(SDL_AudioDevice *device)
 
 static bool PS2AUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int buflen)
 {
-    // We assume it's working by default. In case if we throw error
-    //  audio device will be removed and never recreated.
-    audsrv_play_audio((char *)buffer, buflen);
-    return true;
+    // A short write is normal (ring buffer momentarily full), not an error -
+    // only a negative return (e.g. audsrv not initialized) is.
+    return audsrv_play_audio((char *)buffer, buflen) >= 0;
 }
 
 static bool PS2AUDIO_WaitDevice(SDL_AudioDevice *device)