From add84fb36f459470f39a63ca1ef903e05c64585f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 21 Oct 2026 16:41:04 +0200 Subject: [PATCH] VSH: sceVaudio_driver, sceVaudioChReserveBuffering and the display panel ID The VSH's video player outputs sound through vshbridge.prx, which imports sceVaudio under its driver name, so every sceVaudioOutputBlocking went nowhere. Register the same functions as sceVaudio_driver. The player reserves its channel with sceVaudioChReserveBuffering, which in vaudio.prx is sceVaudioChReserve with a flag set; treat it as that. It also polls sceDisplay_driver_996881D2 through vshbridge.prx, and skips setting up its picture output when it's 0. display_02g.prx's init sets that from the LCD panel type in IdStorage (0x0103000B for type 1, 0x0103020F for type 2), so it's never 0 on a PSP. Co-Authored-By: Claude Opus 5.5 (1M context) --- Core/HLE/HLETables.cpp | 1 + Core/HLE/sceDisplay.cpp | 8 ++++++++ Core/HLE/sceVaudio.cpp | 13 ++++++++++++- Core/HLE/sceVaudio.h | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Core/HLE/HLETables.cpp b/Core/HLE/HLETables.cpp index 15af40cbe7..20214d49df 100644 --- a/Core/HLE/HLETables.cpp +++ b/Core/HLE/HLETables.cpp @@ -437,6 +437,7 @@ void RegisterAllModules() { Register_sceAmctrl_driver(); Register_InitForKernel(); Register_PopsBootCalls(); + Register_sceVaudio_driver(); // Not ready to enable this due to apparent softlocks in Patapon 3. // Register_sceNpMatching2(); diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 96b5948401..d4ea955bf7 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -1201,6 +1201,13 @@ static u32 sceDisplaySetHoldMode(u32 hMode) { return hleLogWarning(Log::sceDisplay, 0, "UNIMPL"); } +// 6.61's display_02g.prx returns a global its init sets from the LCD panel type in IdStorage: +// 0x0103000B for type 1, 0x0103020F for type 2 (sceDisplay_driver_206276C2), never 0. The VSH's +// video player polls it through vshbridge.prx, and with 0 never sets up its picture output. +static u32 sceDisplay_driver_996881D2() { + return hleLogDebug(Log::sceDisplay, 0x0103000B); +} + const HLEFunction sceDisplay[] = { {0X0E20F177, &WrapU_III, "sceDisplaySetMode", 'x', "iii" }, {0X289D82FE, &WrapI_UIII, "sceDisplaySetFrameBuf", 'i', "xiii"}, @@ -1225,6 +1232,7 @@ const HLEFunction sceDisplay[] = { {0X9E3C6DC6, &WrapU_II, "sceDisplaySetBrightness", 'x', "ii" }, {0X4D4E10EC, &WrapU_V, "sceDisplayIsVblank", 'x', "" }, {0X21038913, &WrapU_V, "sceDisplayIsVsync", 'x', "" }, + {0X996881D2, &WrapU_V, "sceDisplay_driver_996881D2", 'x', "" }, }; void Register_sceDisplay() { diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index 4876c57f83..d825639bac 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -132,6 +132,12 @@ static u32 sceVaudioSetAlcMode(int alcMode) { return 0; } +// In vaudio.prx this is sceVaudioChReserve with a flag set (a3 = 1 into the shared reserve, 0 for +// ChReserve), which presumably buffers deeper. Not modelled. The VSH's UMD Video player uses it. +static u32 sceVaudioChReserveBuffering(int sampleCount, int freq, int format) { + return sceVaudioChReserve(sampleCount, freq, format); +} + const HLEFunction sceVaudio[] = { {0X8986295E, &WrapU_IU, "sceVaudioOutputBlocking", 'x', "ix" }, {0X03B6807D, &WrapU_III, "sceVaudioChReserve", 'x', "iii"}, @@ -139,10 +145,15 @@ const HLEFunction sceVaudio[] = { {0X346FBE94, &WrapU_II, "sceVaudioSetEffectType", 'x', "ii" }, {0XCBD4AC51, &WrapU_I, "sceVaudioSetAlcMode", 'x', "i" }, {0X504E4745, nullptr, "sceVaudio_504E4745", '?', "" }, - {0X27ACC20B, nullptr, "sceVaudioChReserveBuffering", '?', "" }, + {0X27ACC20B, &WrapU_III, "sceVaudioChReserveBuffering", 'x', "iii"}, {0XE8E78DC8, nullptr, "sceVaudio_E8E78DC8", '?', "" }, }; void Register_sceVaudio() { RegisterHLEModule("sceVaudio",ARRAY_SIZE(sceVaudio), sceVaudio ); } + +void Register_sceVaudio_driver() { + // The same functions; vshbridge.prx imports them under the driver name for the VSH's video player. + RegisterHLEModule("sceVaudio_driver", ARRAY_SIZE(sceVaudio), sceVaudio); +} diff --git a/Core/HLE/sceVaudio.h b/Core/HLE/sceVaudio.h index d0fce8685f..46e1e351e1 100644 --- a/Core/HLE/sceVaudio.h +++ b/Core/HLE/sceVaudio.h @@ -20,6 +20,7 @@ class PointerWrap; void Register_sceVaudio(); +void Register_sceVaudio_driver(); void __VaudioInit(); void __VaudioDoState(PointerWrap &p);