Skip to content

IR-GUN4ALL v2.0 - That Heart, That Power-rev1

Compare
Choose a tag to compare
@SeongGino SeongGino released this 13 Nov 05:15
· 195 commits to plus since this release
cf6d09b
(we pretend only the arranged version exists in this house)

Revision 1 update!

  • Added USB identifier defines in the sketch proper! No more having to redefine boards.txt for your platform of choice (which stopped working anyhow) - just change the VID/PID pair and manufacturer/device strings that the gun reports as in the configuration area of the sketch. Makes getting things setup for multiplayer that much less painless (though P2/3/4 will have to change what their keyboard buttons map to manually - may have to streamline this more soon!)
  • Fixes a few oversights with missing ifdefs around the serial processing block generating errors when Rumble and/or Solenoid were undefined/disabled. Oops.

The original release notes for the major version are below:

The Fix everything update, and then some!

  • Camera tracking performance has been restored, due to a drastic oversight in the button polling that noticeably reduced performance and added latency where there shouldn't be. Oops!
    • This was caused by incidentally not gating the keyboard press/release commands, thus flooding the USB bandwidth with needless redundant keyboard presses. Speaking of which...
  • Merged AbsMouse5 with a TinyUSB-compatible Keyboard library into one TinyUSB_Devices library! This solves a number of longstanding issues:
    • For RP2040 users, this means they can now use the latest versions of Earle Philhower's Arduino core, as versions after 3.0.0 intentionally deprecated basic Keyboard library support.
    • For everyone, this means that the keyboard library now does proper (1ms) delays on its own, meaning the button sticking issue of old has been finally, truly fixed. So for all buttons mapped to the keyboard (except Start and Select, purely for quality-of-life), we can use the LightgunButtons library as it was intended. Useful if you want to use Button C as a keyboard bind instead of Mouse 4, for example.
    • This library is now what also determine USB polling rate, which has been adjusted to 1ms - if your board has issues, try bumping this back up to 2 in TinyUSB_Devices.cpp
    • This also means that GUN4ALL only works with boards that are compatible with the TinyUSB core!
      • ...Which doesn't mean a lot, as all SAMD/RP2040 boards we recommend have already been compatible. This just means M0/M4 boards also need to use the TinyUSB stack - you will get library errors regarding the keyboard otherwise.
  • Added support for Dual Core processing! If using an RP2040, you have the option to use the second core for handling buttons, meaning (theoretically) faster performance!
    • ...Though you won't notice, as even running the sketch in single core mode with the -Os small optimization bit isn't appreciably slower, if at all. Still, this COULD reduce latency, and even help with supporting more boards in the future.
  • (Extremely, heavily experimental) MAMEHOOKER support has been added! Yes, really; we now support using this elusive bit of kit to integrate with a game's provided force feedback more faithfully, compatible with both Windows & Linux (thru Wine)! When enabled, the gun will automatically hand off control of a gun's force feedback (if any) to a running mamehook instance if the right S start code has been detected - and will reclaim that control when the E end code is sent. The LED will turn a mid-intensity white when in serial handoff mode.
    • We currently support most of the commands, but not all; S (start, no options) and E (end), M1x2 (offscreen button mode set), F0x0/1/2 (solenoid off/on/slow pulses), F1x0/1/2 (rumble motor off/on/pulses), and F2/3/4x0/1 (R/G/B LED off/on support, no pulses - these will light up an Adafruit board's builtin DotStar/NeoPixel, if any). Any unrecognized command will simply be ignored.
    • ...However, this is currently labeled as experimental; while it does indeed function, in my and another individual's testing on RP2040, it has a high likelihood of crashing after anywhere from 3-15 minutes of use (see #1 and #3 for more info). This is due to some undetermined but longstanding bug regarding large influxes of serial communication (whether mamehook or debug messaging) in combination with camera tracking. Therefore, it is disabled by default - you can enable this by uncommenting #define MAMEHOOKER in the topmost section of the sketch if you'd like to help track down where this issue is occurring exactly.
    • If you are more experienced with Arduino programming and have ideas on how to fix this, please get in touch. (This may or may not be a cry for help on this specific feature.)
  • And other miscellaneous fixes, including true variable rumble motor strengths using PWM. A quiet solenoid mode might also be in consideration using a similar method.

Oh, right, and the name's changed! It is now known by the much snappier (and hopefully not too confusing) IR-GUN4ALL - representing the four points-of-reference system, as well as a nod to the inspiration of this project and its features, while simultaneously representing its open-source nature (and referencing the MAME4ALL forks of old, if anyone remembers them)!


No binaries; just click "Source code (zip)" and extract to the necessary directories as stated in the project README. Documentation is included in the SamcoEnhanced sketch folder (as another README.md) and is highly recommended to be read before use.