From 84c8d0b66dda1693fe0f53bc820324de11d6592e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 15 Jan 2017 11:47:05 +0100 Subject: [PATCH] IOS HLE: Deduplicate request code in stub --- .../Core/IPC_HLE/WII_IPC_HLE_Device_stub.cpp | 16 +++++++--------- .../Core/Core/IPC_HLE/WII_IPC_HLE_Device_stub.h | 8 ++++---- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stub.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stub.cpp index aa8dc57050..8f00b8188a 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stub.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stub.cpp @@ -4,37 +4,35 @@ #include "Core/IPC_HLE/WII_IPC_HLE_Device_stub.h" #include "Common/Logging/Log.h" -#include "Core/HW/Memmap.h" CWII_IPC_HLE_Device_stub::CWII_IPC_HLE_Device_stub(u32 device_id, const std::string& device_name) : IWII_IPC_HLE_Device(device_id, device_name) { } -IPCCommandResult CWII_IPC_HLE_Device_stub::Open(u32 command_address, u32 mode) +IOSReturnCode CWII_IPC_HLE_Device_stub::Open(const IOSOpenRequest& request) { WARN_LOG(WII_IPC_HLE, "%s faking Open()", m_name.c_str()); m_is_active = true; - return GetDefaultReply(); + return IPC_SUCCESS; } -IPCCommandResult CWII_IPC_HLE_Device_stub::Close(u32 command_address, bool force) +void CWII_IPC_HLE_Device_stub::Close() { WARN_LOG(WII_IPC_HLE, "%s faking Close()", m_name.c_str()); m_is_active = false; - return GetDefaultReply(); } -IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtl(u32 command_address) +IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtl(const IOSIOCtlRequest& request) { WARN_LOG(WII_IPC_HLE, "%s faking IOCtl()", m_name.c_str()); - Memory::Write_U32(IPC_SUCCESS, command_address + 4); + request.SetReturnValue(IPC_SUCCESS); return GetDefaultReply(); } -IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtlV(u32 command_address) +IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtlV(const IOSIOCtlVRequest& request) { WARN_LOG(WII_IPC_HLE, "%s faking IOCtlV()", m_name.c_str()); - Memory::Write_U32(IPC_SUCCESS, command_address + 4); + request.SetReturnValue(IPC_SUCCESS); return GetDefaultReply(); } diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stub.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stub.h index 68449b8172..8dd7c72eab 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stub.h +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stub.h @@ -15,8 +15,8 @@ class CWII_IPC_HLE_Device_stub : public IWII_IPC_HLE_Device public: CWII_IPC_HLE_Device_stub(u32 device_id, const std::string& device_name); - IPCCommandResult Open(u32 command_address, u32 mode) override; - IPCCommandResult Close(u32 command_address, bool force = false) override; - IPCCommandResult IOCtl(u32 command_address) override; - IPCCommandResult IOCtlV(u32 command_address) override; + IOSReturnCode Open(const IOSOpenRequest& request) override; + void Close() override; + IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override; + IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override; };