schellingb / dosbox-pure

DOSBox Pure is a new fork of DOSBox built for RetroArch/Libretro aiming for simplicity and ease of use.
GNU General Public License v2.0
773 stars 65 forks source link

Selecting Custom Keyboard Bindings will cause "segmentation fault" #514

Closed roslof closed 3 months ago

roslof commented 3 months ago

Test Device: Raspberry Pi 5 OS: Bookworm / aarch64 GNU/Linux Commit Sync: Any commit after and including 1c7ad4f Libretro Version Suspect any, but recently tested with 1.19.1 Note: Core Options are default in most cases

Symptom: A significant number of games/programs SegFault immediately at launch with the test system above. Previous commits do not yield this issue and there doesn't appear to be a work-around.

Samples of Affected Software: Freeware/Shareware Examples:

Commercial Examples:

This is roughly 1 in every 7 games tested. Cannot see any rhyme or reason or pattern why some of these programs now SegFault.

As always, I hope this information is helpful. -ros

schellingb commented 3 months ago

You're sure it's 1c7ad4f from May 21 and not 2dd7992 from Jun 1? The first one should only be a UI improvement which shouldn't selectively affect programs running in the emulation. The second one directly is a fix specific for Pi5.

Can you run the frontend through GDB so we can get a callstack to where the segfault happens? That would be most useful as I don't have a Pi5 to test.

roslof commented 3 months ago

Good day @schellingb Yes, I'm certain the issue started with 1c7ad4f based on manually syncing to each changelist above and below until I found the offender. I'm synching to aa76a4f to get everything to run correctly. Note that syncing to 2dd7992 still yields the issue. I don't have experience with GDB, but I'll see if I can figure it out ASAP and get you a callstack. Cheers!

roslof commented 3 months ago

For your convenience, I uploaded the Cronologia Demo to a public share, in case the issue isn't specific to the Pi 5.

schellingb commented 3 months ago

I tried this demo on my Pi 4 with the latest git revision and it ran without issues.

You should be able to launch RetroArch via GDB with a command like

gdb -ex run --args ./retroarch -L <path_to>/dosbox_pure_libretro.so <path_to>/Cronologia.dosz

Then once an error happens, it will tell you about it in the terminal, there you can enter bt to get the callstack. Then you can quit GDB with q.

If bt only gives you numbers and not function names inside dosbox_pure_libretro.so you probably need to recompile DOSBox Pure with make -j4 BUILD=RELEASEDBG.

roslof commented 3 months ago

@schellingb I found the issue and it appears Custom Keyboard Bindings is broken -- at least for me. Any of my custom .rmp files that assign Player 1 to Custom Keyboard Bindings are asserting. Removing or modifying this line from any .rmp circumvents the problem:

input_libretro_device_p1 = "3"

I can currently reproduce the SegFault at any time with these steps:

  1. Enter the Retroarch Quick Menu
  2. Select Controls
  3. Select Port 1 Controls
  4. Highlight Device Type

After step 4, Retroarch will SegFault after either:

a) Tapping the "B" button on Device Type and selecting Custom Keyboard Bindings or b) By scrolling right through Both DOS Joysticks or left through Custom Keyboard + Mouse on Left Joystick and B/A/X

Cheers! -ros

schellingb commented 3 months ago

Thank you very much for investigating this. Yes, this clearly is a bug. Or rather, it was a bug. Can you try again with the latest revision which includes 594d0ef which should hopefully make things work again for you with "Custom Keyboard Bindings". Cheers to you, too!

roslof commented 3 months ago

Ah yes, that definitely fixed the issue! Awesome, and thank you as always!