Category PS4 CFW and Hacks       Thread starter PSXHAX       Start date Mar 26, 2017 at 9:26 PM       3,311       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
Red Dead Redemption 2 Modding Demos by RDR2 Modder JediJosh920
Following the Spider-Man PS4 Models & Textures Tool and IG PS4 Modding Tools, this weekend RDR2 modder @jedijosh920 (Web site / Twitter) shared on his YouTube Channel some demonstration videos of...
Action-RPG Oninaki Joins New PlayStation 4 Games Next Week
Next week Tokyo RPG Factory's latest action-RPG Oninaki hits PlayStation 4 on August 22nd casting you as a Watcher, tasked with helping usher the souls of the departed into their next life. šŸ—¼...
Electric Purple, Red Camouflage, Titanium Blue & Rose Gold DS4 Controllers!
Earlier this year we saw an Alpine Green DualShock 4 PS4 Controller, and now Sony announced their latest batch of DualShock 4 PS4 Controllers will include Electric Purple, Red Camouflage, Titanium...
Iconit: PS4 Tool to Change PlayStation 4 Game Icons by OfficialAhmed
Following his PS4HEN Trophy Calculator release, developer OfficialAhmed shared Iconit v1.00 on Twitter today, which allows jailbroken console owners with PS4 HEN to change PlayStation 4 game icons...
Top