Category PS4 CFW and Hacks       Thread starter PSXHAX       Start date Mar 26, 2017 at 9:26 PM       3,414       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 Patch Builder for Building Modded Update PKGs by MODDED WARFARE
Since his YouTube Issues PlayStation 4 homebrew developer @MODDEDWARFARE returns releasing on Twitter a PS4 Patch Builder application used for building modded Update Packages (PKGs) alongside a...
PS Vita System Software / Firmware 3.73 is Live, Don't Update!
Trick or treat?! šŸŽƒ Since their previous PS Vita OFW revision, today Sony pushed live a PlayStation Vita System Software / Firmware 3.73 Update leaving many curious if they patched the H-Encore 2...
PlayStation Store Halloween Sale Now Live, PSN Game Deals Up to Half Off
The month is already half over and Halloween 2019 is quickly approaching as Sony unleashes their latest PlayStation Store Halloween Sale featuring PSN game deals at up to 50% off on select titles...
Sony PlayStation Augmented Reality (AR) Wireless Headset Patent Surfaces
Contrary to the potential PSVR2 Patent that superimposes a computer-generated image on a user's view of the real world, the latest PlayStation Augmented Reality (AR) Wireless Headset Patent by...
Top