override some scale settings; finer-grained SDL init #2007
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
TIC-80's uiScale currently defaults to 4. This turns out to be a poor choice for everybody's favorite maybe-still-supported platform, the PocketC.H.I.P., which lacks a screen large enough to accommodate it.
For whatever reason (maybe issue 1904?), recent TIC-80 builds also perform very badly at scale 4 on the PocketC.H.I.P., taking more than a minute to start up and then missing many keystrokes.
I recorded the image above after twice failing to "exit". Note that the cursor is not visible.
Additionally, sound is currently broken for TIC-80 on the PocketC.H.I.P. (but not for other SDL2 applications.) That is not a big problem by itself, but will complicate the implementation of a screen-framing fix slightly.
Solution
A sophisticated user can circumvent the screen-framing problem on PocketC.H.I.P. by explicitly reconfiguring uiScale to a lower value. This pull request seeks to address the problem (and indirectly, also the worst of the performance issues) for all PocketC.H.I.P. users by conditionally overriding the uiScale setting, without prompting. Here's how:
I have tested this successfully on Ubuntu 20.04.4 and of course on the PocketC.H.I.P., whose new effective default uiScale of 2 is still somewhat slow, but no longer accompanied by lots of missed keystrokes.
I expect most systems should see no change from this pull request, but I can imagine a few others (smartwatches, LED boards, etc.) for which it might be useful.
Feel free to repurpose code from this pull request if that would be more convenient than merging all of it.