Added some extra info to help RetroPie's auto-configuration scripts by exporting the joystick Vendor and Product IDs, which should help with RetroArch's joypad profile generation.
Since 2.0.14, SDL's joystick name (`SDL_CreateJoystickName`) is a normalized version of the name reported by the OS (culled consecutive spaces, trimming trailing spaces, renaming known joystick names like Xbox/PS). This breaks the input auto-configuration scripts in RetroPie, which generate a config with new name, while the emulators/ports expect to find the OS reported name (e.g. RetroArch - see #3398 [1] for an example).
This issue is affecting especially PC users, which are not using RetroPie's (old) SDL version and who's RetroArch configuration is incomplete.
Using the Vendor/Product ID would help these situations and support the new SDL versions when added to RetroPie.
[1] https://github.com/RetroPie/RetroPie-Setup/issues/3398
The `<inputAction>` node is useless for the temporary input configuration, so remove it.
Normally, because of the previous `reset` call of the parent document, it would be empty, but I've encountered situations when the memory is not cleared and there's (random binary) garbage added to the temporary configuration file. This results in a broken XML file and the auto-configuration scripts in RetroPie will all fail.
Modified the build options and source files to enable `omxplayer` for video previews only when the `OMX` option is used.
Updated the build instructions on RPI accordingly and added some notes about the deprecation of the BRCM GPU drivers in RasPI OS 'Bullseye'.
Previously, the `RPI` build option would be used to add both RPI specific audio settings/VRAM limits AND add `omxplayer` support. However, `omxplayer` does not work with the RPI KMS video driver (`vc4-kms-v3d`) or with a 64bit RPI system, due to the lack of OpenMAX (OMX) API support.
The new RasPi OS ('bullseye') has made the KMS driver the default [1] and doesn't offer `omxplayer` anymore (considered deprecated [2]).
Splitting the OMX support from the RPI option allows to set some default values for RPI systems without automatically adding the `omxplayer` bits.
[1] https://www.raspberrypi.com/news/raspberry-pi-os-debian-bullseye/
[2] https://github.com/popcornmix/omxplayer/commit/1f1d0ccd65
This is a re-work of PR#269 and PR#314:
* originally proposed by @eagle0wl and discussed/tested with @zigurana during #269, with the motivation being to accomodate texts in languages that don't use spaces between successive characters and words (e.g. Japanese/Chinese).
* @zigurana created a smaller PR in #314 (now closed), but hasn't been updated after @tomaz82's work that changed the Unicode (UTF8) string handling functions (see #297).
I've taken the changes from @zigurana's PR (#269) and updated the code to use `Utils::String::chars2Unicode`.
I added a smaller change for parsing the text. Since we analyze each Unicode code point now (instead of a string), I replaced the `sizeText` call with a simpler function, which gets the size for just the codepoint being scanned. `lineWidth` is consequently incremended for each Unicode code point or reset on a new line.
The performance of `textWrap` looks similar or better than the previous implementation (based in whitespace tokenization) and the results are similar to what was tested during the initial PR (#269).
**NOTE**: the line breaking for non-whitespace texts is a simple split around Unicode code points. Each language may have additional rules for line breaking in texts (i.e. some characters are not allowed at the end/beginning of a line, etc.). These rules are not implemented in this update, it would require additional text analysis.
Some details on line breaking rules for Japanese/Chinese/Korean languages can be consulted at https://en.wikipedia.org/wiki/Line_breaking_rules_in_East_Asian_languages
Original descriptions for the changes on which this modification is based:
* from @eagl0wl's #269, _refine text wordwrap_:
> refined single-multibyte text wordwrap.
> You can now properly wrap Japanese character strings.
> You can see some screenshot. If necessary, I can present more screenshots.
> http://eagle0wl.hatenadiary.jp/entry/2017/10/24/003606
* from @zigurana's #314, _Line-breaking (wrapping) for non ascii strings_
> New PR (replacing #269).
Closes: #269
Supercedes: #269
* renamed image to media and added setting rename function
* replaced references to 'image' with 'media' and removed hardcoded video extensions
* fixed a bug when checking a null path
This ensures that configurations created before HIDAPI drivers were enabled by default (2.0.12)
will work when EmulationStation uses a newer SDL2 version.
Using the HIDAPI drivers may produce a different name for joysticks and pottentially changes the mapping.
Example using a PS4 (Dualshock 4) controller:
- without HIDAPI, the controller is named "Wireless Controller", with HIDAPI enabled is named "PS4 Controller"
- without HIDAPI, the D-Pad is detected as a HAT, but with the drivers enabled it's detected as a series of buttons
- the device GUID is different between the 2 configurations
The different name would probably break also the input configuration script for RetroArch, which doesn't use SDL2 as default input driver and would receive a wrong name and wrong mappings.
Note that the HIDAPI drivers are available just for a few controller models (PS4/PS4/Amazon Luna/Stadia/Xbox360(w)/Xbox One/Steam),
but these controllers are widely used and breaking their configuration would cause much confusion.
- Use C++11 built-in ranlux48 and random_device for seeding
- Shuffles systems (aso.) like a card deck and picks top system until empty, then shuffles again
- Fixes the flaws of the current random implementation: Real 1/N chance for an element in a set of N
- Minor refactorings
tellg can report -1 if there was an error while reading the file, because it was casted to a size_t type which is unsigned, this will become 18446744073709551615. It will then attempt to allocate that many bytes and of course crash. This will just return an empty resource if there was an error.