Hatari crash on Joystick button click
-
- Atarian
- Posts: 7
- Joined: Mon Jul 01, 2024 1:14 pm
Hatari crash on Joystick button click
Hi,
I'm using Lubuntu (Ubuntu 24.04 LTS) and initially tried the version of Hatari that comes packaged (2.4.1) but have also installed from source version 2.5.0
Whenever I open Hatari and click the "Joysticks" button in the F12 options menu, Hatari closes without any error message. All the other options work and it does this regardless of what TOS or other options are configured in other options, it seems. Any help much appreciated!
I'm using Lubuntu (Ubuntu 24.04 LTS) and initially tried the version of Hatari that comes packaged (2.4.1) but have also installed from source version 2.5.0
Whenever I open Hatari and click the "Joysticks" button in the F12 options menu, Hatari closes without any error message. All the other options work and it does this regardless of what TOS or other options are configured in other options, it seems. Any help much appreciated!
- Eero Tamminen
- Fuji Shaped Bastard
- Posts: 3991
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Hatari crash on Joystick button click
As I'm not seeing that on my older distro version (regardless of whether I click the "Joysticks" with Joystick fire button or left mouse button), and you're first to report such an issue, I suspect that your setup differs from most people's setups somehow.Cyclohexane wrote: Mon Jul 01, 2024 1:24 pm I'm using Lubuntu (Ubuntu 24.04 LTS) and initially tried the version of Hatari that comes packaged (2.4.1) but have also installed from source version 2.5.0
Whenever I open Hatari and click the "Joysticks" button in the F12 options menu, Hatari closes without any error message.
Have you e.g. some special joysticks, or some special SDL library version?
And if you run Hatari from console, do you see any messages when it exits?
If not, what's the Hatari output with "--log-level debug" option?
Last edited by Eero Tamminen on Tue Jul 02, 2024 7:38 am, edited 1 time in total.
-
- Hardware Guru
- Posts: 4720
- Joined: Sat Sep 10, 2005 11:11 am
- Location: Kosice, Slovakia
- Contact:
Re: Hatari crash on Joystick button click
I'd check to what SDL is Hatari linked against (e.g. using 'ldd' command) and then test some other game using a joystick whether it works (making sure it is linked against the same SDL library). From the looks of it, I'd guess it's a SDL issue.
-
- Atarian
- Posts: 7
- Joined: Mon Jul 01, 2024 1:14 pm
Re: Hatari crash on Joystick button click
Ah ha, thank you. If run from the terminal it exits with "Segmentation fault (core dumped)" and it works fine if the joystick isn't connected. I'm using a Logitech F710. I haven't actually confirmed it was setup properly, just plugged it in and hoped for the best. I guess I need to find drivers for it and check that's working first.
-
- Atarian
- Posts: 7
- Joined: Mon Jul 01, 2024 1:14 pm
Re: Hatari crash on Joystick button click
Have now installed jstest-gtk from the Ubuntu packages (joystick testing util) and that shows the gamepad is detected and working ok.
-
- Atarian
- Posts: 7
- Joined: Mon Jul 01, 2024 1:14 pm
Re: Hatari crash on Joystick button click
Now checking the SDL side with another game which works fine with the joystick. It seems to be using the same version:
j@800g1dm:~$ ldd /usr/games/mrboom | grep -i sdl
libSDL2-2.0.so.0 => /lib/x86_64-linux-gnu/libSDL2-2.0.so.0 (0x0000762ae6a24000)
libSDL2_mixer-2.0.so.0 => /lib/x86_64-linux-gnu/libSDL2_mixer-2.0.so.0 (0x0000762ae75a6000)
j@800g1dm:~$ ldd /usr/local/bin/hatari | grep -i sdl
libSDL2-2.0.so.0 => /lib/x86_64-linux-gnu/libSDL2-2.0.so.0 (0x00007d2e4ea24000)
Anything else I can try? Thank you again for the help and suggestions.
j@800g1dm:~$ ldd /usr/games/mrboom | grep -i sdl
libSDL2-2.0.so.0 => /lib/x86_64-linux-gnu/libSDL2-2.0.so.0 (0x0000762ae6a24000)
libSDL2_mixer-2.0.so.0 => /lib/x86_64-linux-gnu/libSDL2_mixer-2.0.so.0 (0x0000762ae75a6000)
j@800g1dm:~$ ldd /usr/local/bin/hatari | grep -i sdl
libSDL2-2.0.so.0 => /lib/x86_64-linux-gnu/libSDL2-2.0.so.0 (0x00007d2e4ea24000)
Anything else I can try? Thank you again for the help and suggestions.
- Eero Tamminen
- Fuji Shaped Bastard
- Posts: 3991
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Hatari crash on Joystick button click
Ok, so Joystick in general should work, it's just the Joystick dialog that crashes.
Could you run Hatari under Valgrind (sudo apt install valgrind; valgrind hatari) or Gdb (sudo apt install gdb; gdb hatari) and provide the crash backtrace?
(In Gdb case, you need to use "run" to start Hatari and "bt" to get backtrace after Hatari crashes, in Valgrind case you get those without needing to do anything extra, but Valgrind is much slower as it emulates x86.)
Btw. why do you need Joystick dialog?
Hatari should automatically select real Joystick for joy1 port if one is available, and one can switch each joy port between none / keyboard / real joystick options using AltGr + F1 - F4 shortcuts, or switch joy0 & joy1 ports between keyboard / real joystick with AltGr + j shortcut.
Don't the Hatari joystick shortcut keys work for you?
Could you run Hatari under Valgrind (sudo apt install valgrind; valgrind hatari) or Gdb (sudo apt install gdb; gdb hatari) and provide the crash backtrace?
(In Gdb case, you need to use "run" to start Hatari and "bt" to get backtrace after Hatari crashes, in Valgrind case you get those without needing to do anything extra, but Valgrind is much slower as it emulates x86.)
Btw. why do you need Joystick dialog?
Hatari should automatically select real Joystick for joy1 port if one is available, and one can switch each joy port between none / keyboard / real joystick options using AltGr + F1 - F4 shortcuts, or switch joy0 & joy1 ports between keyboard / real joystick with AltGr + j shortcut.
Don't the Hatari joystick shortcut keys work for you?
-
- Atarian
- Posts: 7
- Joined: Mon Jul 01, 2024 1:14 pm
Re: Hatari crash on Joystick button click
Thanks for the shortcut keys, I hadn't tried those. None of the games I load in Hatari seem to detect the joystick. I've now used those shortcut keys to move it around the 4 joy ports but it doesn't seem to work on any of them. Here's the output from Valgrind when I click the Joystick button:
==5996== Memcheck, a memory error detector
==5996== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==5996== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==5996== Command: hatari
==5996==
INFO : Hatari v2.5.0, compiled on: Jul 1 2024, 13:28:46
WARN : Your system is too slow, some sound samples were not correctly emulated
==5996== Invalid read of size 4
==5996== at 0x48D01FA: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.3000.0)
==5996== by 0xCCEC8B: DlgJoystick_ReadValuesFromConf (in /usr/local/bin/hatari)
==5996== by 0xCCEDB7: Dialog_JoyDlg (in /usr/local/bin/hatari)
==5996== by 0xCC95A4: Dialog_MainDlg (in /usr/local/bin/hatari)
==5996== by 0x2CBAD1: Dialog_DoProperty (in /usr/local/bin/hatari)
==5996== by 0x3169B4: ShortCut_ActKey (in /usr/local/bin/hatari)
==5996== by 0x328DD8: Video_InterruptHandler_VBL (in /usr/local/bin/hatari)
==5996== by 0x377F58: m68k_run_1_ce (in /usr/local/bin/hatari)
==5996== by 0x372C29: m68k_go (in /usr/local/bin/hatari)
==5996== by 0x2B82C4: main (in /usr/local/bin/hatari)
==5996== Address 0x8 is not stack'd, malloc'd or (recently) free'd
==5996==
==5996==
==5996== Process terminating with default action of signal 11 (SIGSEGV)
==5996== Access not within mapped region at address 0x8
==5996== at 0x48D01FA: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.3000.0)
==5996== by 0xCCEC8B: DlgJoystick_ReadValuesFromConf (in /usr/local/bin/hatari)
==5996== by 0xCCEDB7: Dialog_JoyDlg (in /usr/local/bin/hatari)
==5996== by 0xCC95A4: Dialog_MainDlg (in /usr/local/bin/hatari)
==5996== by 0x2CBAD1: Dialog_DoProperty (in /usr/local/bin/hatari)
==5996== by 0x3169B4: ShortCut_ActKey (in /usr/local/bin/hatari)
==5996== by 0x328DD8: Video_InterruptHandler_VBL (in /usr/local/bin/hatari)
==5996== by 0x377F58: m68k_run_1_ce (in /usr/local/bin/hatari)
==5996== by 0x372C29: m68k_go (in /usr/local/bin/hatari)
==5996== by 0x2B82C4: main (in /usr/local/bin/hatari)
==5996== If you believe this happened as a result of a stack
==5996== overflow in your program's main thread (unlikely but
==5996== possible), you can try to increase the size of the
==5996== main thread stack using the --main-stacksize= flag.
==5996== The main thread stack size used in this run was 8388608.
==5996==
==5996== HEAP SUMMARY:
==5996== in use at exit: 27,346,775 bytes in 52,642 blocks
==5996== total heap usage: 169,764 allocs, 117,122 frees, 63,070,388 bytes allocated
==5996==
==5996== LEAK SUMMARY:
==5996== definitely lost: 0 bytes in 0 blocks
==5996== indirectly lost: 0 bytes in 0 blocks
==5996== possibly lost: 13,120,747 bytes in 44,944 blocks
==5996== still reachable: 14,226,028 bytes in 7,698 blocks
==5996== suppressed: 0 bytes in 0 blocks
==5996== Rerun with --leak-check=full to see details of leaked memory
==5996==
==5996== For lists of detected and suppressed errors, rerun with: -s
==5996== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
==5996== Memcheck, a memory error detector
==5996== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==5996== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==5996== Command: hatari
==5996==
INFO : Hatari v2.5.0, compiled on: Jul 1 2024, 13:28:46
WARN : Your system is too slow, some sound samples were not correctly emulated
==5996== Invalid read of size 4
==5996== at 0x48D01FA: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.3000.0)
==5996== by 0xCCEC8B: DlgJoystick_ReadValuesFromConf (in /usr/local/bin/hatari)
==5996== by 0xCCEDB7: Dialog_JoyDlg (in /usr/local/bin/hatari)
==5996== by 0xCC95A4: Dialog_MainDlg (in /usr/local/bin/hatari)
==5996== by 0x2CBAD1: Dialog_DoProperty (in /usr/local/bin/hatari)
==5996== by 0x3169B4: ShortCut_ActKey (in /usr/local/bin/hatari)
==5996== by 0x328DD8: Video_InterruptHandler_VBL (in /usr/local/bin/hatari)
==5996== by 0x377F58: m68k_run_1_ce (in /usr/local/bin/hatari)
==5996== by 0x372C29: m68k_go (in /usr/local/bin/hatari)
==5996== by 0x2B82C4: main (in /usr/local/bin/hatari)
==5996== Address 0x8 is not stack'd, malloc'd or (recently) free'd
==5996==
==5996==
==5996== Process terminating with default action of signal 11 (SIGSEGV)
==5996== Access not within mapped region at address 0x8
==5996== at 0x48D01FA: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.3000.0)
==5996== by 0xCCEC8B: DlgJoystick_ReadValuesFromConf (in /usr/local/bin/hatari)
==5996== by 0xCCEDB7: Dialog_JoyDlg (in /usr/local/bin/hatari)
==5996== by 0xCC95A4: Dialog_MainDlg (in /usr/local/bin/hatari)
==5996== by 0x2CBAD1: Dialog_DoProperty (in /usr/local/bin/hatari)
==5996== by 0x3169B4: ShortCut_ActKey (in /usr/local/bin/hatari)
==5996== by 0x328DD8: Video_InterruptHandler_VBL (in /usr/local/bin/hatari)
==5996== by 0x377F58: m68k_run_1_ce (in /usr/local/bin/hatari)
==5996== by 0x372C29: m68k_go (in /usr/local/bin/hatari)
==5996== by 0x2B82C4: main (in /usr/local/bin/hatari)
==5996== If you believe this happened as a result of a stack
==5996== overflow in your program's main thread (unlikely but
==5996== possible), you can try to increase the size of the
==5996== main thread stack using the --main-stacksize= flag.
==5996== The main thread stack size used in this run was 8388608.
==5996==
==5996== HEAP SUMMARY:
==5996== in use at exit: 27,346,775 bytes in 52,642 blocks
==5996== total heap usage: 169,764 allocs, 117,122 frees, 63,070,388 bytes allocated
==5996==
==5996== LEAK SUMMARY:
==5996== definitely lost: 0 bytes in 0 blocks
==5996== indirectly lost: 0 bytes in 0 blocks
==5996== possibly lost: 13,120,747 bytes in 44,944 blocks
==5996== still reachable: 14,226,028 bytes in 7,698 blocks
==5996== suppressed: 0 bytes in 0 blocks
==5996== Rerun with --leak-check=full to see details of leaked memory
==5996==
==5996== For lists of detected and suppressed errors, rerun with: -s
==5996== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
- Eero Tamminen
- Fuji Shaped Bastard
- Posts: 3991
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Hatari crash on Joystick button click
Only SDL function directly called from "DlgJoystick_ReadValuesFromConf()" is: https://wiki.libsdl.org/SDL2/SDL_NumJoysticks
And only way it could crash is it being either buggy, it e.g. crashing when being called multiple times, or something corrupting memory it uses.
This SDL function gets called indirectly: https://wiki.libsdl.org/SDL2/SDL_JoystickName
But as far as I can see, it should get correct args from Hatari, at least as long as:
* SDL_NumJoysticks() returns joystick(s) being available (not error code)
* Your Hatari config does not contain invalid (e.g. negative) Joystick mappings
=> Do you still get crash if you remove your Hatari config (from ~/.config/hatari/hatari.cfg) before running Hatari?
Also, does "--log-level" debug print any additional information about joysticks before the crash?
And only way it could crash is it being either buggy, it e.g. crashing when being called multiple times, or something corrupting memory it uses.
This SDL function gets called indirectly: https://wiki.libsdl.org/SDL2/SDL_JoystickName
But as far as I can see, it should get correct args from Hatari, at least as long as:
* SDL_NumJoysticks() returns joystick(s) being available (not error code)
* Your Hatari config does not contain invalid (e.g. negative) Joystick mappings
=> Do you still get crash if you remove your Hatari config (from ~/.config/hatari/hatari.cfg) before running Hatari?
Also, does "--log-level" debug print any additional information about joysticks before the crash?
-
- Atarian
- Posts: 7
- Joined: Mon Jul 01, 2024 1:14 pm
Re: Hatari crash on Joystick button click
That's it, you solved it! Deleting the config file has let me click into the joystick menu and also the joystick now works in the games. I've put the few settings back to what I had originally changed from the defaults and it continues to work. Huge thank you Eero!
-
- Atarian
- Posts: 7
- Joined: Mon Jul 01, 2024 1:14 pm
Re: Hatari crash on Joystick button click
In fact I didn't delete the original config, just moved it elsewhere. Now that I'm checking it, you were right about the reason too - all of sections for each joystick have an nJoyId of -1
- Eero Tamminen
- Fuji Shaped Bastard
- Posts: 3991
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Hatari crash on Joystick button click
Thanks for checking that!Cyclohexane wrote: Fri Jul 05, 2024 8:03 pm In fact I didn't delete the original config, just moved it elsewhere. Now that I'm checking it, you were right about the reason too - all of sections for each joystick have an nJoyId of -1
I've pushed fix for the issue to Hatari Git: https://git.tuxfamily.org/hatari/hatari ... 27b39a33fc
-
- Forum Administrator
- Posts: 5834
- Joined: Wed Oct 23, 2002 4:36 pm
- Location: Friedrichshafen, Germany
- Contact:
Re: Hatari crash on Joystick button click
For clarification, is that 1:1 the patch that you posted on the mailing list?Eero Tamminen wrote: Sun Jul 07, 2024 5:52 pm I've pushed fix for the issue to Hatari Git: https://git.tuxfamily.org/hatari/hatari ... 27b39a33fc
Simon Sunnyboy/Paradize - http://paradize.atari.org/
Stay cool, stay Atari!
1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee
Stay cool, stay Atari!
1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee
- Eero Tamminen
- Fuji Shaped Bastard
- Posts: 3991
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Hatari crash on Joystick button click
No, I added the improvement suggested by Thomas (for handling broken config values on startup), reordered couple of joy.c lines for readability and added release note about the fix.simonsunnyboy wrote: Mon Jul 08, 2024 2:43 pmFor clarification, is that 1:1 the patch that you posted on the mailing list?Eero Tamminen wrote: Sun Jul 07, 2024 5:52 pm I've pushed fix for the issue to Hatari Git: https://git.tuxfamily.org/hatari/hatari ... 27b39a33fc
-
- Forum Administrator
- Posts: 5834
- Joined: Wed Oct 23, 2002 4:36 pm
- Location: Friedrichshafen, Germany
- Contact:
Re: Hatari crash on Joystick button click
In this case I will update and test again but I do not expect ill effects.Eero Tamminen wrote: Mon Jul 08, 2024 6:55 pmNo, I added the improvement suggested by Thomas (for handling broken config values on startup), reordered couple of joy.c lines for readability and added release note about the fix.simonsunnyboy wrote: Mon Jul 08, 2024 2:43 pmFor clarification, is that 1:1 the patch that you posted on the mailing list?Eero Tamminen wrote: Sun Jul 07, 2024 5:52 pm I've pushed fix for the issue to Hatari Git: https://git.tuxfamily.org/hatari/hatari ... 27b39a33fc
Simon Sunnyboy/Paradize - http://paradize.atari.org/
Stay cool, stay Atari!
1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee
Stay cool, stay Atari!
1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee