Skip to content

Commit

Permalink
Bugfix, do not send AT data to non ds controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
Electronicks committed Aug 13, 2021
1 parent 5a9d82a commit d405f01
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Nicolas also pushed some bugfixes
* Missing TOUCH_DEADZONE_INNER and TOUCH_RING_MODE commands
* Multiple sources of virtual controller stick and trigger inputs will add up instead of override.
* README didn't point to the official readme
* Don't send adaptive trigger data to non DS controllers... herp de derp


## 3.2.2
Expand Down
33 changes: 18 additions & 15 deletions JoyShockMapper/src/SDL2Wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,25 +187,28 @@ struct ControllerDevice
public:
void SendEffect()
{
DS5EffectsState_t effectPacket;
memset(&effectPacket, 0, sizeof(effectPacket));
if (_ctrlr_type == JS_TYPE_DS)
{
DS5EffectsState_t effectPacket;
memset(&effectPacket, 0, sizeof(effectPacket));

// Add adaptive trigger data
effectPacket.ucEnableBits1 |= 0x08 | 0x04; // Enable left and right trigger effect respectively
LoadTriggerEffect(effectPacket.rgucLeftTriggerEffect, &_leftTriggerEffect);
LoadTriggerEffect(effectPacket.rgucRightTriggerEffect, &_rightTriggerEffect);
// Add adaptive trigger data
effectPacket.ucEnableBits1 |= 0x08 | 0x04; // Enable left and right trigger effect respectively
LoadTriggerEffect(effectPacket.rgucLeftTriggerEffect, &_leftTriggerEffect);
LoadTriggerEffect(effectPacket.rgucRightTriggerEffect, &_rightTriggerEffect);

// Add current rumbling data
effectPacket.ucEnableBits1 |= 0x01 | 0x02;
effectPacket.ucRumbleLeft = _big_rumble >> 8;
effectPacket.ucRumbleRight = _small_rumble >> 8;
// Add current rumbling data
effectPacket.ucEnableBits1 |= 0x01 | 0x02;
effectPacket.ucRumbleLeft = _big_rumble >> 8;
effectPacket.ucRumbleRight = _small_rumble >> 8;

// Add current mic light
effectPacket.ucEnableBits2 |= 0x01; /* Enable microphone light */
effectPacket.ucMicLightMode = _micLight; /* Bitmask, 0x00 = off, 0x01 = solid, 0x02 = pulse */
// Add current mic light
effectPacket.ucEnableBits2 |= 0x01; /* Enable microphone light */
effectPacket.ucMicLightMode = _micLight; /* Bitmask, 0x00 = off, 0x01 = solid, 0x02 = pulse */

// Send to controller
SDL_GameControllerSendEffect(_sdlController, &effectPacket, sizeof(effectPacket));
// Send to controller
SDL_GameControllerSendEffect(_sdlController, &effectPacket, sizeof(effectPacket));
}
}

bool _has_gyro;
Expand Down

0 comments on commit d405f01

Please sign in to comment.