Skip to content

Commit ed0941f

Browse files
committed
Add 'PIII Converter Model: 538' PS2toPC support
1 parent ffda761 commit ed0941f

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#ifndef __DINPUT_P3CONVERTER_H__
2+
#define __DINPUT_P3CONVERTER_H__
3+
#include <psp2kern/ctrl.h>
4+
#include "dpad_angle.h"
5+
6+
uint8_t p3converter_processReport(Controller *c, size_t length)
7+
{
8+
process_dpad_angle(c, 5);
9+
10+
if (bit(c->buffer + 5, 6))
11+
c->controlData.buttons |= SCE_CTRL_CROSS;
12+
if (bit(c->buffer + 5, 5))
13+
c->controlData.buttons |= SCE_CTRL_CIRCLE;
14+
if (bit(c->buffer + 5, 4))
15+
c->controlData.buttons |= SCE_CTRL_TRIANGLE;
16+
if (bit(c->buffer + 5, 7))
17+
c->controlData.buttons |= SCE_CTRL_SQUARE;
18+
19+
20+
21+
if (bit(c->buffer + 6, 2))
22+
c->controlData.buttons |= SCE_CTRL_L1;
23+
if (bit(c->buffer + 6, 3))
24+
c->controlData.buttons |= SCE_CTRL_R1;
25+
if (bit(c->buffer + 6, 6))
26+
c->controlData.buttons |= SCE_CTRL_L3;
27+
if (bit(c->buffer + 6, 7))
28+
c->controlData.buttons |= SCE_CTRL_R3;
29+
30+
if (bit(c->buffer + 6, 0))
31+
{
32+
c->controlData.buttons |= SCE_CTRL_LTRIGGER;
33+
c->controlData.lt = 0xFF;
34+
}
35+
36+
if (bit(c->buffer + 6, 1))
37+
{
38+
c->controlData.buttons |= SCE_CTRL_RTRIGGER;
39+
c->controlData.rt = 0xFF;
40+
}
41+
42+
if (bit(c->buffer + 6, 5))
43+
c->controlData.buttons |= SCE_CTRL_START;
44+
if (bit(c->buffer + 6, 4))
45+
c->controlData.buttons |= SCE_CTRL_SELECT;
46+
47+
if (bit(c->buffer + 6, 2) && bit(c->buffer + 6, 3) && bit(c->buffer + 6, 5)) // L+R+START combo
48+
{
49+
c->controlData.buttons |= SCE_CTRL_PSBUTTON;
50+
c->controlData.buttons &= ~SCE_CTRL_START;
51+
}
52+
53+
c->controlData.leftX = c->buffer[2];
54+
c->controlData.leftY = c->buffer[3];
55+
c->controlData.rightX = c->buffer[0];
56+
c->controlData.rightY = c->buffer[1];
57+
return 1;
58+
}
59+
60+
#endif

src/controllers/dinput_controller.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "dinput/psclassic.h"
1111
#include "dinput/horidiva.h"
1212
#include "dinput/raphnetpsx.h"
13+
#include "dinput/p3converter.h"
1314

1415
uint8_t DinputController_probe(Controller *c, int device_id, int port, int vendor, int product)
1516
{
@@ -117,6 +118,10 @@ uint8_t DinputController_processReport(Controller *c, size_t length)
117118
{
118119
return raphnetpsx_processReport(c, length);
119120
}
121+
else if (c->vendor == 0x0e8f && c->product == 0x0003) // PIII Converter Model: 538
122+
{
123+
return p3converter_processReport(c, length);
124+
}
120125
else
121126
{
122127
return 0;

src/devicelist.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,6 @@ gamepad_t _devices[] = {{PAD_XBOX360, 0x045e, 0x028e}, // Microsoft X-Box 360 p
108108
{PAD_DINPUT, 0x054c, 0x0cda}, // Playstation Classic
109109
{PAD_DINPUT, 0x0f0d, 0x0049}, // Hori ps3 mini diva
110110
{PAD_DINPUT, 0x289b, 0x0044}, // Raphnet Technologies PSX to USB v.1.0
111+
{PAD_DINPUT, 0x0e8f, 0x0003}, // PIII Converter Model: 538
111112

112113
{PAD_UNKNOWN, 0x0000, 0x0000}}; // Null

0 commit comments

Comments
 (0)