From 23162ac7222b0900da1ab4d63f57c64a221c58e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 8 Jan 2017 20:52:48 +0100 Subject: [PATCH] IOS HLE: STM: Check if there is already an event hook For IOCTL_STM_EVENTHOOK, IOS checks if there is already an event hook to prevent overriding an existing event hook message with a new one, without first releasing it. --- Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stm.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stm.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stm.cpp index edc63221f2..07d2747ba0 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stm.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stm.cpp @@ -106,6 +106,12 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::IOCtl(u32 command_address) return GetDefaultReply(); } + if (s_event_hook_address != 0) + { + Memory::Write_U32(FS_EEXIST, command_address + 4); + return GetDefaultReply(); + } + // IOCTL_STM_EVENTHOOK waits until the reset button or power button // is pressed. s_event_hook_address = command_address;