IOS HLE: Deduplicate request code in stub

This commit is contained in:
Léo Lam 2017-01-15 11:47:05 +01:00
parent f9e806fd71
commit 84c8d0b66d
2 changed files with 11 additions and 13 deletions

View File

@ -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();
}

View File

@ -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;
};