PS2 games.

Discuss everything to do with GIMX here
nadchu
Posts: 4
Joined: Mon Dec 16, 2019 10:43 am

Re: PS2 games.

Post by nadchu »

Hi all,

I know I'm replying to very old post, but I recently figured out how to make controllers work on PS2 emu (on PS3). Let me share my knowledge.
I used BeagleBoard-xM to analyze "hori real arcade pro v3" - an officially licensed and simple controller.

It worked well on PS2 emu and I didn't find any special packets (magic packets) passing through.
Then I noticed that PS3 is checking controllers' device descriptors and/or configuration descriptors. Unless they are in PS3's whitelist, PS3 does not start polling for hid report (even if the report descriptor of a controller is same as that of dualshock3).

Here I attach descriptors. It will work on PS3 with latest firmware.
Note that only first 3 bytes in hid reports are significant (Button_states_byte1, Button_states_byte2 and POV. details below) and following 24 bytes are fixed (128,128,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,2,0,2).

Assignment of keys (low bit first)
Button_states_byte1: Square, Cross, Circle, Triangle, L1, R1, L2, R2
Button_states_byte2: SELECT, START, L3, R3, PS, -, -, -
POV: 0x00=up 0x01=up-right 0x02=right 0x03=right-down 0x04=down 0x05=left-down 0x06=left 0x07=left-up 0x0f=none

Code: Select all

Device Descriptor:
    18,                // bLength
    1,                 // bDescriptorType
    0x00, 0x02,        // bcdUSB
    0,                 // bDeviceClass
    0,                 // bDeviceSubClass
    0,                 // bDeviceProtocol
    64,                // bMaxPacketSize0
    0x0d,              // idVendor[0]
    0x0f,              // idVendor[1]
    0x22,              // idProduct[0]
    0x00,              // idProduct[1]
    0x00, 0x10,        // bcdDevice (=version number)
    1,                 // iManufacturer
    2,                 // iProduct
    0,                 // iSerialNumber
    1                  // bNumConfigurations (this source does not support composite device)

Code: Select all

Configuration Descriptor:
    9,                              // bLength;
    2,                              // bDescriptorType;
    0x29,
    0x00,                           // wTotalLength
    1,                              // bNumInterfaces
    1,                              // bConfigurationValue
    0,                              // iConfiguration
    0x80,                           // bmAttributes
    50,                             // bMaxPower
    // interface descriptor
    9,                              // bLength
    4,                              // bDescriptorType
    0,                              // bInterfaceNumber
    0,                              // bAlternateSetting
    2,                              // bNumEndpoints
    0x03,                           // bInterfaceClass (0x03 = HID)
    0x00,                           // bInterfaceSubClass (0x00 = No Boot)
    0x00,                           // bInterfaceProtocol (0x00 = No Protocol)
    0,                              // iInterface
    // HID interface descriptor
    9,                              // bLength
    0x21,                           // bDescriptorType
    0x11, 0x01,                     // bcdHID
    0,                              // bCountryCode
    1,                              // bNumDescriptors
    0x22,                           // bDescriptorType
    0x89,
    0x00,                           // wDescriptorLength
    // endpoint descriptor
    7,                              // bLength
    5,                              // bDescriptorType
    2,                              // bEndpointAddress (ep2,out)
    0x03,                           // bmAttributes (0x03=intr)
    64, 0,                          // wMaxPacketSize
    10,                              // bInterval
    // endpoint descriptor
    7,                              // bLength
    5,                              // bDescriptorType
    0x81,                           // bEndpointAddress (ep1,in)
    0x03,                           // bmAttributes (0x03=intr)
    64, 0,                          // wMaxPacketSize
    10                              // bInterval

Code: Select all

Report Descriptor:
    0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
    0x09, 0x05,        // Usage (Game Pad)
    0xA1, 0x01,        // Collection (Application)
    0x15, 0x00,        //   Logical Minimum (0)
    0x25, 0x01,        //   Logical Maximum (1)
    0x35, 0x00,        //   Physical Minimum (0)
    0x45, 0x01,        //   Physical Maximum (1)
    0x75, 0x01,        //   Report Size (1)
    0x95, 0x0D,        //   Report Count (13)
    0x05, 0x09,        //   Usage Page (Button)
    0x19, 0x01,        //   Usage Minimum (0x01)
    0x29, 0x0D,        //   Usage Maximum (0x0D)
    0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0x95, 0x03,        //   Report Count (3)
    0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0x05, 0x01,        //   Usage Page (Generic Desktop Ctrls)
    0x25, 0x07,        //   Logical Maximum (7)
    0x46, 0x3B, 0x01,  //   Physical Maximum (315)
    0x75, 0x04,        //   Report Size (4)
    0x95, 0x01,        //   Report Count (1)
    0x65, 0x14,        //   Unit (System: English Rotation, Length: Centimeter)
    0x09, 0x39,        //   Usage (Hat switch)
    0x81, 0x42,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)
    0x65, 0x00,        //   Unit (None)
    0x95, 0x01,        //   Report Count (1)
    0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0x26, 0xFF, 0x00,  //   Logical Maximum (255)
    0x46, 0xFF, 0x00,  //   Physical Maximum (255)
    0x09, 0x30,        //   Usage (X)
    0x09, 0x31,        //   Usage (Y)
    0x09, 0x32,        //   Usage (Z)
    0x09, 0x35,        //   Usage (Rz)
    0x75, 0x08,        //   Report Size (8)
    0x95, 0x04,        //   Report Count (4)
    0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)
    0x09, 0x20,        //   Usage (0x20)
    0x09, 0x21,        //   Usage (0x21)
    0x09, 0x22,        //   Usage (0x22)
    0x09, 0x23,        //   Usage (0x23)
    0x09, 0x24,        //   Usage (0x24)
    0x09, 0x25,        //   Usage (0x25)
    0x09, 0x26,        //   Usage (0x26)
    0x09, 0x27,        //   Usage (0x27)
    0x09, 0x28,        //   Usage (0x28)
    0x09, 0x29,        //   Usage (0x29)
    0x09, 0x2A,        //   Usage (0x2A)
    0x09, 0x2B,        //   Usage (0x2B)
    0x95, 0x0C,        //   Report Count (12)
    0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0x0A, 0x21, 0x26,  //   Usage (0x2621)
    0x95, 0x08,        //   Report Count (8)
    0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
    0x0A, 0x21, 0x26,  //   Usage (0x2621)
    0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
    0x26, 0xFF, 0x03,  //   Logical Maximum (1023)
    0x46, 0xFF, 0x03,  //   Physical Maximum (1023)
    0x09, 0x2C,        //   Usage (0x2C)
    0x09, 0x2D,        //   Usage (0x2D)
    0x09, 0x2E,        //   Usage (0x2E)
    0x09, 0x2F,        //   Usage (0x2F)
    0x75, 0x10,        //   Report Size (16)
    0x95, 0x04,        //   Report Count (4)
    0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0xC0               // End Collection
 
Last edited by nadchu on Wed May 27, 2020 7:37 pm, edited 1 time in total.

User avatar
Matlo
Posts: 5680
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: PS2 games.

Post by Matlo »

Thanks for sharing this. Could you please check if GIMX 8.0 still has the same issue with PS2 emu on PS3? It contains an updated EMUPS3 firmware.
GIMX creator Donate Shop

nadchu
Posts: 4
Joined: Mon Dec 16, 2019 10:43 am

Re: PS2 games.

Post by nadchu »

Matlo,
I didn't see your message, sorry. I will check it within a day or two.

nadchu
Posts: 4
Joined: Mon Dec 16, 2019 10:43 am

Re: PS2 games.

Post by nadchu »

I used Dualshock 4 with GIMX 8.0 + up-to-date EMUPS3. (.hex file is automatically updated while updating GIMX to ver 8.0, right?)
It worked on the home screen. All buttons including PS button was functioning.
However, after launching a PS2 game, the controller was automatically detached (it is normal. you usually need to press PS button again to reconnect) and the controller did not work any longer. I closed the GIMX session and reconnect the controller, but nothing happened.
I shall be happy if it can be of any help.

User avatar
Matlo
Posts: 5680
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: PS2 games.

Post by Matlo »

Thanks for the feedback. Could you please generate debug log files with "controller" and "usb_con" enabled? One before starting the game, and one after.
GIMX creator Donate Shop

nadchu
Posts: 4
Joined: Mon Dec 16, 2019 10:43 am

Re: PS2 games.

Post by nadchu »

I took logs for following 4 cases.

1. Before starting games (at home screen), I started and ended GIMX.
2. After starting the PS2 game (beatmania IIDX 16 EMPRESS), I started and ended GIMX.
3. At home screen, I started GIMX. Then I started the PS2 game (by sending "Circle" keystroke using GIMX) and ended GIMX.
4. After starting the PS2 game, I started GIMX. After quit the game (this operation was done by another DUALSHOCK3 controller), I ended GIMX.

Case 1 : https://pastebin.com/8UgF2kaA
Case 2 : https://pastebin.com/V4HJu6fv
Case 3 : https://pastebin.com/PTcrsVxH
Case 4 : https://pastebin.com/14FpkF9u

In case 1 and first half of case 3, the controller was working (only at home screen). In other parts, I could not see any response on screen although keystrokes were dumped.
Just in case I masked the username. 「アクセスが拒否されました。」means "access denied".
I used an adapter made of FT232RL (http://akizukidenshi.com/catalog/g/gK-01977/) + Arduino Micro.
Please let me know if you need further information.

User avatar
Matlo
Posts: 5680
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: PS2 games.

Post by Matlo »

Sadly the logs you provided don't have the debug flags "controller" and "usb_con" enabled. Make sure to select "debug" in the "Messages" drop-down menu.
GIMX creator Donate Shop

Post Reply