Home

Awesome

PS4 Remote Play Interceptor

nuget NuGet Donate Twitter

A small .NET library to intercept controls on PS4 Remote Play for Windows, powered by EasyHook. The library can be used to automate any PS4 game. See the prototype demo.

Also check out PS4 Macro repository for a ready-to-use software built on this library.

Install

Using NuGet (Recommended)

Install-Package PS4RemotePlayInterceptor

From Source

Add reference to PS4RemotePlayInterceptor.dll.

Example Usage

This console application will hold the X button while moving the left analog stick upwards until interrupted by a keypress.

You can set EmulateController to true to use the library without a DualShock 4 controller plugged in (the real controller must be unplugged).

using PS4RemotePlayInterceptor;

class Program
{
    static void Main(string[] args)
    {
        // Setup callback to interceptor
        Interceptor.Callback = new InterceptionDelegate(OnReceiveData);
        // Emulate controller (BETA)
        Interceptor.EmulateController = false;

        // Start watchdog to automatically inject when possible
        Interceptor.Watchdog.Start();
        // Notify watchdog events
        Interceptor.Watchdog.OnInjectionSuccess = () => Console.WriteLine("Watchdog OnInjectionSuccess");
        Interceptor.Watchdog.OnInjectionFailure = () => Console.WriteLine("Watchdog OnInjectionFailure");

        // Or inject manually and handle exceptions yourself
        //Interceptor.Inject();

        Console.WriteLine("-- Press any key to exit");
        Console.ReadKey();
    }

    private static void OnReceiveData(ref DualShockState state)
    {
        /* -- Modify the controller state here -- */

        // Force press X
        state.Cross = true;

        // Force left analog upwards
        state.LY = 0;

        // Force left analog downwards
        // state.LY = 255;

        // Force left analog to center
        // state.LX = 128;
        // state.LY = 128;
    }
}

To-Do List

Troubleshoot

SOLUTION: Restart PS4 Remote Play.

SOLUTION: Inject with Compatibility mode instead

// Setup callback to interceptor
Interceptor.Callback = new InterceptionDelegate(OnReceiveData);

// Inject
Interceptor.InjectionMode = InjectionMode.Compatibility;
Interceptor.Inject();

Credits