IOS HLE: HID: Remove left-over align function

Also remove unneeded AlignUp usages.
This commit is contained in:
Léo Lam 2016-12-10 18:17:47 +01:00
parent 3c50c61606
commit 22fcb735ed
2 changed files with 9 additions and 14 deletions

View File

@ -10,6 +10,7 @@
#include <libusb.h> #include <libusb.h>
#include "Common/Align.h"
#include "Common/CommonFuncs.h" #include "Common/CommonFuncs.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Core/Core.h" #include "Core/Core.h"
@ -373,8 +374,8 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
WiiHIDDeviceDescriptor wii_device; WiiHIDDeviceDescriptor wii_device;
ConvertDeviceToWii(&wii_device, &desc); ConvertDeviceToWii(&wii_device, &desc);
Memory::CopyToEmu(OffsetBuffer, &wii_device, Align(wii_device.bLength, 4)); Memory::CopyToEmu(OffsetBuffer, &wii_device, wii_device.bLength);
OffsetBuffer += Align(wii_device.bLength, 4); OffsetBuffer += Common::AlignUp(wii_device.bLength, 4);
bool deviceValid = true; bool deviceValid = true;
bool isHID = false; bool isHID = false;
@ -387,8 +388,8 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
{ {
WiiHIDConfigDescriptor wii_config; WiiHIDConfigDescriptor wii_config;
ConvertConfigToWii(&wii_config, config); ConvertConfigToWii(&wii_config, config);
Memory::CopyToEmu(OffsetBuffer, &wii_config, Align(wii_config.bLength, 4)); Memory::CopyToEmu(OffsetBuffer, &wii_config, wii_config.bLength);
OffsetBuffer += Align(wii_config.bLength, 4); OffsetBuffer += Common::AlignUp(wii_config.bLength, 4);
for (ic = 0; ic < config->bNumInterfaces; ic++) for (ic = 0; ic < config->bNumInterfaces; ic++)
{ {
@ -404,8 +405,8 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
WiiHIDInterfaceDescriptor wii_interface; WiiHIDInterfaceDescriptor wii_interface;
ConvertInterfaceToWii(&wii_interface, interface); ConvertInterfaceToWii(&wii_interface, interface);
Memory::CopyToEmu(OffsetBuffer, &wii_interface, Align(wii_interface.bLength, 4)); Memory::CopyToEmu(OffsetBuffer, &wii_interface, wii_interface.bLength);
OffsetBuffer += Align(wii_interface.bLength, 4); OffsetBuffer += Common::AlignUp(wii_interface.bLength, 4);
for (e = 0; e < interface->bNumEndpoints; e++) for (e = 0; e < interface->bNumEndpoints; e++)
{ {
@ -413,8 +414,8 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
WiiHIDEndpointDescriptor wii_endpoint; WiiHIDEndpointDescriptor wii_endpoint;
ConvertEndpointToWii(&wii_endpoint, endpoint); ConvertEndpointToWii(&wii_endpoint, endpoint);
Memory::CopyToEmu(OffsetBuffer, &wii_endpoint, Align(wii_endpoint.bLength, 4)); Memory::CopyToEmu(OffsetBuffer, &wii_endpoint, wii_endpoint.bLength);
OffsetBuffer += Align(wii_endpoint.bLength, 4); OffsetBuffer += Common::AlignUp(wii_endpoint.bLength, 4);
} // endpoints } // endpoints
} // interfaces } // interfaces
@ -483,11 +484,6 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
Memory::Write_U32(0xFFFFFFFF, OffsetBuffer); // no more devices Memory::Write_U32(0xFFFFFFFF, OffsetBuffer); // no more devices
} }
int CWII_IPC_HLE_Device_hid::Align(int num, int alignment)
{
return (num + (alignment - 1)) & ~(alignment - 1);
}
libusb_device_handle* CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum) libusb_device_handle* CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
{ {
libusb_device** list; libusb_device** list;

View File

@ -127,7 +127,6 @@ private:
const libusb_interface_descriptor* src); const libusb_interface_descriptor* src);
void ConvertEndpointToWii(WiiHIDEndpointDescriptor* dest, const libusb_endpoint_descriptor* src); void ConvertEndpointToWii(WiiHIDEndpointDescriptor* dest, const libusb_endpoint_descriptor* src);
int Align(int num, int alignment);
static void checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid); static void checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid);
static void LIBUSB_CALL handleUsbUpdates(libusb_transfer* transfer); static void LIBUSB_CALL handleUsbUpdates(libusb_transfer* transfer);