libretro / tyrquake

Libretro port of Tyrquake (Quake 1 engine)
GNU General Public License v2.0
42 stars 46 forks source link

Systematical crash on ARMv7 device at the beginning of the intro or when pressing A button. #102

Closed DrUm78 closed 1 year ago

DrUm78 commented 3 years ago

Hardware: FunKey S (SoC V3s ARM Cortex A7-A clocked @ 1.2GHz) Software: sdlretro for the frontent (https://github.com/FunKey-Project/sdlretro) and Tyr-Quake for the Libretro core

It crashes systematically at the same point in the intro (when exploding the zombies with the grenade launcher) or as soon as I press A button (to switch weapon), here is a video.

Unfortunately, there is no logs anywhere after those crashes (even when enabling them in GMenu2X) so I don't have any lead about this. Any idea?

nckstwrt commented 3 years ago

After a ridiculous amount of debugging I finally tracked this down (I could not get unwinding/backtracing working on the FunKey - so could not get a stacktrace)

The issue is in D_PolysetDrawSpans8 in d_polyse.c

Normally the code is: if (lcount)

but it seems lcount can somehow end up being negative from int lcount = d_aspancount - pspanpackage->count; so changing the code to: if (lcount > 0)

Fixes the crashing.

DrUm78 commented 3 years ago

Nice job, that fixes the issue yes! You should submit a pull request then before I close the bug. BTW, with "Colored lighting" enabled in the core setting, that still crashes at the same places. Just to let you know but I don't use this setting anyway (and it's disabled by default).

DrUm78 commented 3 years ago

@nckstwrt Ok, applying the same change for "D_PolysetDrawSpansRGB" fixes the crash with "Colored lighting" enabled too but it's totally useless as it severely degrades the performance anyway although it's still nice to have something that does not crash anymore.

DrUm78 commented 1 year ago

I keep the ticket open as it still crashes on armv7 without this change, so that's for the record when someone has time to commit the fix.

DrUm78 commented 1 year ago

PR open here: https://github.com/libretro/tyrquake/pull/127.