Skip to content

Added rumble to Gamecube Adapter PC_Mode#15431

Open
replicacoil wants to merge 1 commit intolibsdl-org:mainfrom
replicacoil:main
Open

Added rumble to Gamecube Adapter PC_Mode#15431
replicacoil wants to merge 1 commit intolibsdl-org:mainfrom
replicacoil:main

Conversation

@replicacoil
Copy link
Copy Markdown

@replicacoil replicacoil commented Apr 21, 2026

  • I confirm that I am the author of this code and release it to the SDL project under the Zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant