Closed albertofustinoni closed 6 years ago
I'm using the retro_controller_description/retro_controller_info stuff mentioned here : https://github.com/libretro/RetroArch/issues/5375 . Everything works fine for me.
I can only see this happening if retro_set_controller_port_device is not called by your frontend.
I added some default value, perhaps it will help.
Ok, i just noticed retro_set_controller_port_device won't be called by retroarch as long as you don't go select something in the core controls menu (Quick Menu > Controls), so having a default value when nothing is selected seems like a good idea. I think your issue is fixed with my latest commit, waiting for your confirmation.
Your changes fixed the issue for me. Thank you very much.
I am indeed not calling retro_set_controller_port_device
in my front end: I thought doing so was optional based on this
By default, RETRO_DEVICE_JOYPAD is assumed to be plugged into all available ports.
Is my understanding wrong? If so, should I call this before or after retro_load_game
?
Looks to me like retroarch is calling it after game and environment are loaded, but only if it is set to something else than default. It didn't work in my code because i was setting default through it.
Better ask @twinaphex or @fr500 for more information.
It was a bug in RA, it's fixed now, it seems to have been there for a long time! It only happened when controller_info was set and the device was retropad
BTW the latest 2 commits are crashing on load for every game on windows.
Latest 2 commits crashing on windows is totally weird, are you sure that's only the 2 latest ? I just removed a word from a string and an unused variable. Furthermore, it doesn't seem to crash on msvc/uwp.
I'll do a full bisect and let you know the exact commit
On Sep 15, 2017 1:07 AM, "barbudreadmon" notifications@github.com wrote:
Latest 2 commits crashing on windows is totally weird, are you sure that's only the 2 latest ? I just removed a word from a string and an unused variable.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libretro/fbalpha/issues/153#issuecomment-329690670, or mute the thread https://github.com/notifications/unsubscribe-auth/ABpC0NCq14-kJbvfR2Ue0RiUu3f0htBHks5sihQ5gaJpZM4PR_8j .
b20cfd4a92c6651d5060c71f780037e7fa07c4f7 is the first bad commit
commit b20cfd4a92c6651d5060c71f780037e7fa07c4f7
Author: barbudreadmon <barbudreadmon@gmail.com>
Date: Sat Sep 9 19:48:12 2017 +0200
Initialize controls + some input mapping WIP
:040000 040000 7cfcf3abfd42c647d47b2e67da297d2dfdf34dd3 82787539beb85f19ab28dfce81c56e8ffbfcae8a M src
Tried to get a backtrace but I keep getting a corrupt stack
On the previous commit it works fine but I noticed it calls the code that sets the ports A LOT during init: https://hastebin.com/usuwopofol.coffeescript
That's just one content load
This is really really weird...
Crash on cps3
Thread 1 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 10216.0x2ae0]
0x0000000021bdb9c3 in DrvDraw () at src/burn/drv/cps3/cps3run.cpp:1939
1939 *dstbitmap = Cps3CurPal[ srcbitmap[srcx>>16] ];
(gdb) bt
#0 0x0000000021bdb9c3 in DrvDraw () at src/burn/drv/cps3/cps3run.cpp:1939
#1 0x0000000021bdbdbc in cps3Frame () at src/burn/drv/cps3/cps3run.cpp:2031
#2 0x0000000021a6a56b in BurnDrvFrame () at src/burn/burn.cpp:719
#3 0x000000002260e605 in ForceFrameStep ()
at src/burner/libretro/libretro.cpp:802
#4 0x000000002260face in retro_run ()
at src/burner/libretro/libretro.cpp:1302
#5 0x00000000004027b9 in core_run () at core_impl.c:415
#6 0x0000000000407661 in runloop_iterate (sleep_ms=sleep_ms@entry=0x58efde0)
at retroarch.c:3093
#7 0x00000000004016c0 in rarch_main (argc=<optimized out>,
argv=<optimized out>, data=0x0) at frontend/frontend.c:131
#8 0x000000000070bdd8 in main_getcmdline ()
#9 0x00000000004013f8 in __tmainCRTStartup ()
at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:334
#10 0x00000000004014eb in WinMainCRTStartup ()
at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:184
crash on cps2
[Switching to Thread 10840.0x1cd0]
0x00007fff132d388a in msvcrt!memset () from C:\WINDOWS\System32\msvcrt.dll
(gdb) bt
#0 0x00007fff132d388a in msvcrt!memset () from C:\WINDOWS\System32\msvcrt.dll
#1 0x0000000021852925 in CpsClearScreen ()
at src/burn/drv/capcom/cps_draw.cpp:485
#2 0x0000000021852996 in DoDraw (Recalc=1)
at src/burn/drv/capcom/cps_draw.cpp:496
#3 0x00000000218529bf in CpsDraw () at src/burn/drv/capcom/cps_draw.cpp:503
#4 0x0000000021834111 in Cps2Frame () at src/burn/drv/capcom/cps_run.cpp:460
#5 0x000000002172a56b in BurnDrvFrame () at src/burn/burn.cpp:719
#6 0x00000000222ce605 in ForceFrameStep ()
at src/burner/libretro/libretro.cpp:802
#7 0x00000000222cface in retro_run ()
at src/burner/libretro/libretro.cpp:1302
#8 0x00000000004027b9 in core_run () at core_impl.c:415
#9 0x0000000000407661 in runloop_iterate (sleep_ms=sleep_ms@entry=0x58efde0)
at retroarch.c:3093
#10 0x00000000004016c0 in rarch_main (argc=<optimized out>,
argv=<optimized out>, data=0x0) at frontend/frontend.c:131
#11 0x000000000070bdd8 in main_getcmdline ()
#12 0x00000000004013f8 in __tmainCRTStartup ()
at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:334
#13 0x00000000004014eb in WinMainCRTStartup ()
at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:184
It makes no sense but I tried the exact two games one commit before and this doesn't happen...
So the crash started with my latest commit ? That's indeed weird, i'm just initializing default values in the array where i store the port => device relationship (to fix this issue), and i have some serious doubts my WIP unused function is at fault.
Just a guess, your crash wouldn't be related to the fact i use retro device subclasses id in retro_input_state/retro_input_descriptor stuff ? I reported about it there : https://github.com/libretro/RetroArch/issues/5439 , feels to me like there is indeed issues with doing that. Do you have anything peculiar in your config's input_libretro_device_pX values ? I would recommend setting them all to 1 to see if the issue keeps happening.
I set them to 1 but it still crashed, actually there is a fallback method for those, when the core doesn't support a device id, it does a fallback to 1 right away.
I find it weird that it sets the input descriptor so many times on core startup. Why is it doing that?
It calls the init_input function (which then calls RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS through the set_input_descriptors function) every time it sets a device through retro_set_controller_port_device, i'll add something to detect if old device is different from new device and call it only if it is.
Done, let me know if it removed the crash
Sadly it didn't... We have an IRC (#libretro on freenode) and a discord channel (https://discord.gg/011l9DB6qWt9B4bzO) if you want to interact directly.
I don't think i'll have time to connect to irc today (didn't use irc for the last 15 years), but i'll try tomorrow. Could you confirm me https://github.com/libretro/fbalpha/commit/28d07c296c15baa45096b8c51a54db4c19bd914d is the last working commit for you ?
@retro-wertz nailed on the problem
So retro_set_controller_port_device will be called from port 0 to 15 even though i declared 5 controllers through RETRO_ENVIRONMENT_SET_CONTROLLER_INFO ? Isn't that kinda a bug in retroarch ?
No wonder there would be so many calls to RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS through init_input : i never initialized fba_devices[5] to fba_devices[15] so of course new value would be different from old value. i'll add
if (port > 4) return;
in my next commit (fba have maximum of 5 players). Right now i'm working on macros (i'm moving them from core options to input descriptors) so i won't commit right away.
Also, i've been wondering, is there any way to declare an input_descriptor without setting a button to it ? It would be nice : there can be up to 11 macro for 1 player in fba, declaring them to the ui while letting the user assign them would be a good thing since i can't assign them all (not enough buttons on a retropad), it would also potentially solve my issues with coleco.
set_controller_info sets the possible controllers that can be plugged in each port, but RA itself has 16 possible ports.
But yeah sounds like it should respect max_players.
And nope, I actually was trying to add a dummy button but I haven't managed yet but I'm still working on improving remaps so it may be possible at some point.
Regarding Coleco, well you could set it to RETRO_DEVICE_KEYBOARD and it would use the keymapper but I still don't have a way for the core to provide a default keymap...
I'll wait before moving macros then, or we'll lose access to some macro, i commited the fix for ports > 4 . Also, i think i need to clean up some code : there are tons of functions called multiple times when it could be avoided.
@fr500 - on a similar case, looks like other cores who normally do not set limit number of ports to retro_set_controller_port_device() has this calling the function 15 times (px68k)
ah! I'll take a look, I added the controllers stuff.
I am having lot of troubles with SEGA games (like G-Loc, After Burner, Outrun, etc.) which doesn't let me use the DPad to play
The arcade cabinet for those games (mainly racing games and flying simulators) used analog controls for directions (wheel and such), so the emulator do the same. iirc there is an option in Quick Menu > Controls (just below the device type) you can enable to translate dpad to analog controls, ofc it means you won't be able to "turn at half power".
Silly me, that make sense, thanks for the enlightenment
Got the latest changes from the repo and now input doesn't work anymore. I see you refactored input code, so I'd like to ask: has something changed and you need some env callbacks to get input working now?