Skip to content

Commit

Permalink
Extend resetting adapter on exit to Xbox controller emulations #542
Browse files Browse the repository at this point in the history
  • Loading branch information
matlo committed Apr 14, 2018
1 parent ba77086 commit 7afb1e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 45 deletions.
60 changes: 17 additions & 43 deletions core/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,28 +658,9 @@ e_gimx_status adapter_detect()
case C_TYPE_T300RS_PS4:
case C_TYPE_G29_PS4:
case C_TYPE_G27_PS3:
if(status == BYTE_STATUS_STARTED)
{
if(adapter_send_reset(i) < 0)
{
gerror(_("failed to reset the GIMX adapter.\n"));
ret = E_GIMX_STATUS_GENERIC_ERROR;
}
else
{
ginfo(_("Reset sent to the GIMX adapter.\n"));
//Leave time for the adapter to reinitialize.
usleep(ADAPTER_RESET_TIME);
}
}
break;
case C_TYPE_XONE_PAD:
case C_TYPE_360_PAD:
if(status == BYTE_STATUS_SPOOFED)
{
adapter->status = 1;
}
else
if(status == BYTE_STATUS_STARTED)
{
if(adapter_send_reset(i) < 0)
{
Expand Down Expand Up @@ -709,28 +690,23 @@ e_gimx_status adapter_detect()
int usb_res = usb_init(i, adapter->ctype);
if(usb_res < 0)
{
if((adapter->ctype != C_TYPE_360_PAD
&& adapter->ctype != C_TYPE_XONE_PAD)
|| status != BYTE_STATUS_SPOOFED)
gerror(_("No game controller was found on USB ports.\n"));
switch(adapter->ctype)
{
gerror(_("No game controller was found on USB ports.\n"));
switch(adapter->ctype)
{
case C_TYPE_360_PAD:
ret = E_GIMX_STATUS_AUTH_MISSING_X360;
break;
case C_TYPE_DS4:
case C_TYPE_G29_PS4:
case C_TYPE_T300RS_PS4:
ret = E_GIMX_STATUS_AUTH_MISSING_PS4;
break;
case C_TYPE_XONE_PAD:
ret = E_GIMX_STATUS_AUTH_MISSING_XONE;
break;
default:
ret = E_GIMX_STATUS_GENERIC_ERROR;
break;
}
case C_TYPE_360_PAD:
ret = E_GIMX_STATUS_AUTH_MISSING_X360;
break;
case C_TYPE_DS4:
case C_TYPE_G29_PS4:
case C_TYPE_T300RS_PS4:
ret = E_GIMX_STATUS_AUTH_MISSING_PS4;
break;
case C_TYPE_XONE_PAD:
ret = E_GIMX_STATUS_AUTH_MISSING_XONE;
break;
default:
ret = E_GIMX_STATUS_GENERIC_ERROR;
break;
}
}
}
Expand Down Expand Up @@ -1191,8 +1167,6 @@ e_gimx_status adapter_clean()
{
case C_TYPE_360_PAD:
case C_TYPE_XONE_PAD:
usb_close(i);
break;
case C_TYPE_DS4:
case C_TYPE_T300RS_PS4:
case C_TYPE_G29_PS4:
Expand Down
2 changes: 0 additions & 2 deletions core/include/connectors/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ typedef struct GIMX_PACKED
#define BYTE_OUT_REPORT 0xee
#define BYTE_IN_REPORT 0xff

#define BYTE_STATUS_NSPOOFED 0x00
#define BYTE_STATUS_SPOOFED 0x01
#define BYTE_STATUS_NSTARTED 0x00
#define BYTE_STATUS_STARTED 0x01

Expand Down

0 comments on commit 7afb1e7

Please sign in to comment.