Well this might be a unsolvable issue.
But since the Sony dongle is detected as "controller 1"
There is no way to play games when the controller is charging by cable since it will be detected as "controller 2"
The only work around is to remove the Sony dongle while the controller is charging.
Maybe if there was a way to set what device is controller 1 and 2.
Or a way to hide the dongle temporary?
Hopefully there is a way to allow charging to work properly in more cases. As it is, charging will only work if the DS4 is synced to the dongle before starting DS4Windows. That is because the dongle will have an invalid serial associated with it until a controller is synced up. There is nothing in place to update the serial number associated with a controller in the code.
I think I might have found a way to detect a controller sync event with the Sony dongle. It looks like a byte in the input report does indicate whether a controller is synced up. Maybe an event can be created to change the serial associated with a device when a sync or disconnect event occurs.
With the latest changes, DS4Windows is able to detect when a controller syncs and disconnects from the Sony dongle. Charging a DS4 when it is synced to the Sony dongle now works.
As for disabling controllers entirely, that would be difficult with the current infrastructure. As it is now, the closest that you can do is to enable DInput Only mode for the Sony dongle before plugging in a controller via USB. You would probably be better off just removing the dongle if you want to play a game using a wired connection while it is charging.
"With the latest changes, DS4Windows is able to detect when a controller syncs and disconnects from the Sony dongle. Charging a DS4 when it is synced to the Sony dongle now works."
That's really nice!
Thanks for looking into this ;)