dxx-rebirth / dxx-rebirth

Descent-Rebirth and Descent II-Rebirth
Other
501 stars 117 forks source link

Runtime bug: [Linux] Taking screenshots doesn't work when built with SDL 1.2 (SDL2 wrapper?) #804

Open neodyne opened 1 day ago

neodyne commented 1 day ago

Environment

Operating System Environment

CPU environment

Description

Presing PrintScreen in-game opens system screenshot manager (mate-screenshot), instead of creating an image in ~/.d{1,2}x-rebirth/screenshots/.

Regression status

Issue doesn't occur:

Steps to Reproduce

This may be related to Mint / Ubuntu / Debian switching from an actual SDL1.2 lib ( jammy ) to an SDL2 wrapper ( noble ). On another machine with Ubuntu 22.04 and libsdl1.2==1.2.15, the game "captures" PrintScreen (and also e.g. the Super key) while running, and screenshots work.

vLKp commented 13 hours ago

The contributed Github Actions workflow for building a Linux AppImage uses Ubuntu 22.04. Presumably, that AppImage bundles the SDL1.2 that Ubuntu 22.04 uses, which would be consistent with your observation that the Ubuntu 22.04 SDL1.2 behaves as desired. I do not know how to statically unpack an AppImage to confirm the version of the libraries embedded in the AppImage.

The game is dependent on your input subsystem passing the screenshot key to the game in order to request a screenshot. If the input subsystem is intercepting the screenshot key and displaying a menu, instead of passing the key to the game, then the game cannot know that you requested a screenshot, and cannot create one.

If you start the game with -debug, does the game's d2x-gamelog.txt report when the printscreen key is pressed? For me, with a working build, I see:

Sending event event_type::key_command:      PRSCR

If this does appear, then the problem is that the game is mishandling the keypress. If this does not appear, then the problem is that something outside the game is intercepting the key and diverting it to the external screenshot manager.