Added rumble to Gamecube Adapter PC_Mode#15431
Open
replicacoil wants to merge 1 commit intolibsdl-org:mainfrom
Open
Added rumble to Gamecube Adapter PC_Mode#15431replicacoil wants to merge 1 commit intolibsdl-org:mainfrom
replicacoil wants to merge 1 commit intolibsdl-org:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added rumble to the gamecube adapter in PC_Mode.
Description
I added rumble to the mayflash gamecube adapter in PC_Mode for firmware of at least 0x7, it was tested on firmware 0x10 and on Windows 11. I have done this by adding a function called HIDAPI_DriverGameCube_SendPCRumble to send the packets to the queue. The packets are constructed with 3 values, first the index of 0x00 after that, 2 values of either 0x00 or 0xFF if rumble is off or on.
During UpdateDevice in PC_Mode, if the packet size equals 9, I enable the rumble functionality for the controllers as I did not find a way to make a tighter check, like if the second USB is connected or the device is a Wavebird controller. Should someone be able to test it on a device with a lower firmware than 0x7, this could be done at the initializing stage.
After that, in RumbleJoystick, in PC_Mode, I check if the rumble is allowed, if the useRumbleBreak flag has been set for coasting and then check if the controller should rumble. Should it be the case that it should coast, only the update flag will be set to false. If it should not coast, a check is made to see if the shouldrumble value is different then what the rumbleActive value is. If it is different, rumbleActive value will be updated and a rumblepacket will be send to the queue to update its status.
Since the motor needs constant packets to be send with rumble in order to keep it going a PC_RUMBLE_REFRESH has been made with a value of 16. During UpdateDevice, if the adapter is in PC_Mode, has active rumble and the last packet was send more than 16 ms ago, a new one will be queued.
In CloseJoystick, if in PC_Mode and with active rumble, I flip the rumbleActive flag and send a packet to the queue so it always stops rumbling when closing.
Existing Issue(s)