This is required for the RString to std::string migration.
Mostly automated from https://github.com/aeubanks/rewriter/blob/main/c_str.cc, with some manual intervention required for fixing up `a + b.c_str()` to `(a + b).c_str()`.
Added some overloads for some common global functions like sm_crash to reduce the number of changes required here.
Interface with libudev to get notified when a new joystick appears.
The code is in IH_Linux_Event rather than IH_Linux_Joystick because it
seemed like the former uses evdev (standard for most devices nowadays)
whereas the latter uses the old joydev API. The result should be the
same in any case...
Implementation is a bit messy due to LinuxInputManager only scanning for
devices from its constructor, this forces RageInput to have an exception
for LinuxInputManager. Possibly with more involved surgery a cleaner
solution could be devised...
* Remove unused function
* Sort input devices on Linux
The readdir() function doesn't guarantee any specific ordering, so the
numbers of joysticks might change when restarting StepMania.
(Empirically this usually only happens after a reboot.)
Let's sort the input devices alphabetically before opening them to have
more consistent numbering and avoid annoying remapping of controllers.
* Initialise variables to ensure input thread is started
m_bShutdown was not initialised. This meant that the input
thread would never be started seemingly at random.
In my case m_bShutdown was always false when running in fullscreen
but not in windowed mode for some reason
This attempts to organize all needed items and places appropriate defines
in a single location. Redundant comparisons/defines were removed when noticed.
A few caveats, however:
* This may be better targeted towards the 5_1_0 branch instead of master right now.
* Cmake will run a little slower on configuration/generation now. That's due to the sanity checks it runs.
* There are some more checks to be added later, but this should be a solid start.
Thanks to the [libical](https://github.com/libical/libical) project for inspiration.
Old code would, by coincidence, map 1->16 to 1->16, then 17->32 to
1->32, leaving 1 and 17 on the same button number.
We still map 33->56 to 1->24, creating some overlap. But at least that's
because StepMania will have run out of buttons.
THIS PATCH WILL CHANGE THE CODES OF JOYSTICK BUTTONS 17 AND UP.