PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.28k stars 1.58k forks source link

[Feature Request]: Use DualSense's microphone LED as DualShock 2's analog LED #11553

Open WujekFoliarz opened 1 month ago

WujekFoliarz commented 1 month ago

Description

I would like to request a feature that utilizes the DualSense controller's microphone LED to mimic the functionality of the DualShock 2's analog LED. Specifically, the microphone LED on the DualSense should light up to indicate when the DualShock 2's analog mode is active in the emulator.

Reason

This feature would improve the user experience by providing a clear visual indication of the controller's mode, just like the original DualShock 2. If the DualSense has something similar, why not use it?

Examples

DS4Windows allows customization of the DualSense controller's microphone LED.

RedPanda4552 commented 1 month ago

Anyone know if this feature is exposed in SDL 2 or the upcoming SDL 3 version? Very unlikely that we would add controller-specific features like this unless SDL were there to frontend it for us (like it does for the existing Dualshock/Dualsense features).

Edit: Thinking about this more, it's possible the microphone LED is controlled at hardware level without software access, at which point not even SDL would have this capability. Would need to know more about if it is controllable at all, then if SDL has or plans to have support for controlling it.

WujekFoliarz commented 1 month ago

outReport[9] = (byte)micLed; //microphone led

WujekFoliarz commented 1 month ago
enum MicrophoneLED
{
    ON = 1,
    OFF = 0
}
WujekFoliarz commented 1 month ago

The microphone LED is easily accessible on software level, no clue if SDL supports it though

RedPanda4552 commented 1 month ago

I took a look and found some chatter about it on their Discourse, but have not yet found mention of it in documentation (maybe I just don't know where to look). I am adverse to adding controller-specific code to the input source handler in PCSX2, that is opening the floodgates for every niche controller-specific feature when we use SDL specifically to prevent that stuff from piling up in the code base and becoming a pile of maintenance headaches. If it looks viable via SDL then we can look into making a pipe between the emulated controller and the input source to transmit the analog light state, but without it being supported by SDL I don't think that's a brilliant road to go down.

WujekFoliarz commented 1 month ago
if (this.ConnectionType == ConnectionType.USB)
            {
                outReport[0] = 2;
                outReport[1] = (byte)rumbleMode;
                outReport[2] = 0x1 | 0x2 | 0x4 | 0x10 | 0x40;
                outReport[3] = (byte)RightRotor; // right low freq motor 0-255
                outReport[4] = (byte)LeftRotor; // left low freq motor 0-255
                outReport[5] = 0x7C; // <-- headset volume
                outReport[6] = (byte)SpeakerVolume; // <-- speaker volume
                outReport[7] = (byte)MicrophoneVolume; // <-- mic volume
                outReport[8] = 0x7C; // <-- no idea what that does
                outReport[9] = (byte)micLed; //microphone led 1 = on, 0 = off
                outReport[10] = (byte)microphoneStatus; // controls the microphone itself
                outReport[11] = (byte)RightTriggerMode;
                outReport[12] = (byte)RightTriggerForces[0];
                outReport[13] = (byte)RightTriggerForces[1];
                outReport[14] = (byte)RightTriggerForces[2];
                outReport[15] = (byte)RightTriggerForces[3];
                outReport[16] = (byte)RightTriggerForces[4];
                outReport[17] = (byte)RightTriggerForces[5];
                outReport[20] = (byte)RightTriggerForces[6];
                outReport[22] = (byte)LeftTriggerMode;
                outReport[23] = (byte)LeftTriggerForces[0];
                outReport[24] = (byte)LeftTriggerForces[1];
                outReport[25] = (byte)LeftTriggerForces[2];
                outReport[26] = (byte)LeftTriggerForces[3];
                outReport[27] = (byte)LeftTriggerForces[4];
                outReport[28] = (byte)LeftTriggerForces[5];
                outReport[31] = (byte)LeftTriggerForces[6];
                outReport[39] = (byte)Brightness.high;
                outReport[41] = (byte)Brightness.high;
                outReport[42] = (byte)micLedPulse;
                outReport[43] = (byte)Brightness.high; 
                outReport[44] = (byte)_playerLED; // the white leds below the touchpad
                outReport[45] = (byte)lightbar.R;
                outReport[46] = (byte)lightbar.G;
                outReport[47] = (byte)lightbar.B;
            }

Here's the whole thing (via USB), I understand if that's not practical, maybe they'll add it to SDL soon This C++ API also allows to control microphone LED - https://github.com/Ohjurot/DualSense-Windows