[BUG]: Crash when switching to NeGcon while a macro is configured that uses a button not found in it
Describe the Bug
When switching to NeGcon while a macro is configured using a face button, PCSX2 crashes.
It also crashes when choosing Start, L or R as macro triggers.
Reproduction Steps
- Set controller to DualShock 2
- Create a macro using one of the face buttons or any button that is not found in a NeGcon
- Switch controller to Negcon
Expected Behavior
No crash and macro trigger button is removed or reassigned to a valid button.
PCSX2 Revision
v2.5.288
Operating System
Linux (64bit) - Specify distro below
If Linux - Specify Distro
Arch
Logs & Dumps
$ ./pcsx2-v2.5.288-linux-appimage-x64-Qt.AppImage
*************** Unhandled SIGSEGV at 0x7fcf8098001c ***************
0x00560db3bfe609 LogCallstack [/home/runner/work/pcsx2/pcsx2/build/../common/CrashHandler.cpp:284]
0x00560db3bfe4f3 CrashSignalHandler [/home/runner/work/pcsx2/pcsx2/build/../common/CrashHandler.cpp:315]
0x00560db3c1c7d3 SignalHandler [/home/runner/work/pcsx2/pcsx2/build/../common/Linux/LnxHostSys.cpp:341]
0x007fcf8083e4cf
0x007fcf8098001c
0x00560db36e69cb length [/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/char_traits.h:399]
0x00560db36e69cb basic_string_view [/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/string_view:134]
0x00560db36e69cb GetBindIndex [/home/runner/work/pcsx2/pcsx2/build/../pcsx2/SIO/Pad/Pad.cpp:83]
0x00560db36e69cb LoadMacroButtonConfig [/home/runner/work/pcsx2/pcsx2/build/../pcsx2/SIO/Pad/Pad.cpp:658]
0x00560db36e69cb LoadConfig [/home/runner/work/pcsx2/pcsx2/build/../pcsx2/SIO/Pad/Pad.cpp:145]
0x00560db34056f4 LoadSettings [/home/runner/work/pcsx2/pcsx2/build/../pcsx2/VMManager.cpp:608]
0x00560db3406b38 ApplySettings [/home/runner/work/pcsx2/pcsx2/build/../pcsx2/VMManager.cpp:728]
0x007fcf811dc4b7
0x007fcf82791bda
0x007fcf81182fc1
0x007fcf81186a34
0x007fcf8147f4d6
0x007fcf7f30dd3a
0x007fcf7f3632b7
0x007fcf7f30b3e2
0x007fcf8147eb6d
0x007fcf8118f0ba
0x00560db386ff4a run [/home/runner/work/pcsx2/pcsx2/build/../pcsx2-qt/QtHost.cpp:399]
0x007fcf81342e3d
0x007fcf8089698a
0x007fcf8091a9cb
0xffffffffffffffff
*******************************************************************
Aborting application.
Aborted (core dumped) ./pcsx2-v2.5.288-linux-appimage-x64-Qt.AppImage
Seems to be because of the unused button here (line 24): https://github.com/PCSX2/pcsx2/blob/79400acf2add8ab8280068859fa8bc320e4e6ac2/pcsx2/SIO/Pad/PadNegcon.cpp#L14-L33
it ends up doing a name comparison with a null value, no crash if I delete that {}, line.
It also removes that empty button from the macros list:
edit: Jogcon has 3 empty buttons as well. No idea if removing them has any side effect however 🤷 Guitar and Pop'n Music controllers don't have these "placeholders".
edit2: Removing these empty binds doesn't seem to affect automatic mapping (tested with keyboard and a controller), seems fine in-game as well (tested both NeGcon and Jogcon with Ridge Racer V).
#11962
Chiming in that I am experiencing this crash also on the latest Nightly build of the Windows release as of making this post, v2.5.369. I had a macro bound to R2 of the Dualshock (I actually don't remember what it was for?) and unbinding it stopped the crash.