From 96e2f5eef68bd12c27d9414303ed1458abb9d0ab Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Fri, 31 May 2024 10:21:59 +0100 Subject: [PATCH] IOS/STM: fix IPC reply for unknown ioctl requests --- Source/Core/Core/IOS/Device.h | 1 + Source/Core/Core/IOS/STM/STM.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/IOS/Device.h b/Source/Core/Core/IOS/Device.h index 64d14adf3f..d393dcd239 100644 --- a/Source/Core/Core/IOS/Device.h +++ b/Source/Core/Core/IOS/Device.h @@ -29,6 +29,7 @@ enum ReturnCode : s32 IPC_EMAX = -5, // Too many file descriptors open IPC_ENOENT = -6, // File not found IPC_EQUEUEFULL = -8, // Queue full + IPC_UNKNOWN = -9, // Unknown IPC_EIO = -12, // ECC error IPC_ENOMEM = -22, // Alloc failed during request FS_EINVAL = -101, // Invalid path diff --git a/Source/Core/Core/IOS/STM/STM.cpp b/Source/Core/Core/IOS/STM/STM.cpp index 0b0e1bbbda..06571b4ae3 100644 --- a/Source/Core/Core/IOS/STM/STM.cpp +++ b/Source/Core/Core/IOS/STM/STM.cpp @@ -58,8 +58,20 @@ std::optional STMImmediateDevice::IOCtl(const IOCtlRequest& request) INFO_LOG_FMT(IOS_STM, " IOCTL_STM_LEDMODE"); break; + case IOCTL_STM_HOTRESET_FOR_PD: + case IOCTL_STM_WAKEUP: + case IOCTL_STM_GET_IDLEMODE: + case IOCTL_STM_READDDRREG: + case IOCTL_STM_READDDRREG2: + case IOCTL_STM_LEDFLASH: + case IOCTL_STM_READVER: + ERROR_LOG_FMT(IOS_STM, "{} - Unimplemented IOCtl: {}", GetDeviceName(), request.request); + break; + default: request.DumpUnknown(GetSystem(), GetDeviceName(), Common::Log::LogType::IOS_STM); + return_value = IPC_UNKNOWN; + break; } return IPCReply(return_value); @@ -73,7 +85,7 @@ STMEventHookDevice::~STMEventHookDevice() std::optional STMEventHookDevice::IOCtl(const IOCtlRequest& request) { if (request.request != IOCTL_STM_EVENTHOOK) - return IPCReply(IPC_EINVAL); + return IPCReply(IPC_UNKNOWN); if (s_event_hook_request) return IPCReply(IPC_EEXIST);