XInput Wrapper for DS3 and Play.com USB Dual DS2 Controller
(05-02-2014, 11:15 PM)roninx Wrote: What driver version are you using?

USB\VID_0A12&PID_0001. Is this what you are asking? Is on the list.

Is a generic Bluetooth USB dongle 2.0.

Sponsored links

(05-02-2014, 11:33 PM)Danat Wrote: No. Aren't L3 and R3 buttons ? I need pressure sensitive triggers that would work like pedals. Mapping R2 to R3 would just make it a button, no ?
Just in case - I need to use analog sticks as well for that game (left stick to look around and right stick to steer the wheel).

But anyways, I've just managed to modify the source code so that R2 maps to another joystick's R2 (the Reserved one) and now I can use both triggers without sacrificing anything. It is at moments like these it feels good to be a programmer Wink.

If someone needs this stuff I made, I can post some code samples that need to be inserted in original source.

Yea I know L3 and R3 are buttons. I thought it would have been better than nothing. Please post the samples of the changes you made. I'm sure it'll help others. In fact, I'm having trouble with JoyToKey because it doesn't recognize the L2 and R2 triggers. Maybe your modifications could solve my problem. Although I don't see a Game Controller icon in my Control Panel.

edit: nevermind the Xbox 360 Controller icon is in Devices and Printers but I still only see one icon.




(05-02-2014, 11:42 PM)CarloxTheBoy Wrote: USB\VID_0A12&PID_0001. Is this what you are asking? Is on the list.

Is a generic Bluetooth USB dongle 2.0.

No I mean what SCP driver are you using? Did you install 1.2.0.160 and then update with 1.2.2.175?
Quote:Please post the samples of the changes you made. I'm sure it'll help others.
I've opened the sln file in VS2010. Then I did this...

ScpControl_2010/UsbHub.cs
Code:
public partial class UsbHub : ScpHub
    {
        public static UsbDevice[] GlobalDevice = null;

        protected UsbDevice[] Device = new UsbDevice[4];                

        public UsbHub()
        {
            InitializeComponent();

            if (GlobalDevice == null)
                GlobalDevice = Device;
        }
Explanation: added a static variable that will hold reference to all 4 usb devices. I do that because otherwise I can't reach that array where I need it.

ScpControl_2010/ScpUtil.cs
Code:
public class Ds3InputHelper
    {
        public static byte GetAxisValue(byte[] Input, Ds3Axis Axis)
        {
            return Input[(UInt32)Axis];
        }

        public static void SetAxisValue(byte[] Input, Ds3Axis Axis, byte Value)
        {
            Input[(UInt32)Axis] = Value;
        }

        public static Ds3Button GetButtons(byte[] Input)
        {
            return (Ds3Button)((Input[10] << 0) | (Input[11] << 8) | (Input[12] << 16) | (Input[13] << 24));
        }

        public static void SetButtons(byte[] Input, Ds3Button Buttons)
        {
            Input[10] = (byte)(Buttons);
            Input[11] = (byte)((int)Buttons >> 8);
            Input[12] = (byte)((int)Buttons >> 16);
            Input[13] = (byte)((int)Buttons >> 24);            
        }
    }
Explanation: Added a helper class so that I can easily modify button/trigger states.

ScpControl_2010/UsbDevice.cs
Code:
protected virtual void Publish()
        {
            m_ReportArgs.Report[0] = m_ControllerId;
            m_ReportArgs.Report[1] = (Byte) m_State;

            Ds3Button Buttons = Ds3InputHelper.GetButtons(m_ReportArgs.Report);
            byte R2Value = Ds3InputHelper.GetAxisValue(m_ReportArgs.Report, Ds3Axis.R2);

            Ds3InputHelper.SetButtons(m_ReportArgs.Report, Buttons & ~Ds3Button.R2);
            Ds3InputHelper.SetAxisValue(m_ReportArgs.Report, Ds3Axis.R2, 0);

            if (Report != null) Report(this, m_ReportArgs);

            foreach (UsbDevice device in UsbHub.GlobalDevice)
            {
                if (device.State == DsState.Reserved)
                {
                    m_ReportArgs.Report[0] = device.m_ControllerId;
                    m_ReportArgs.Report[1] = (Byte)m_State;

                    Ds3InputHelper.SetButtons(m_ReportArgs.Report, Buttons & Ds3Button.R2);
                    Ds3InputHelper.SetAxisValue(m_ReportArgs.Report, Ds3Axis.L2, 0);                    
                    Ds3InputHelper.SetAxisValue(m_ReportArgs.Report, Ds3Axis.R2, R2Value);
                    Ds3InputHelper.SetAxisValue(m_ReportArgs.Report, Ds3Axis.LX, 0);
                    Ds3InputHelper.SetAxisValue(m_ReportArgs.Report, Ds3Axis.LY, 0);
                    Ds3InputHelper.SetAxisValue(m_ReportArgs.Report, Ds3Axis.RX, 0);
                    Ds3InputHelper.SetAxisValue(m_ReportArgs.Report, Ds3Axis.RY, 0);

                    if (Report != null) Report(this, m_ReportArgs);

                    break;
                }
            }          
        }
Explanation: Modified Publish() method so that when R2 is pressed, it's value and button state are set to zero for real joystick and then the actual value is used for the second joystick. Note that I also zero all irrelevant axis values for the second joystick.

Oh and by the way in order to have two XBOX gamepads in Control Panel -> Game Controllers I needed to unplug my DS3 controller and plug it in again. When it is unplugged, the xbox gamepad icon remains, but when I plug the controller back in, the second icon appears. Once you stop/restart the ScpService service, you need to repeat this procedure again (plug DS3, unplug, plug)
Just in case - I'm using Windows XP SP3.
EDIT: Fixed some bugs in my third code sample.
EDIT: Fixed another bug in third code sample. Things look stable now.

I've attached the binary and source files of this mod. The package also contains some explanations on how to use.


Attached Files
.zip   SCP-DS-Driver-1.2.2.175-Mod-SeparateTriggers.zip (Size: 1,83 MB / Downloads: 357)
(05-02-2014, 11:43 PM)roninx Wrote: No I mean what SCP driver are you using? Did you install 1.2.0.160 and then update with 1.2.2.175?

I have installed 1.2.0.160, but i don't updated to 1.2.2.175. I gonna update this now.

EDIT: I uninstalled 1.2.0.160, updated to 1.2.2.175 and reinstalled SCP Server with force install. bluetooth still not working.
I am also currently having a problem with my DS3 over bluetooth. It works fine plugged in, but no long works over my bluetooth connection (it stopped for no reason). When I remove the USB plug, SCP Monitor displays it as BTH 00000000 None. I don't know why this suddenly stopped working, and why nothing seems to fix it. I uninstalled the drivers from the wrapper, as well as all of the bluetooth drivers for my dongle and any drivers installed by Windows 8 for my controller. Short of a disc wipe, I don't know what else I could possibly remove.
(05-03-2014, 12:14 AM)CarloxTheBoy Wrote: I have installed 1.2.0.160, but i don't updated to 1.2.2.175. I gonna update this now.

EDIT: I uninstalled 1.2.0.160, updated to 1.2.2.175 and reinstalled SCP Server with force install. bluetooth still not working.


I don't know what else to think of. I had the same problem as you before, with my DS3 controller not working through bluetooth. I uninstalled SCP drivers, then plugged in my usb bluetooth controller, connected my DS3 controller through usb, then force installed SCP driver 1.2.0.160, and then updated with latest drivers and it worked.

After you install the SCP drivers do you see all 5 entries in the Install Summary like in the screenshot: http://forums.pcsx2.net/attachment.php?aid=47326
(05-03-2014, 12:08 AM)Danat Wrote: I've opened the sln file in VS2010. Then I did this...

Thanks for the code. Unfortunately I don't have VS2010 so I can't open the .sln file. Maybe the author can incorporate this into the next update.
(05-01-2014, 03:54 PM)jesalvein Wrote: why would we. after dozens of users using it without reporting any problem, it's easy to guess it's a false positive

I do not intend to sound sarcastic but isn't that the very definition of a trojan? Just being concerned about my computer security that's all.
@MCZ: from your report link -

- 1 positive [TrendMicro-HouseCall]
- 37 negative [TrendMicro, Malwarebytes, McAfee, Symantec, etc ...]

Tends to suggest a false positive?
(05-02-2014, 11:43 PM)roninx Wrote: In fact, I'm having trouble with JoyToKey because it doesn't recognize the L2 and R2 triggers. Maybe your modifications could solve my problem. Although I don't see a Game Controller icon in my Control Panel.

To get the triggers R2 and L2 working in JoytoKey without mapping the triggers to buttons is easy, first go to the JoytoKey preferences and make sure "Use Axes other than X and Y" is checked, then go back to the joystick profile and:
Axes3(<0) is R2
Axes3(>0) is L2

best regards,
- dink




Users browsing this thread: 10 Guest(s)