induktio / thinker

Improved game engine features for SMACX.
https://discord.gg/XdFuwWzzku
GNU General Public License v2.0
75 stars 11 forks source link

Crashes on linux when a former is selected #55

Closed nowakf closed 8 months ago

nowakf commented 1 year ago

crash.txt

Here's what was dumped onto the terminal, I have no real idea how to interpret this.

induktio commented 1 year ago

At least wine's crash log is really extensive, have to investigate it. Did the game work previously without issues for you? If so, do you remember what changed with the settings/mod versions in between?

nowakf commented 1 year ago

It did work without (major[0]) issues: I was just using GoG's version of smacx. I was using the latest release from the github.

[0]: I had the videos disabled because they caused my window manager to crash.

induktio commented 1 year ago

Okay, it's not immediately clear to me why this crash occurs here. The crash location is at 005e076d in original Buffer_copy function which is not patched by the mod. Previously there was a separate issue #41 reported on Wine but the crash dump looks different.

The log file has wine client error:10c: write: Bad file descriptor in the end but not sure if it is relevant here. You might try reinstalling the game and check if it crashes again. If you have played Thinker previously using this setup, can you identify the latest Thinker version that does not crash here? Haven't seen this issue yet on Windows so I might have to install the game separately on Wine to see if it can be reproduced.

nowakf commented 1 year ago

I'm afraid I've never played Thinker previously, and I've just had to delete smac from my computer (it was distracting). The only (obvious?) observation I'd make is that 0x0564ffff is probs a garbage value, because it's more than uint32_max. So if both ESI and EDI are garbage, 'rep movsb' (copying one buffer to another) is segfaulting, and the probable cause is Buffer_copy being called with garbage arguments.

induktio commented 1 year ago

Looks like I can reproduce this bug reliably on Wine even with no binary mods installed. It's certainly game-breaking. Here are the steps:

  1. wine terranx.exe
  2. Open empty map in scenario editor.
  3. Click on random tiles a dozen times.

Game seems to crash every time with a similar looking error Unhandled exception: page fault on read access to 0x03c0ffff in 32-bit code (0x005e076d).. Some register values might slightly change but they are like this ESI:03c0ffff EDI:03c24c9f ECX:00000001. The faulty instruction is always the same. This was on debian stable so the wine/kernel are older versions than in your sample. If it's caused by Wine there's probably not much that can be done here except report the bug to the Wine issue tracker if you can do so. I'm not sure if there's any known workarounds for this though.

induktio commented 1 year ago

Actually this might be related to DirectDraw=0 or something else related to resolutions. The issue might not happen at all when DirectDraw is enabled but then the game switches to a really small resolution. Another workaround for this is to set windowed=1 in thinker.ini even while DirectDraw is disabled, so the game gets rendered in a borderless window. You might also get around this by installing PRACX and adjusting some screen resolution settings there.

kapsroar commented 9 months ago

On Windows 10, it was always crashing after a couple clicks on the map. The crashes stopped only when I lowered the resolution in PRACX settings.

induktio commented 8 months ago

@kapsroar Can you elaborate what kind of resolution you were using before/after it stopped crashing? The problem described above seems to be a known issue where the game crashes after clicking map tiles if the resolution is not divisible by 8. The crash location should also be 0x005e076d or something similar. This probably needs some kind of a permanent solution where the window dimensions are adjusted at startup if necessary. In the meantime players can also set windowed=1 or DirectDraw=1 and some valid window size if you have one of those screens where the dimensions are not divisible by 8. DirectDraw requires using the older launcher. Using PRACX also allows to edit the resolution.

kapsroar commented 8 months ago

@induktio 1366 crash, 1360 no crash. Divisible by 8, indeed.

induktio commented 8 months ago

This issue should be fixed now since the latest version will adjust resolution at startup if necessary so closing this.