libretro / LRPS2

GNU General Public License v2.0
163 stars 47 forks source link

Crash when connecting/disconnecting a controller #95

Closed bslenul closed 2 years ago

bslenul commented 3 years ago

Hey!

Atm the core crashes whenever you connect or disconnect a controller. It doesn't crash if RetroArch menu is open however. Nothing helpful in logs, and no crash log being created with RetroArch built with Dr. Mingw.

Tested with a DS4 and a 8bitdo controller, it doesn't seem to matter if it's wired or bluetooth, it crashes in both cases. Tested on Windows 10 only, I don't have a Xbox and the core doesn't run on my Linux VM unfortunately.

Not a high priority issue of course, in most cases the controller is already connected when launching a game and as a workaround you can just open the Quick Menu when connecting/disconnecting the controller ;) Could be more problematic if you lose BT connection for example or if controller's battery runs out.

covey-j commented 3 years ago

It'd be worth checking earlier builds to see whether this is a regression. I vaguely remember having this issue a while ago, but not after ~#56 or so (possibly earlier. I don't remember too well)

SeventySixx commented 3 years ago

I confirm that this issue was present from the beginning, I always had this problem. Also on the docs this problem is listed (first sentences): https://docs.libretro.com/library/pcsx2/

EDIT: in the past I gave a look on it, IIRC was a memory violation exception

covey-j commented 3 years ago

@SeventySixx Has it been consistently present the whole time or were there intermediate builds where this wasn't as much of a problem?

I distinctly remember having this problem back in May, but it seemed like it wasn't happening much anymore last time I was working on it (which I guess was a couple weeks ago). I may be remembering this incorrectly, though. It could be I was just setting my test environment up deliberately to avoid the issue.

SeventySixx commented 3 years ago

To me it's happened every time that I connected the controller while the game is running. Maybe the type of controller? I use a dual sense (which is detected as DS4). Without using DS4Windows

EDIT: for those who ask, I'm not a lucky owner of an impossible-to-find-ps5... I just bought a DS because I think it's a great gamepad also for retrogaming 😄

bslenul commented 3 years ago

Dunno if it helps, I ran a RA debug build with gdb:

Thread 31 "EE Core" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 10284.0x24ac]
0x000000000040255e in input_state_wrap (p_rarch=0x1355ce0 <rarch_st>,
    data=0x181030c0, joypad=0x0, sec_joypad=0x0, joypad_info=0x17f1f8f0,
    binds=0x1374220 <rarch_st+124224>, keyboard_mapping_blocked=false,
    port=0, device=1, idx=0, id=256) at retroarch.c:369
warning: Source file is more recent than executable.
369     size_t menu_navigation_get_selection(void)
(gdb) bt full
#0  0x000000000040255e in input_state_wrap (p_rarch=0x1355ce0 <rarch_st>,
    data=0x181030c0, joypad=0x0, sec_joypad=0x0, joypad_info=0x17f1f8f0,
    binds=0x1374220 <rarch_st+124224>, keyboard_mapping_blocked=false,
    port=0, device=1, idx=0, id=256) at retroarch.c:369
        current_input = 0xd24860 <input_dinput>
        ret = 0
#1  0x00000000004313f6 in input_state (port=0, device=1, idx=0, id=256)
    at retroarch.c:22806
        joypad_info = {auto_binds = 0x1346d60 <input_autoconf_binds>,
          axis_threshold = 0.5, joy_idx = 0}
        p_rarch = 0x1355ce0 <rarch_st>
        settings = 0xacf8240
        result = 0
        ret = 0
        sec_joypad = 0x0
#2  0x00000000004536c4 in core_input_state_poll_late (port=0, device=1,
    idx=0, id=256) at retroarch.c:38272
        p_rarch = 0x1355ce0 <rarch_st>
#3  0x000000001b3f3c2f in retro_unserialize ()
   from G:\msys64\home\B-S\retroarch\build\cores\pcsx2_libretro.dll
No symbol table info available.
#4  0x000000001b7c1ea5 in retro_set_input_state ()
   from G:\msys64\home\B-S\retroarch\build\cores\pcsx2_libretro.dll
No symbol table info available.
#5  0x000000001b45dccc in retro_set_input_state ()
   from G:\msys64\home\B-S\retroarch\build\cores\pcsx2_libretro.dll
No symbol table info available.
#6  0x000000001b42e456 in retro_set_input_state ()
   from G:\msys64\home\B-S\retroarch\build\cores\pcsx2_libretro.dll
No symbol table info available.
#7  0x000000004414d714 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
bslenul commented 2 years ago

AFAICT this is fixed with https://github.com/libretro/RetroArch/pull/12908 👍