USB: Add a stub HIDv5 implementation and use it for IOS59.

This commit is contained in:
Pierre Bourdon 2017-08-06 22:17:51 +02:00
parent f810f1edb2
commit 425cf18bf7
6 changed files with 114 additions and 1 deletions

View File

@ -186,6 +186,7 @@ set(SRCS
IOS/USB/OH0/OH0.cpp
IOS/USB/OH0/OH0Device.cpp
IOS/USB/USB_HID/HIDv4.cpp
IOS/USB/USB_HID/HIDv5.cpp
IOS/USB/USB_VEN/VEN.cpp
IOS/USB/USBV0.cpp
IOS/USB/USBV4.cpp

View File

@ -221,6 +221,7 @@
<ClCompile Include="IOS\USB\OH0\OH0.cpp" />
<ClCompile Include="IOS\USB\OH0\OH0Device.cpp" />
<ClCompile Include="IOS\USB\USB_HID\HIDv4.cpp" />
<ClCompile Include="IOS\USB\USB_HID\HIDv5.cpp" />
<ClCompile Include="IOS\USB\USB_VEN\VEN.cpp" />
<ClCompile Include="IOS\USB\USBV0.cpp" />
<ClCompile Include="IOS\USB\USBV4.cpp" />
@ -468,6 +469,7 @@
<ClInclude Include="IOS\USB\OH0\OH0.h" />
<ClInclude Include="IOS\USB\OH0\OH0Device.h" />
<ClInclude Include="IOS\USB\USB_HID\HIDv4.h" />
<ClInclude Include="IOS\USB\USB_HID\HIDv5.h" />
<ClInclude Include="IOS\USB\USB_VEN\VEN.h" />
<ClInclude Include="IOS\USB\USBV0.h" />
<ClInclude Include="IOS\USB\USBV4.h" />

View File

@ -826,6 +826,9 @@
<ClCompile Include="IOS\USB\USB_HID\HIDv4.cpp">
<Filter>IOS\USB</Filter>
</ClCompile>
<ClCompile Include="IOS\USB\USB_HID\HIDv5.cpp">
<Filter>IOS\USB</Filter>
</ClCompile>
<ClCompile Include="IOS\USB\USB_VEN\VEN.cpp">
<Filter>IOS\USB</Filter>
</ClCompile>
@ -1469,6 +1472,9 @@
<ClInclude Include="IOS\USB\USB_HID\HIDv4.h">
<Filter>IOS\USB</Filter>
</ClInclude>
<ClInclude Include="IOS\USB\USB_HID\HIDv5.h">
<Filter>IOS\USB</Filter>
</ClInclude>
<ClInclude Include="IOS\USB\USB_VEN\VEN.h">
<Filter>IOS\USB</Filter>
</ClInclude>

View File

@ -47,6 +47,7 @@
#include "Core/IOS/USB/OH0/OH0.h"
#include "Core/IOS/USB/OH0/OH0Device.h"
#include "Core/IOS/USB/USB_HID/HIDv4.h"
#include "Core/IOS/USB/USB_HID/HIDv5.h"
#include "Core/IOS/USB/USB_KBD.h"
#include "Core/IOS/USB/USB_VEN/VEN.h"
#include "Core/IOS/WFS/WFSI.h"
@ -361,7 +362,10 @@ void Kernel::AddStaticDevices()
AddDevice(std::make_unique<Device::USB_KBD>(*this, "/dev/usb/kbd"));
AddDevice(std::make_unique<Device::SDIOSlot0>(*this, "/dev/sdio/slot0"));
AddDevice(std::make_unique<Device::Stub>(*this, "/dev/sdio/slot1"));
AddDevice(std::make_unique<Device::USB_HIDv4>(*this, "/dev/usb/hid"));
if (GetVersion() == 59)
AddDevice(std::make_unique<Device::USB_HIDv5>(*this, "/dev/usb/hid"));
else
AddDevice(std::make_unique<Device::USB_HIDv4>(*this, "/dev/usb/hid"));
AddDevice(std::make_unique<Device::OH0>(*this, "/dev/usb/oh0"));
AddDevice(std::make_unique<Device::Stub>(*this, "/dev/usb/oh1"));
AddDevice(std::make_unique<Device::USB_VEN>(*this, "/dev/usb/ven"));

View File

@ -0,0 +1,63 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Core/IOS/USB/USB_HID/HIDv5.h"
#include <string>
#include "Core/HW/Memmap.h"
#include "Core/IOS/Device.h"
#include "Core/IOS/USB/Common.h"
#include "Core/IOS/USB/USBV5.h"
namespace IOS
{
namespace HLE
{
namespace Device
{
USB_HIDv5::USB_HIDv5(Kernel& ios, const std::string& device_name) : USBHost(ios, device_name)
{
}
USB_HIDv5::~USB_HIDv5()
{
StopThreads();
}
IPCCommandResult USB_HIDv5::IOCtl(const IOCtlRequest& request)
{
request.Log(GetDeviceName(), LogTypes::IOS_USB);
switch (request.request)
{
case USB::IOCTL_USBV5_GETVERSION:
Memory::Write_U32(VERSION, request.buffer_out);
return GetDefaultReply(IPC_SUCCESS);
case USB::IOCTL_USBV5_SHUTDOWN:
if (m_hanging_request)
{
IOCtlRequest hanging_request{m_hanging_request};
m_ios.EnqueueIPCReply(hanging_request, IPC_SUCCESS);
}
return GetDefaultReply(IPC_SUCCESS);
case USB::IOCTL_USBV5_GETDEVICECHANGE:
if (m_devicechange_replied)
{
m_hanging_request = request.address;
return GetNoReply();
}
else
{
m_devicechange_replied = true;
return GetDefaultReply(IPC_SUCCESS);
}
default:
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_USB);
return GetDefaultReply(IPC_SUCCESS);
}
}
} // namespace Device
} // namespace HLE
} // namespace IOS

View File

@ -0,0 +1,37 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <string>
#include "Common/CommonTypes.h"
#include "Core/IOS/IOS.h"
#include "Core/IOS/USB/Host.h"
namespace IOS
{
namespace HLE
{
namespace Device
{
// Stub implementation that only gets DQX to boot.
class USB_HIDv5 : public USBHost
{
public:
USB_HIDv5(Kernel& ios, const std::string& device_name);
~USB_HIDv5() override;
IPCCommandResult IOCtl(const IOCtlRequest& request) override;
private:
static constexpr u32 VERSION = 0x50001;
u32 m_hanging_request = 0;
bool m_devicechange_replied = false;
};
} // namespace Device
} // namespace HLE
} // namespace IOS