Join Us and become a Member for a Verified Badge on Discord to access private areas with the latest PS4 FPKG Games.
Category PS4 CFW and Hacks       Thread starter PSXHAX       Start date Mar 26, 2017 at 9:26 PM       3,877       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
Ubisoft Forward: Far Cry 6 World Premiere Trailer & More New Videos!
Those who missed the Ubisoft Forward event can check out the World Premiere Trailer video for Far Cry 6 which is slated to hit PS5 on February 18, 2021, over 30 minutes of actual gameplay from...
PS4 6.72 Payload Ports, Updated Mira Project Support & ELF / Loader
Following yesterday's PS4 6.72 Payload Ports by @Al Azif on Github, this weekend kiwidoggie added 6.72 support updating Mira Project to include 4.74, 5.01, 5.03, 5.05 and 6.72 Passing Builds with...
PS4 Payload Injector 2.1 Windows GUI Application by TheWizWiki
We've seen several PS4 Payload Injectors over the years including NetCat GUI, PlayStation 4 Tool, PS4 Tool.apk, Payload Injector PS4, PS4 Memory Editor & ELF Loader, PS4 Avatar Injector, PS4...
Sega Announces Astro City Mini Arcade with HDMI Out and Classic Games
The legendary @jwooh let us know that following the Genesis Mini, TG-16 / PC Engine Mini and Capcom Home Arcade developer Sega recently announced their Astro City Mini Arcade featuring HDMI out to...
Top