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
[Crash]: OpenTTD crashes on startup (MacBook Pro 2020, M1) #9743
Comments
From the crash logs, this appears to be related to the touch bar support. |
Confirmed. I took the sources from the master branch and compiled locally and hooked on a debugger and it is indeed coming from cocoa_wmd.mm::touchBar. The line that triggers it is this:
I tried changing this method not to do this by replacing
with
, then recompiled and the game starts up alright. Unfortunately my C++ skills are not sufficient and my knowledge of this codebase is inexistent to dig deeper and maybe fix. I attached a screenshot of VSCode when the bug triggers and attached the call stack. Let me know if I can help any further in figuring this out. The call stack (the only thing I could copy paste out properly): |
Okay after looking a bit, if the output from those local variables on the left pane in your screenshot is right, then OpenTTD/src/blitter/32bpp_optimized.cpp Lines 100 to 101 in bc22e93
That snippet is where it gets initialized, but since the loop condition on the line before should protect against the case of |
Maybe there's something with the sprite it's trying to display? When the error occurs, it is trying to display spriteId 726 (which is a particular touchbar icon). The call stack contains
Maybe the bug could be reproduced without a Mac by trying to draw this sprite just like that? |
I'd recommend dropping the emojibar support and just backing it out. Apple haven't announced emojibar is dead yet, but it's a niche sport at this point. 2021 Macbook Pros all dropped it. |
726 is From clean source tree, there's an easy way to skip the issue, you just need to add Won't solve the issue of course, but allows to run the game and see the main toolbar icons, touchbar uses the same sprites. |
|
Maybe @danskidb can have a look on this issue. |
This seems to be a race condition:
I think to fix this, the rendering of the icons must be moved. The Cocoa driver could do this within VideoDriver::PopulateSystemSprites(). But it cannot do it while rendering the window. |
Hey, I just compiled & tested with latest commit, the 12.1 release from the website and through steam, but did not manage to reproduce the crash. My machine's specifications/OS version are the exact same. @codetwice Are you running a custom graphics set or do you have an idea if you changed some graphics-related settings? I could try the same config then and try the repro again. If we can't find it here, indeed backing out my original CL would be best I think. It's a nice to have it for devices that support it but maintainability of the project is more important here. |
@danskidb My setup is totally vanilla. I didn't change any settings because the game never ever started up. I am however not entirely sure where OpenTTD may be keeping persistent config files around, so is there any particular place where I should look around for possible leftovers from previous installations? Also, is there anything I could do to help you debug this? As for removing the touchbar support, it's your call guys. I am not using the touchbar for anything for sure and when I got this Macbook Pro I almost went for the Macbook Air just because I prefer physical F keys over the touchbar. |
@frosch123 I could try to implement this early next week (work largely dictates my time here). cocoa_wnd seems to have a reference to it so rendering/caching the sprites there and retreiving them from cocoa_wnd seems worth a try. @codetwice just deleted my UserDir/Documents/OpenTTD folder to force a clean start and again, no luck in reproducing. :( after downloading the GFX the buttons and a restart the buttons showed up as expected. Could you try the same? (keep a backup though!) |
@danskidb Thanks, I do not have any OSX setup, so I can't help debug or fix this any further. |
@danskidb So this is the content directory I was looking for and couldn't find because I was looking in ~/Library instead :( I deleted (renamed) it and the game starts up alright, so there must be something in there which breaks it. I zipped it for you, but I don't know if it's worth any further investigation as it seems to have some ancient stuff inside (pre-OpenTTD 1.0). Thanks for the hint and sorry for calling out for a bug but I really wasn't aware that my setup wasn't vanilla. Github didn't like my zip or gz files so here it goes from external: |
I can see different OpenGFX versions but that should not be an issue. |
@codetwice Good to hear, at least for now you are able to play the game then 😄
|
So, I had some more time to investigate today, what i've found:
|
At least one fault is in |
Yeap, changing it to zoom_min prevents the crash, but as expected, this also scaled down the sprite on the image buffer. |
For each sprite, only the zoom levels between The whole touch bar stuff should probably be done in |
Heya, sorry for the delay, hope you all had a good xmas if you celebrate it. |
…ted by the main loop.
…ted by the main loop.
…ted by the main loop.
…ted by the main loop.
…alid zoom level.
…ted by the main loop.
Version of OpenTTD
12.0, 12.1, nightly
Steps to reproduce
The game crashes on startup, it does not get to the title screen. I think the frame of the main window gets drawn for a brief moment before the app crashes.
System info:
Reproduction steps (for me):
Other info that may be interesting:
Same crash happened on Big Sur (11.6). Then I updated to Monterey, crash is still on.
Tested different versions of OpenTTD. Results:
I included crash reports for both
Upload crash files
OpenTTD 12.1 Monterey crash.txt
OpenTTD 12.0 Big Sur crash.txt
OpenTTD 12.1 Big Sur crash.txt
The text was updated successfully, but these errors were encountered: