Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gui_zoom can have invalid values, not respecting zoom_min #8711

Closed
Wolfolo opened this issue Feb 21, 2021 · 6 comments · Fixed by #8835
Closed

gui_zoom can have invalid values, not respecting zoom_min #8711

Wolfolo opened this issue Feb 21, 2021 · 6 comments · Fixed by #8835
Milestone

Comments

@Wolfolo
Copy link

Wolfolo commented Feb 21, 2021

Version of OpenTTD

1.10.3 - microsoft store version
master

Expected result

1.10.3 - Not crashing at start
master - clamp the interface size to a valid value

Actual result

1.10.3 - Crashing at start
master - graphics fail to load properly, looking really odd; it can also crash. Depends a bit.

crash.zip

Steps to reproduce

1.10.3

  • Launch the game with a folder in documents used by different versions of the game (mainly 1.10.x and master)
  • In master set the interface size to "(auto-detect)", close and run the game with 1.10.3

master

  • Set gui_zoom to 0 and zoom_min to 1
  • Launch the game
@James103
Copy link
Contributor

Can you try downloading OpenTTD 1.10.3 from the official OpenTTD website and starting it up?
If it still crashes, can you repeat this step again with OpenTTD 1.11.0-beta1 and/or the latest nightly?

@Wolfolo
Copy link
Author

Wolfolo commented Feb 21, 2021

Found the culprit: I enabled auto-detect interface size on the game options when trying it on master, setting it to normal it started to work again on 1.10.3

@michicc
Copy link
Member

michicc commented Feb 21, 2021

Invalid settings should be clamped to the valid range, which as far as I can see had no changes for 1.11.

Clamping in case of the interface size means in this case it will use maximum zoom-in. Can you check how 1.10.3 behaves for you if you manually select maximum zoom?

@Wolfolo
Copy link
Author

Wolfolo commented Feb 21, 2021

I can only select between normal and double size in 1.10.3 and runs fine with both settings, quad size is disabled in both 1.10.3 and master.
In master with auto-detect shows normal sized UI

@Wolfolo Wolfolo changed the title Microsoft store version 1.10.3 crashing at start 1.10.3 crashing at start when interface size is set to auto-detect from master (1.11), shared config in document folder Feb 21, 2021
@michicc
Copy link
Member

michicc commented Feb 21, 2021

If quad size is disabled, _settings_client.gui.zoom_min is set to something not the default.

As far as I can see, the GUI zoom from the config file is not validated against the zoom_min/zoom_max settings. This is not directly related to the zoom auto-detect, except that old OTTD versions interpret it as maximum zoom-in.

Fortunately, the amount of people who a) have limited the game zoom, b) upgrade to 1.11 while keeping older versions around, and c) switch to auto-detect zoom even though their config files must contain perfectly workable GUI zooms is probably very, very small.

@TrueBrain TrueBrain added this to the 1.11.0 milestone Feb 27, 2021
@TrueBrain
Copy link
Member

In master, setting gui_zoom to 0 and zoom_min to 1 avoids having to take some pills on a party tonight (hihi, like there is a party in this corona time). That ... is not working as intended ;)

I assume it is the same problem hitting 1.10.3. But as I cannot see the backtrace etc, that is a bit hard to confirm for me. Anyway, it indeed has nothing really to do with the auto-detect, as previously stated.

I am going to update this ticket to reflect the master issue, as we can fix that. That doesn't fix the issue for 1.10, but I think at this point in time that is not realistic to do either (as it would require a 1.10.4, I think).

@TrueBrain TrueBrain changed the title 1.10.3 crashing at start when interface size is set to auto-detect from master (1.11), shared config in document folder gui_zoom can have invalid values, not respecting zoom_min Mar 10, 2021
TrueBrain added a commit to TrueBrain/OpenTTD that referenced this issue Mar 10, 2021
gui_zoom was never clamp'd between zoom_min/zoom_max.

zoom_min controls how zoomed-in we load sprites. For a value of 1,
no quad-sizes sprites are loaded. If gui_zoom would be 0, meaning
it wants quad-sized sprites to display, it was printing random
stuff to the screen, which could or could not result in crashes.
TrueBrain added a commit that referenced this issue Mar 10, 2021
gui_zoom was never clamp'd between zoom_min/zoom_max.

zoom_min controls how zoomed-in we load sprites. For a value of 1,
no quad-sizes sprites are loaded. If gui_zoom would be 0, meaning
it wants quad-sized sprites to display, it was printing random
stuff to the screen, which could or could not result in crashes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants