Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* SceUdcd module base: 0x01E10000, LOAD:01E142B4 udcd_check_driver */
- int __cdecl udcd_check_driver(const SceUdcdDriver *driver)
- {
- SceUdcdDeviceDescriptor *device_descriptor; // r6@1
- SceUdcdConfiguration *configuration; // r5@2
- unsigned int bMaxPacketSize0; // r3@3
- SceUdcdConfigDescriptor *config_descriptors; // r3@7
- SceUdcdInterfaceSettings *interface_settings; // r2@8
- int bNumInterfaces; // r4@9
- int cnt; // r3@11
- SceUdcdEndpointDescriptor *endpoint_descriptors; // r3@15
- SceUdcdEndpointDescriptor *endpoint_ptr; // r3@17
- signed int wMaxPacketSize; // r1@18
- int bmAttributes; // r2@18
- int bLength; // t1@25
- SceUdcdDeviceDescriptor *device_descriptor_hi; // r3@26
- SceUdcdConfiguration *configuration_hi; // r4@27
- int result; // r0@29
- SceUdcdConfigDescriptor *config_descriptors_hi; // r3@31
- SceUdcdInterfaceSettings *interface_settings_hi; // r2@32
- int bNumInterfaces_hi; // r0@33
- int cnt_hi; // r3@35
- SceUdcdEndpointDescriptor *endpoint_descriptors_hi; // r3@39
- SceUdcdEndpointDescriptor *endpoint_ptr_hi; // r3@41
- signed int wMaxPacketSize_hi; // r1@41
- int bmAttributes_hi; // r2@41
- int bLength_hi; // t1@45
- device_descriptor = driver->descriptor;
- if ( !device_descriptor )
- return 0x80243306;
- configuration = driver->configuration;
- if ( !configuration )
- return 0x80243306;
- bMaxPacketSize0 = device_descriptor->bMaxPacketSize0;
- if ( bMaxPacketSize0 != 0x10 )
- {
- if ( bMaxPacketSize0 <= 0x10 )
- {
- if ( bMaxPacketSize0 != 8 )
- return 0x80243301;
- }
- else if ( bMaxPacketSize0 != 0x20 && bMaxPacketSize0 != 0x40 )
- {
- return 0x80243301;
- }
- }
- config_descriptors = configuration->configDescriptors;
- if ( !configuration->configDescriptors )
- return 0x80243306;
- interface_settings = configuration->settings;
- if ( !interface_settings )
- return 0x80243306;
- bNumInterfaces = config_descriptors->bNumInterfaces;
- if ( config_descriptors->bNumInterfaces )
- {
- if ( (signed int)interface_settings->numDescriptors > 2 )
- return 0x80243303;
- cnt = 0;
- while ( 1 )
- {
- ++cnt;
- ++interface_settings;
- if ( bNumInterfaces <= cnt )
- break;
- if ( (signed int)interface_settings->numDescriptors > 2 )
- return 0x80243303;
- }
- }
- if ( !configuration->interfaceDescriptors )
- return 0x80243306;
- endpoint_descriptors = configuration->endpointDescriptors;
- if ( endpoint_descriptors && endpoint_descriptors->bLength )
- {
- endpoint_ptr = endpoint_descriptors + 1;
- do
- {
- wMaxPacketSize = endpoint_ptr[-1u].wMaxPacketSize;
- bmAttributes = endpoint_ptr[-1u].bmAttributes & 3;
- if ( bmAttributes != 2 )
- {
- if ( bmAttributes == 3 )
- {
- if ( wMaxPacketSize > 0x40 )
- return 0x80243305;
- goto LABEL_25;
- }
- if ( bmAttributes == 1 )
- {
- if ( wMaxPacketSize >= 0x400 )
- return 0x80243305;
- goto LABEL_25;
- }
- }
- if ( wMaxPacketSize != 0x10 )
- {
- if ( (unsigned int)wMaxPacketSize <= 0x10 )
- {
- if ( wMaxPacketSize != 8 )
- return 0x80243305;
- }
- else if ( wMaxPacketSize != 0x20 && wMaxPacketSize != 0x40 )
- {
- return 0x80243305;
- }
- }
- LABEL_25:
- bLength = endpoint_ptr->bLength;
- ++endpoint_ptr;
- }
- while ( bLength );
- }
- device_descriptor_hi = driver->descriptor_hi;
- if ( !device_descriptor_hi )
- {
- if ( driver->configuration_hi )
- result = 0x80243306;
- else
- result = 0;
- return result;
- }
- configuration_hi = driver->configuration_hi;
- if ( !configuration_hi )
- return 0x80243306;
- if ( (unsigned int)device_descriptor->bcdUSB < 0x200 )
- return 0;
- if ( device_descriptor_hi->bMaxPacketSize0 != 0x40 )
- return 0x80243301;
- config_descriptors_hi = configuration_hi->configDescriptors;
- if ( !configuration_hi->configDescriptors )
- return 0x80243306;
- interface_settings_hi = configuration_hi->settings;
- if ( !interface_settings_hi )
- return 0x80243306;
- bNumInterfaces_hi = config_descriptors_hi->bNumInterfaces;
- if ( config_descriptors_hi->bNumInterfaces )
- {
- if ( (signed int)interface_settings_hi->numDescriptors <= 2 )
- {
- cnt_hi = 0;
- while ( 1 )
- {
- ++cnt_hi;
- ++interface_settings_hi;
- if ( cnt_hi >= bNumInterfaces_hi )
- break;
- if ( (signed int)interface_settings_hi->numDescriptors > 2 )
- return 0x80243303;
- }
- goto LABEL_38;
- }
- return 0x80243303;
- }
- LABEL_38:
- if ( !configuration_hi->interfaceDescriptors )
- return 0x80243306;
- endpoint_descriptors_hi = configuration_hi->endpointDescriptors;
- result = (int)endpoint_descriptors_hi;
- if ( endpoint_descriptors_hi )
- {
- result = endpoint_descriptors_hi->bLength;
- if ( endpoint_descriptors_hi->bLength )
- {
- endpoint_ptr_hi = endpoint_descriptors_hi + 1;
- wMaxPacketSize_hi = endpoint_ptr_hi[-1u].wMaxPacketSize;
- bmAttributes_hi = endpoint_ptr_hi[-1u].bmAttributes & 3;
- if ( bmAttributes_hi == 2 )
- goto LABEL_47;
- LABEL_42:
- if ( bmAttributes_hi != 3 && bmAttributes_hi != 1 )
- {
- if ( wMaxPacketSize_hi == 0x40 )
- goto LABEL_45;
- return 0x80243305;
- }
- if ( wMaxPacketSize_hi > 0x400 )
- return 0x80243305;
- LABEL_45:
- while ( 1 )
- {
- bLength_hi = endpoint_ptr_hi->bLength;
- ++endpoint_ptr_hi;
- result = bLength_hi;
- if ( !bLength_hi )
- break;
- wMaxPacketSize_hi = endpoint_ptr_hi[-1u].wMaxPacketSize;
- bmAttributes_hi = endpoint_ptr_hi[-1u].bmAttributes & 3;
- if ( bmAttributes_hi != 2 )
- goto LABEL_42;
- LABEL_47:
- if ( wMaxPacketSize_hi != 0x200 )
- return 0x80243305;
- }
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement