IOS HLE: Remove old structs and methods
Now that everything has been changed to use the new structs, the old methods and structs can be removed. And while I was changing the base device class, I also moved the "unsupported command" code to a separate function. It was pretty silly to copy the same 3 lines for ~5 commands.
This commit is contained in:
parent
8629a1f11c
commit
c6b1cfb222
|
@ -458,11 +458,6 @@ void EnqueueReply(const IOSRequest& request, int cycles_in_future, CoreTiming::F
|
||||||
CoreTiming::ScheduleEvent(cycles_in_future, s_event_enqueue, request.address, from);
|
CoreTiming::ScheduleEvent(cycles_in_future, s_event_enqueue, request.address, from);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnqueueReply(u32 command_address, int cycles_in_future, CoreTiming::FromThread from)
|
|
||||||
{
|
|
||||||
EnqueueReply(IOSRequest{command_address}, cycles_in_future, from);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnqueueCommandAcknowledgement(u32 address, int cycles_in_future)
|
void EnqueueCommandAcknowledgement(u32 address, int cycles_in_future)
|
||||||
{
|
{
|
||||||
CoreTiming::ScheduleEvent(cycles_in_future, s_event_enqueue,
|
CoreTiming::ScheduleEvent(cycles_in_future, s_event_enqueue,
|
||||||
|
|
|
@ -72,8 +72,6 @@ void ExecuteCommand(u32 address);
|
||||||
void EnqueueRequest(u32 address);
|
void EnqueueRequest(u32 address);
|
||||||
void EnqueueReply(const IOSRequest& request, int cycles_in_future = 0,
|
void EnqueueReply(const IOSRequest& request, int cycles_in_future = 0,
|
||||||
CoreTiming::FromThread from = CoreTiming::FromThread::CPU);
|
CoreTiming::FromThread from = CoreTiming::FromThread::CPU);
|
||||||
void EnqueueReply(u32 command_address, int cycles_in_future = 0,
|
|
||||||
CoreTiming::FromThread from = CoreTiming::FromThread::CPU);
|
|
||||||
void EnqueueCommandAcknowledgement(u32 address, int cycles_in_future = 0);
|
void EnqueueCommandAcknowledgement(u32 address, int cycles_in_future = 0);
|
||||||
|
|
||||||
} // end of namespace WII_IPC_HLE_Interface
|
} // end of namespace WII_IPC_HLE_Interface
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
@ -11,45 +12,6 @@
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||||
|
|
||||||
// TODO: remove this once all device classes have been migrated.
|
|
||||||
SIOCtlVBuffer::SIOCtlVBuffer(const u32 address) : m_Address(address)
|
|
||||||
{
|
|
||||||
// These are the Ioctlv parameters in the IOS communication. The BufferVector
|
|
||||||
// is a memory address offset at where the in and out buffer addresses are
|
|
||||||
// stored.
|
|
||||||
Parameter = Memory::Read_U32(m_Address + 0x0C); // command 3, arg0
|
|
||||||
NumberInBuffer = Memory::Read_U32(m_Address + 0x10); // 4, arg1
|
|
||||||
NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14); // 5, arg2
|
|
||||||
BufferVector = Memory::Read_U32(m_Address + 0x18); // 6, arg3
|
|
||||||
|
|
||||||
// The start of the out buffer
|
|
||||||
u32 BufferVectorOffset = BufferVector;
|
|
||||||
|
|
||||||
// Write the address and size for all in messages
|
|
||||||
for (u32 i = 0; i < NumberInBuffer; i++)
|
|
||||||
{
|
|
||||||
SBuffer Buffer;
|
|
||||||
Buffer.m_Address = Memory::Read_U32(BufferVectorOffset);
|
|
||||||
BufferVectorOffset += 4;
|
|
||||||
Buffer.m_Size = Memory::Read_U32(BufferVectorOffset);
|
|
||||||
BufferVectorOffset += 4;
|
|
||||||
InBuffer.push_back(Buffer);
|
|
||||||
DEBUG_LOG(WII_IPC_HLE, "SIOCtlVBuffer in%i: 0x%08x, 0x%x", i, Buffer.m_Address, Buffer.m_Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write the address and size for all out or in-out messages
|
|
||||||
for (u32 i = 0; i < NumberPayloadBuffer; i++)
|
|
||||||
{
|
|
||||||
SBuffer Buffer;
|
|
||||||
Buffer.m_Address = Memory::Read_U32(BufferVectorOffset);
|
|
||||||
BufferVectorOffset += 4;
|
|
||||||
Buffer.m_Size = Memory::Read_U32(BufferVectorOffset);
|
|
||||||
BufferVectorOffset += 4;
|
|
||||||
PayloadBuffer.push_back(Buffer);
|
|
||||||
DEBUG_LOG(WII_IPC_HLE, "SIOCtlVBuffer io%i: 0x%08x, 0x%x", i, Buffer.m_Address, Buffer.m_Size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IOSRequest::IOSRequest(const u32 address_) : address(address_)
|
IOSRequest::IOSRequest(const u32 address_) : address(address_)
|
||||||
{
|
{
|
||||||
command = static_cast<IPCCommandType>(Memory::Read_U32(address));
|
command = static_cast<IPCCommandType>(Memory::Read_U32(address));
|
||||||
|
@ -180,87 +142,26 @@ void IWII_IPC_HLE_Device::DoStateShared(PointerWrap& p)
|
||||||
p.Do(m_is_active);
|
p.Do(m_is_active);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove the wrappers once all device classes have been migrated.
|
|
||||||
IOSReturnCode IWII_IPC_HLE_Device::Open(const IOSOpenRequest& request)
|
IOSReturnCode IWII_IPC_HLE_Device::Open(const IOSOpenRequest& request)
|
||||||
{
|
|
||||||
Open(request.address, request.flags);
|
|
||||||
return static_cast<IOSReturnCode>(Memory::Read_U32(request.address + 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::Open(u32 command_address, u32 mode)
|
|
||||||
{
|
{
|
||||||
m_is_active = true;
|
m_is_active = true;
|
||||||
return GetDefaultReply();
|
return IPC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IWII_IPC_HLE_Device::Close()
|
void IWII_IPC_HLE_Device::Close()
|
||||||
{
|
|
||||||
Close(0, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::Close(u32 command_address, bool force)
|
|
||||||
{
|
{
|
||||||
m_is_active = false;
|
m_is_active = false;
|
||||||
return GetDefaultReply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::Seek(const IOSSeekRequest& request)
|
IPCCommandResult IWII_IPC_HLE_Device::Unsupported(const IOSRequest& request)
|
||||||
{
|
{
|
||||||
return Seek(request.address);
|
static std::map<IPCCommandType, std::string> names = {{{IPC_CMD_READ, "Read"},
|
||||||
}
|
{IPC_CMD_WRITE, "Write"},
|
||||||
|
{IPC_CMD_SEEK, "Seek"},
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::Seek(u32 command_address)
|
{IPC_CMD_IOCTL, "IOCtl"},
|
||||||
{
|
{IPC_CMD_IOCTLV, "IOCtlV"}}};
|
||||||
WARN_LOG(WII_IPC_HLE, "%s does not support Seek()", m_name.c_str());
|
WARN_LOG(WII_IPC_HLE, "%s does not support %s()", m_name.c_str(), names[request.command].c_str());
|
||||||
Memory::Write_U32(IPC_EINVAL, command_address);
|
request.SetReturnValue(IPC_EINVAL);
|
||||||
return GetDefaultReply();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::Read(const IOSReadWriteRequest& request)
|
|
||||||
{
|
|
||||||
return Read(request.address);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::Read(u32 command_address)
|
|
||||||
{
|
|
||||||
WARN_LOG(WII_IPC_HLE, "%s does not support Read()", m_name.c_str());
|
|
||||||
Memory::Write_U32(IPC_EINVAL, command_address);
|
|
||||||
return GetDefaultReply();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::Write(const IOSReadWriteRequest& request)
|
|
||||||
{
|
|
||||||
return Write(request.address);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::Write(u32 command_address)
|
|
||||||
{
|
|
||||||
WARN_LOG(WII_IPC_HLE, "%s does not support Write()", m_name.c_str());
|
|
||||||
Memory::Write_U32(IPC_EINVAL, command_address);
|
|
||||||
return GetDefaultReply();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::IOCtl(const IOSIOCtlRequest& request)
|
|
||||||
{
|
|
||||||
return IOCtl(request.address);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::IOCtl(u32 command_address)
|
|
||||||
{
|
|
||||||
WARN_LOG(WII_IPC_HLE, "%s does not support IOCtl()", m_name.c_str());
|
|
||||||
Memory::Write_U32(IPC_EINVAL, command_address);
|
|
||||||
return GetDefaultReply();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::IOCtlV(const IOSIOCtlVRequest& request)
|
|
||||||
{
|
|
||||||
return IOCtlV(request.address);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::IOCtlV(u32 command_address)
|
|
||||||
{
|
|
||||||
WARN_LOG(WII_IPC_HLE, "%s does not support IOCtlV()", m_name.c_str());
|
|
||||||
Memory::Write_U32(IPC_EINVAL, command_address);
|
|
||||||
return GetDefaultReply();
|
return GetDefaultReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,25 +40,6 @@ enum IOSReturnCode : s32
|
||||||
IPC_EESEXHAUSTED = -1016, // Max of 2 ES handles exceeded
|
IPC_EESEXHAUSTED = -1016, // Max of 2 ES handles exceeded
|
||||||
};
|
};
|
||||||
|
|
||||||
// A struct for IOS ioctlv calls
|
|
||||||
// TODO: remove this once nothing uses this anymore.
|
|
||||||
struct SIOCtlVBuffer
|
|
||||||
{
|
|
||||||
explicit SIOCtlVBuffer(u32 address);
|
|
||||||
|
|
||||||
const u32 m_Address;
|
|
||||||
u32 Parameter;
|
|
||||||
u32 NumberInBuffer;
|
|
||||||
u32 NumberPayloadBuffer;
|
|
||||||
u32 BufferVector;
|
|
||||||
struct SBuffer
|
|
||||||
{
|
|
||||||
u32 m_Address, m_Size;
|
|
||||||
};
|
|
||||||
std::vector<SBuffer> InBuffer;
|
|
||||||
std::vector<SBuffer> PayloadBuffer;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct IOSRequest
|
struct IOSRequest
|
||||||
{
|
{
|
||||||
u32 address = 0;
|
u32 address = 0;
|
||||||
|
@ -167,21 +148,11 @@ public:
|
||||||
// Replies to Open and Close requests are sent by WII_IPC_HLE, not by the devices themselves.
|
// Replies to Open and Close requests are sent by WII_IPC_HLE, not by the devices themselves.
|
||||||
virtual IOSReturnCode Open(const IOSOpenRequest& request);
|
virtual IOSReturnCode Open(const IOSOpenRequest& request);
|
||||||
virtual void Close();
|
virtual void Close();
|
||||||
virtual IPCCommandResult Seek(const IOSSeekRequest& request);
|
virtual IPCCommandResult Seek(const IOSSeekRequest& seek) { return Unsupported(seek); }
|
||||||
virtual IPCCommandResult Read(const IOSReadWriteRequest& request);
|
virtual IPCCommandResult Read(const IOSReadWriteRequest& read) { return Unsupported(read); }
|
||||||
virtual IPCCommandResult Write(const IOSReadWriteRequest& request);
|
virtual IPCCommandResult Write(const IOSReadWriteRequest& write) { return Unsupported(write); }
|
||||||
virtual IPCCommandResult IOCtl(const IOSIOCtlRequest& request);
|
virtual IPCCommandResult IOCtl(const IOSIOCtlRequest& ioctl) { return Unsupported(ioctl); }
|
||||||
virtual IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request);
|
virtual IPCCommandResult IOCtlV(const IOSIOCtlVRequest& ioctlv) { return Unsupported(ioctlv); }
|
||||||
|
|
||||||
// TODO: remove these once all device classes have been migrated.
|
|
||||||
virtual IPCCommandResult Open(u32 command_address, u32 mode);
|
|
||||||
virtual IPCCommandResult Close(u32 command_address, bool force = false);
|
|
||||||
virtual IPCCommandResult Seek(u32 command_address);
|
|
||||||
virtual IPCCommandResult Read(u32 command_address);
|
|
||||||
virtual IPCCommandResult Write(u32 command_address);
|
|
||||||
virtual IPCCommandResult IOCtl(u32 command_address);
|
|
||||||
virtual IPCCommandResult IOCtlV(u32 command_address);
|
|
||||||
|
|
||||||
virtual void Update() {}
|
virtual void Update() {}
|
||||||
virtual DeviceType GetDeviceType() const { return m_device_type; }
|
virtual DeviceType GetDeviceType() const { return m_device_type; }
|
||||||
virtual bool IsOpened() const { return m_is_active; }
|
virtual bool IsOpened() const { return m_is_active; }
|
||||||
|
@ -194,4 +165,7 @@ protected:
|
||||||
u32 m_device_id;
|
u32 m_device_id;
|
||||||
DeviceType m_device_type;
|
DeviceType m_device_type;
|
||||||
bool m_is_active = false;
|
bool m_is_active = false;
|
||||||
|
|
||||||
|
private:
|
||||||
|
IPCCommandResult Unsupported(const IOSRequest& request);
|
||||||
};
|
};
|
||||||
|
|
|
@ -161,14 +161,6 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
||||||
return GetDefaultReply();
|
return GetDefaultReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtlV(u32 command_address)
|
|
||||||
{
|
|
||||||
SIOCtlVBuffer command_buffer(command_address);
|
|
||||||
ERROR_LOG(WII_IPC_HLE, "IOCtlV on /dev/usb/wfssrv -- unsupported");
|
|
||||||
Memory::Write_U32(IPC_EINVAL, command_address + 4);
|
|
||||||
return GetDefaultReply();
|
|
||||||
}
|
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_wfssrv::FileDescriptor*
|
CWII_IPC_HLE_Device_usb_wfssrv::FileDescriptor*
|
||||||
CWII_IPC_HLE_Device_usb_wfssrv::FindFileDescriptor(u16 fd)
|
CWII_IPC_HLE_Device_usb_wfssrv::FindFileDescriptor(u16 fd)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue