Category PS4 CFW and Hacks       Thread starter PSXHAX       Start date Mar 26, 2017 at 9:26 PM       3,488       2            
Recently developer Mystborn made available PS4Mono on Github, which is an open source DualShock 4 Library for using PS4 Controllers in MonoGame with details below. :)

This news comes following a DualShock 4 Windows Guide, DS4Windows App Revision, DS4 PS4 Firmware Dump & Reversing Tools and DS4Lib USB Linux Library update.

Download: PS4Mono-master.zip / PS4Mono GIT / MonoGame Latest Release / MonoGame GIT

From the ReadMe.md, to quote: PS4Mono

Library for using PS4 Controllers in Monogame

To initialize the controllers, go to your game's initialize method and add this code:
Code:
PS4Mono.InputManager.Initialize(this)
Then in your game's update method go ahead and add this at the end:
Code:
PS4Mono.InputManager.Update()
That's all it needs to be set up. To actually use the code, call one of the various GampadCheck functions.
Code:
bool down = PS4Mono.InputManager.GamepadCheck(0, Buttons.A);

bool justPressed = PS4Mono.InputManager.GamepadCheckPressed(0, Buttons.A);
There's a special version of this that doesn't work on a frame by frame basis, so if you want to only check the buttons being pressed at the exact moment of time of the function call use:
Code:
PS4Mono.InputManager.GamepadCheckAsync(0, Buttons.A);
To set the deadzone used to check if the joystick is being held in a specific direction, you can set this property to a value between 0 and 1.
Code:
PS4Mono.InputManager.GamepadAxisDeadZone = value;
The program only looks for new controllers every 2 seconds, so dont expect your game to react to new input immediately. You can change this in the source code inside the RawInputDeviceManager class if it's an issue. It's just an arbitrary number.

Big thanks to www.pinvoke.net and https://github.com/andyedinborough/aenetmail
PS4Mono DualShock 4 PS4 Controller Library for MonoGame by Mystborn.jpg
 

Comments

Recent Articles
PS4 Waker SmartThings App Device Handler by Xtreme22886
In line with the PS4 Alexa, PyWakePS4 on BlueTooth, PS4 Imagemap and IP-Symcon PS4 projects comes a PS4 Waker SmartThings App Device Handler used to control the PlayStation 4 power on / off and...
PS5 Pro Model a Possibility According to Sony VP Masayasu Ito
Earlier this week PlayStation CEO Jim Ryan stated that Sony Has No Interest in Another Handheld, and in a related interview Executive VP of SIE Hardware Engineering and Operation Masayasu Ito...
Mednafen PlayStation 4 Emulator v0.3 Config Mod Update via Markus95
Following the Mednafen PS4 2-Players Config Mod and his recent N64 PS2 on PS4 Port Demo, developer @Markus95 (aka @Kus00095) shared via Twitter a PS4 Mednafen v0.3 configuration update featuring...
Final PlayStation State of Play for 2019 Next Week, No PS5 News Planned
Today Sony announced their final 2019 PlayStation State of Play Conference will take place next Tuesday, December 10th at 6:00am Pacific Time / 9:00am Eastern Time. ❄ Their previous PS State of...
Top