diff --git a/Core/HLE/sceHprm.cpp b/Core/HLE/sceHprm.cpp index 20b66bfff4..62a7b7a92a 100644 --- a/Core/HLE/sceHprm.cpp +++ b/Core/HLE/sceHprm.cpp @@ -48,14 +48,24 @@ static u32 sceHprmUnregisterCallback() { return hleLogError(Log::HLE, 0, "UNIMPL"); } +// The latch is 4 x u32 (make, break, press, release). We don't support the headphone remote +// buttons, so it's all zeroes. +static void WriteEmptyLatch(u32 latchAddr) { + if (!Memory::IsValid4AlignedRange(latchAddr, 16)) { + return; + } + for (int i = 0; i < 4; i++) { + Memory::WriteUnchecked_U32(0, latchAddr + i * 4); + } +} + static u32 sceHprmPeekLatch(u32 latchAddr) { - return hleLogDebug(Log::HLE,0, "latchAddr %08x", latchAddr); + WriteEmptyLatch(latchAddr); + return hleLogDebug(Log::HLE, 0, "latchAddr %08x", latchAddr); } static u32 sceHprmReadLatch(u32 latchAddr) { - // Real hardware/JPCSP: 4 x u32 output struct, dummied out to all-zero (nothing held/pressed). - for (int i = 0; i < 4; i++) - Memory::WriteOrException_U32(0, latchAddr + i * 4); + WriteEmptyLatch(latchAddr); return hleLogDebug(Log::HLE, 0, "latchAddr %08x", latchAddr); } diff --git a/Core/HLE/sceHprm.h b/Core/HLE/sceHprm.h index bcdaffb3d1..d864c7d07f 100644 --- a/Core/HLE/sceHprm.h +++ b/Core/HLE/sceHprm.h @@ -17,5 +17,7 @@ #pragma once +// HPRM - headphone remote. The PSP has a remote control for the headphones, which can be used to control music playback and volume. +// This module is used by the music player and some games, including DJ Max Portable games. void Register_sceHprm(); -void Register_sceHprm_driver(); \ No newline at end of file +void Register_sceHprm_driver();