Ever wish PICO-8 had dual analog stick support? Me too, so I wrote Pinput. Pinput is a Lua library and suite of external helper apps to provide XInput-like gamepad support to PICO-8, without requiring binary patching. The library and helpers use the GPIO area of cartridge RAM to communicate, making Pinput a sort of virtual peripheral plugged into an imaginary expansion port. (The P8T Twitter client uses GPIO the same way.)
You can try it now if you have a gamepad that works with your browser. (You may want to test it first with this gamepad test page.)
What do you get?
- Up to 8 players
- Per player:
- 2 analog thumbsticks
- 2 analog triggers
- 4-way digital D-pad
- 4 digital action buttons (ABXY)
- 2 digital bumper/shoulder buttons
- 2 digital thumbstick buttons
- 2 or 3 digital menu buttons (Start and Back, plus Guide/Xbox/PS button on macOS and web)
Pinput currently works on:
- macOS: with up to 8 gamepads supported by Apple's Game Controller API (newer Xbox One, DualShock 4, DualSense, MFi)
- Windows: with up to 4 gamepads supported by XInput (360, Xbox One)
- Web: depends on your OS and browser's support for the web gamepad API, but expect USB/BT HID gamepads to work, and on Windows, probably XInput too
- rumble/vibration support
- battery level/charging status for wireless controllers (macOS and Windows only)
How does it work?
All platforms have the same interface between a cartridge and the helper, so you can run the same Pinput-enabled cartridge on macOS, Windows, or your browser.
I wanted to do a Geometry Wars demake but still have twinstick support. 😁