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.
In #688 the change from getCanonicalPath to getAbsolutePath improved performance, but the case of an empty path was not resolving appropriately for the VLC video player.
According to 6872f472 if MaxVRAM/--max-vram is 0, then texture memory should be considered unlimited
(command line help states - Max VRAM to use in Mb before swapping. 0 for unlimited)