Cemu
Cemu copied to clipboard
[Linux] Rapid SDL Controller Reconnects Can Crash Cemu
- Commit compiled with:
2200cc0ddf61d345c774daccdbadd92a00133890
- Log:
- Details:
I had Cemu crash while I was playing the other day but didn't quite know how to reproduce it since it kind of just seemed to happen spontaneously, so I decided to start running Cemu with GDB until I could get it to happen again and see what it could have been.
It seems as though the issue is that Cemu doesn't always handle rapid SDL controller disconnects and reconnects and it crashes by throwing an assertion when defining an array related to motion sensor information:
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../include/c++/13.1.1/array:202:
std::array::reference std::array<SDLControllerProvider::MotionInfoTracking, 8>::operator[](std::array::size_type) [_Tp = SDLControllerProvider::MotionInfoTracking, _Nm = 8]: Assertion '__n < this->size()' failed.
In context for when this happens for me, I was charging a PS4 controller (which has a motion sensor) with a slightly loose cable (because I lost the original cable it came with) and Cemu either stutters when it wiggles out of place and reconnects quickly or crashes as a result regardless if motion controls are disabled in the controller configuration.
Other Information:
- OS: Arch Linux
- Compiler flags used:
CC=clang
CXX=clang++
AR="/usr/bin/llvm-ar"
NM="/usr/bin/llvm-nm"
AS="/usr/bin/llvm-as"
RANLIB="/usr/bin/llvm-ranlib"
OBJCOPY="/usr/bin/llvm-objcopy"
CFLAGS="-g -O3 -pipe -fno-plt -fpic -fpie -Wl,-z,relro,-z,now -w \
-fexceptions -Wp,-D_FORTIFY_SOURCE=2 \
-Wformat -Werror=format-security \
-fstack-clash-protection -fstack-protector-strong -fcf-protection \
-march=znver2 -mtune=znver2"
CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-lc++abi -fuse-ld=lld -unwind=libunwind -pie -Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now"
I'm facing similar issues with the ARM macOS as well. My PS4 controller seems to be randomly disconnecting, sometimes changing the light from blue to red (sounds like https://github.com/RPCS3/rpcs3/issues/12290, but I'm not sure) and connecting it again sometimes triggers the crash.