Topic: [3.85] Linux sdl2-compat - keyboard (and minor display) issues  (Read 765 times)


Plotinus

« on: February 26, 2025, 06:22:31 PM »
update: I'm resolving this by downgrading sdl2-compat to sdl2; sdl2-compat seems to not be compatible enough with urw.

I upgraded sdl yesterday.

- sdl3 -> 3.2.2-1
- sld2 2.30.7-1 -> sdl2-compat 2.30.52-1
- sdl2_image 2.8.2-4 -> 2.8.4-1

Since then, I'm having trouble using skills with alt. pressing alt-t doesn't do tracking, it suggests throw/shoot, as if i haven't pressed alt. I have tried both alt-keys. I also have trouble zooming in and out with ctrl+ and ctrl-, it acts like I haven't pressed ctrl and gives me the make menu for + and starts waiting for -.

As a work around, I'm using s for skills and using ctrl+mouse-wheel for zooming in and out, which works fine.

I'm also noticing a minor display issue with the highlighted item in my inventory, the highlight deoesn't go all the way to the edge of the square. it is hardly worth mentioning, but it is on the sdl topic. i've attached a screenshot.


I'll look up what this sdl2 -> sdl2-compat change is about.  I'm using Manjaro but it is likely the change came from upstream (Arch Linux)
« Last Edit: March 01, 2025, 05:07:29 PM by Plotinus »

Plotinus

« Reply #1 on: February 26, 2025, 06:34:40 PM »
Quote
   An SDL2 compatibility layer that uses SDL3 behind the scenes
   

https://github.com/libsdl-org/sdl2-compat


Looking at https://github.com/libsdl-org/SDL/releases, it seems that they are trying to provide a painless transition between sdl2 and sdl3 with sdl2-compat. And I'd have to say this is pretty painless, the game is entirely playable with sdl2-compat even considering this keyboard issue. I guess my distro switched a little sooner than optimal, but maybe future urw builds on arch should target sdl2-compat instead of sdl2? or maybe there's even an navigable pathway to sdl3?

Plotinus

« Reply #2 on: February 26, 2025, 06:44:28 PM »
I wouldn't mind opening an sdl bug about this but i feel like i don't have enough information to make a good bug report: ideally what sdl functions are involved in getting the keyboard input and what it erroneously thinks the keyboard state is. For example, I see a recent keyboard bug report https://github.com/libsdl-org/SDL/issues/12265 and I think it could be related since it is also about mod keys but I'm experiencing it constantly, not randomly, and I don't know if SDL_PollEvent or SDL_GetModState are involved, and I don't know if the problem is an erroneous KEY_UP or something else, and also that bug was reported for sdl2 and the original poster hasn't even replied whether it's applicable to sdl2-compat or sdl3.

Plotinus

« Reply #3 on: February 26, 2025, 06:57:10 PM »
I looked through the open issues in sdl2-compat repo as well but I didn't find any that matched my issue. The closest was someone who couldn't type anything on a Russian keyboard layout. I have a Hungarian keyboard layout and I can type ö and ä in the game without issue, and I think trouble with ctrl and alt is pretty different from trouble with not-ascii characters.

Plotinus

« Reply #4 on: March 01, 2025, 04:29:30 PM »
Also the cultural regions aren't showing up on the F6 map of known areas. When I press C, the Cultural Regions legend grows dark or light again, but nothing happens on the map itself.

And I've noticed a couple crashes, one of which was while loading a zoomed in map (either while zooming in or while crossing a map boundary, i don't remember):

Code: [Select]
Feb 26 17:28:19 kebla kernel: urw3-bin[14632]: segfault at 8 ip 00007c710d05073b sp 00007fffd3845de0 error 4 in libSDL3.so.0.2.2[5073b,7c710d015000+1d5000] likely on CPU 1 (core 1, socket 0)
Feb 26 17:28:19 kebla kernel: Code: d3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 45 31 c9 e9 24 fa ff ff 0f 1f 40 00 f3 0f 1e fa 55 48 89 e5 41 54 53 <48> 83 7f 08 00 48 89 fb 74 4b 48 89 df e8 e3 c5 ff ff 41 89 c4 84
Feb 26 17:28:19 kebla systemd-coredump[15596]: Process 14632 (urw3-bin) of user 1000 terminated abnormally with signal 11/SEGV, processing...
Feb 26 17:28:19 kebla systemd[1]: Started Process Core Dump (PID 15596/UID 0).
Feb 26 17:28:45 kebla (sd-parse-elf)[15605]: Could not parse core file, dwfl_core_file_report() failed: (null)
Feb 26 17:28:45 kebla (sd-parse-elf)[15605]: Failed to inspect core file: Invalid argument
Feb 26 17:28:45 kebla systemd-coredump[15597]: [🡕] Process 14632 (urw3-bin) of user 1000 dumped core.

Feb 27 19:00:02 kebla kernel: urw3-bin[8471]: segfault at 8 ip 000073e78185073b sp 00007ffddc3e6340 error 4 in libSDL3.so.0.2.2[5073b,73e781815000+1d5000] likely on CPU 0 (core 0, socket 0)
Feb 27 19:00:02 kebla kernel: Code: d3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 45 31 c9 e9 24 fa ff ff 0f 1f 40 00 f3 0f 1e fa 55 48 89 e5 41 54 53 <48> 83 7f 08 00 48 89 fb 74 4b 48 89 df e8 e3 c5 ff ff 41 89 c4 84
Feb 27 19:00:03 kebla systemd-coredump[15348]: Process 8471 (urw3-bin) of user 1000 terminated abnormally with signal 11/SEGV, processing...
« Last Edit: March 01, 2025, 04:58:05 PM by Plotinus »

Plotinus

« Reply #5 on: March 01, 2025, 05:05:43 PM »
I think I'm going to just switch my system back to real sdl2.

ineedcords

« Reply #6 on: March 01, 2025, 11:44:51 PM »
update: I'm resolving this by downgrading sdl2-compat to sdl2; sdl2-compat seems to not be compatible enough with urw.
I see that the software you mention, is summarised on their GitHub project page, as so:
Quote
This is the Simple DirectMedia Layer, a general API that provides low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D framebuffer across multiple platforms.
This code is a compatibility layer; it provides a binary and source compatible API for programs written against SDL2, but it uses SDL3 behind the scenes. If you are writing new code, please target SDL3 directly and do not use this layer.

I can see this software, one day, becoming more important, but today it is more of a remote 3rd party piece - unless more distros are trigger-happy about it which then may impact a larger portion of URW linux players pretty quickly.

As this software is neither the original SDL2 lib, nor another required software URW devs are committed to, technically as of today, I do not think this should be in "Bug Reports" subforum.
You are of course more than welcome to share your experiences (it can help others) but more of an Off-topic entry in my view.
I will wait for @Sami or @Erkka to advise further and if they agree possibly move the thread to Off-topic...

Meanwhile, I think your approach of switching to the real SDL2 makes perfect sense, as the game is written using that lib and works (mostly) perfectly.
This could be a good day to utilize your squirrels hides.

Plotinus

« Reply #7 on: March 02, 2025, 08:53:12 AM »
The reason I opened this as a bug report is that the trigger happy distros like Arch and Manjaro have already made the switch. On the real SDL2 release pages, they're telling people to make the switch already: https://github.com/libsdl-org/SDL/releases/tag/release-2.32.0.

Quote
The SDL development team is focusing efforts on SDL3 and making sdl2-compat a drop-in replacement for SDL2. If you run into issues with SDL2, please consider upgrading to SDL3 or trying out sdl2-compat. We have made significant improvements across all platforms and your issue may already be resolved.

To me, this means, that it'd be worth trying to target sdl2-compat in the build process for 3.87 or 3.88 (not 3.86, it's not worth delaying a release over.) As such, I think in hindsights suggestions might be a better place than bug reports but we should wait to see where the devs prefer this post to be.

At the time I opened it, I didn't know whether downgraded to sdl2 would be possible or would break something -- so far it looks okay though everytime I upgrade or install something, I'll have to tell it to not make the switch again.

I think probably this should be a bug report in sdl2-compat, not in urw, but I'm not sure I have enough information to write a good bug report for sdl2-compat. I guess I could try to reproduce in the free version of urw and then let them figure it out.