diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp index 6737c4377c..bdd3219768 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp @@ -10,6 +10,7 @@ #include +#include "Common/Align.h" #include "Common/CommonFuncs.h" #include "Common/Logging/Log.h" #include "Core/Core.h" @@ -373,8 +374,8 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) WiiHIDDeviceDescriptor wii_device; ConvertDeviceToWii(&wii_device, &desc); - Memory::CopyToEmu(OffsetBuffer, &wii_device, Align(wii_device.bLength, 4)); - OffsetBuffer += Align(wii_device.bLength, 4); + Memory::CopyToEmu(OffsetBuffer, &wii_device, wii_device.bLength); + OffsetBuffer += Common::AlignUp(wii_device.bLength, 4); bool deviceValid = true; bool isHID = false; @@ -387,8 +388,8 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) { WiiHIDConfigDescriptor wii_config; ConvertConfigToWii(&wii_config, config); - Memory::CopyToEmu(OffsetBuffer, &wii_config, Align(wii_config.bLength, 4)); - OffsetBuffer += Align(wii_config.bLength, 4); + Memory::CopyToEmu(OffsetBuffer, &wii_config, wii_config.bLength); + OffsetBuffer += Common::AlignUp(wii_config.bLength, 4); 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; ConvertInterfaceToWii(&wii_interface, interface); - Memory::CopyToEmu(OffsetBuffer, &wii_interface, Align(wii_interface.bLength, 4)); - OffsetBuffer += Align(wii_interface.bLength, 4); + Memory::CopyToEmu(OffsetBuffer, &wii_interface, wii_interface.bLength); + OffsetBuffer += Common::AlignUp(wii_interface.bLength, 4); 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; ConvertEndpointToWii(&wii_endpoint, endpoint); - Memory::CopyToEmu(OffsetBuffer, &wii_endpoint, Align(wii_endpoint.bLength, 4)); - OffsetBuffer += Align(wii_endpoint.bLength, 4); + Memory::CopyToEmu(OffsetBuffer, &wii_endpoint, wii_endpoint.bLength); + OffsetBuffer += Common::AlignUp(wii_endpoint.bLength, 4); } // endpoints } // interfaces @@ -483,11 +484,6 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) 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** list; diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.h index fb28b88eb5..c4fa695c70 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.h +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.h @@ -127,7 +127,6 @@ private: const libusb_interface_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 LIBUSB_CALL handleUsbUpdates(libusb_transfer* transfer);