Category PS4 CFW and Hacks       Thread starter PSXHAX       Start date Mar 26, 2017 at 9:26 PM       3,217       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
Metal Gear Solid HD Remake in Dreams on PS4 by Bearly Regal
Similar to what's been done with LittleBigPlanet customizing and recreations, recently Bearly Regal on Twitter shared a Metal Gear Solid HD Remake now playable in Dreams by Media Molecule on PS4...
Vacation Simulator Floats on PSVR Tomorrow, Launch Trailer Video
Those who'd love to take a vacation if they could only get away from work may want to check out Vacation Simulator releasing tomorrow for PS VR on PlayStation 4. ☀ ⛱ 🥥🌴🌊 Owlchemy Labs Tech...
Some of the PlayStation 4 E3 2019 PS4 Trailer Videos!
We've seen a Watch Dogs: Legion PS4, Marvel Avengers: A-Day PS4 and some Final Fantasy VIII Remastered & Final Fantasy VII Remake PS4 videos from E3 2019, and below are several more PlayStation 4...
Crash Team Racing: Nitro-Fueled Races to PS4 Next Week
CTR racers on your mark, get set, go... as Crash Team Racing: Nitro-Fueled speeds onto PlayStation 4 next week. 🏎 🏁 Get ready to go fur-throttle in the fully-remastered and revved up to the max...
Top