ScpToolkit retrieving rumble values



  • Originally posted by Deathwalker9959


    I’ve seen your project ScpToolkit and I was looking around the source and all and I have a question.

    I’m trying to retrieve the rumble motor speed values but I cant seem to find some kind of a function so far I have found this but I don’t think its what I’m looking for.

    What im trying to achieve is to send those values off to the arduino for having force feedback pedals etc

    public override bool Rumble(byte large, byte small)
            {
                lock (_hidReport)
                {
                    var transfered = 0;
     
                    if (GlobalConfiguration.Instance.DisableRumble)
                    {
                        _hidReport[2] = 0;
                        _hidReport[4] = 0;
                    }
                    else
                    {
                        _hidReport[2] = (byte)(small > 0 ? 0x01 : 0x00);
                        _hidReport[4] = large;
                    }
     
                    _hidReport[9] = _ledStatus;
     
                    // TODO: this is a blocking call in a locked region, fix
                    return SendTransfer(UsbHidRequestType.HostToDevice, UsbHidRequest.SetReport,
                        ToValue(UsbHidReportRequestType.Output, UsbHidReportRequestId.One),
                        _hidReport, ref transfered);
                }
            }
    


  • Originally posted by nefarius


    Hey,

    This function get's called when a game/process sends a vibration request to the virtual x360 pad, translates it into "DS3-format" and sends it to the DS3/4.

    What exactly are you setting up with Arduino? It doesn't sound to me that you need the full toolkit stack from what I read.



  • Originally posted by Deathwalker9959


    Basically i'm trying to get the values that the game/process sends and have them sent over to the arduino via serial comm.
    Now from the arduino those values will be parsed onto digital pwm pins onto external rumble motors that you can attach wherever you feel like.



  • Originally posted by nefarius


    Sounds like a job for ViGEm or an API-hook. ScpToolkit would be an absolute overkill for this.



  • Originally posted by Deathwalker9959


    Well i had also found this that i may could have used to retrieve the rumble values but i'm not sure can you confirm on this?

    DWORD XInputSetState(
      _In_    DWORD            dwUserIndex,
      _Inout_ XINPUT_VIBRATION *pVibration
    );
    
    DWORD XInputGetState(
      _In_  DWORD        dwUserIndex,
      _Out_ XINPUT_STATE *pState
    
    );
    
    
    


  • Originally posted by nefarius


    This function is used by the process to inform the XInput sub system to send the rumble requests to the physical pad. So in short: yes. If you are familiar with API hooking you can like inject a custom DLL in the target game/process, hook this function, copy values from \*pVibration parameter and use them for your purposes. Then you wouldn't even need additional drivers.



  • Originally posted by Deathwalker9959


    So in short term you're saying i can make a dll which i would inject to my target process that contained
    this function

    DWORD XInputSetState(
      _In_    DWORD            dwUserIndex,
      _Inout_ XINPUT_VIBRATION *pVibration
    );
    

    and then have them sent off to serial and etc



  • Originally posted by nefarius


    Not quite, no. Please lookup API hooking and DLL injection on your favorite search engine, there is tons of information already out there like this small excerpt.

    Good luck.



  • Originally posted by Deathwalker9959


    Thanks @nefarius hope to speak with you again



  • Originally posted by nefarius


    No problem.

    By the way I also have my own utility for injecting DLLs and a project which heavily utilizes API hooking on Windows.



  • Originally posted by evilC


    Ooh, I had not noticed Indicum Supra before. I previously looked at DX9-Overlay-API, but it is DX9 only.
    Is Indicum Supra for any version of DX?



  • Originally posted by nefarius


    @evilC yes, at least DX9, 10 and 11 is currently implemented. It's a tad out-of-date but I'm currently updating it.



  • Originally posted by evilC


    Awesome!
    Will give it a go at some point and see if I can get it to work from AHK.