Skip to content

Commit

Permalink
Add 'PIII Converter Model: 538' PS2toPC support
Browse files Browse the repository at this point in the history
  • Loading branch information
isage committed Apr 13, 2023
1 parent ffda761 commit ed0941f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/controllers/dinput/p3converter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#ifndef __DINPUT_P3CONVERTER_H__
#define __DINPUT_P3CONVERTER_H__
#include <psp2kern/ctrl.h>
#include "dpad_angle.h"

uint8_t p3converter_processReport(Controller *c, size_t length)
{
process_dpad_angle(c, 5);

if (bit(c->buffer + 5, 6))
c->controlData.buttons |= SCE_CTRL_CROSS;
if (bit(c->buffer + 5, 5))
c->controlData.buttons |= SCE_CTRL_CIRCLE;
if (bit(c->buffer + 5, 4))
c->controlData.buttons |= SCE_CTRL_TRIANGLE;
if (bit(c->buffer + 5, 7))
c->controlData.buttons |= SCE_CTRL_SQUARE;



if (bit(c->buffer + 6, 2))
c->controlData.buttons |= SCE_CTRL_L1;
if (bit(c->buffer + 6, 3))
c->controlData.buttons |= SCE_CTRL_R1;
if (bit(c->buffer + 6, 6))
c->controlData.buttons |= SCE_CTRL_L3;
if (bit(c->buffer + 6, 7))
c->controlData.buttons |= SCE_CTRL_R3;

if (bit(c->buffer + 6, 0))
{
c->controlData.buttons |= SCE_CTRL_LTRIGGER;
c->controlData.lt = 0xFF;
}

if (bit(c->buffer + 6, 1))
{
c->controlData.buttons |= SCE_CTRL_RTRIGGER;
c->controlData.rt = 0xFF;
}

if (bit(c->buffer + 6, 5))
c->controlData.buttons |= SCE_CTRL_START;
if (bit(c->buffer + 6, 4))
c->controlData.buttons |= SCE_CTRL_SELECT;

if (bit(c->buffer + 6, 2) && bit(c->buffer + 6, 3) && bit(c->buffer + 6, 5)) // L+R+START combo
{
c->controlData.buttons |= SCE_CTRL_PSBUTTON;
c->controlData.buttons &= ~SCE_CTRL_START;
}

c->controlData.leftX = c->buffer[2];
c->controlData.leftY = c->buffer[3];
c->controlData.rightX = c->buffer[0];
c->controlData.rightY = c->buffer[1];
return 1;
}

#endif
5 changes: 5 additions & 0 deletions src/controllers/dinput_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "dinput/psclassic.h"
#include "dinput/horidiva.h"
#include "dinput/raphnetpsx.h"
#include "dinput/p3converter.h"

uint8_t DinputController_probe(Controller *c, int device_id, int port, int vendor, int product)
{
Expand Down Expand Up @@ -117,6 +118,10 @@ uint8_t DinputController_processReport(Controller *c, size_t length)
{
return raphnetpsx_processReport(c, length);
}
else if (c->vendor == 0x0e8f && c->product == 0x0003) // PIII Converter Model: 538
{
return p3converter_processReport(c, length);
}
else
{
return 0;
Expand Down
1 change: 1 addition & 0 deletions src/devicelist.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,6 @@ gamepad_t _devices[] = {{PAD_XBOX360, 0x045e, 0x028e}, // Microsoft X-Box 360 p
{PAD_DINPUT, 0x054c, 0x0cda}, // Playstation Classic
{PAD_DINPUT, 0x0f0d, 0x0049}, // Hori ps3 mini diva
{PAD_DINPUT, 0x289b, 0x0044}, // Raphnet Technologies PSX to USB v.1.0
{PAD_DINPUT, 0x0e8f, 0x0003}, // PIII Converter Model: 538

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

0 comments on commit ed0941f

Please sign in to comment.