SK.Libretro icon indicating copy to clipboard operation
SK.Libretro copied to clipboard

Input Processor requires Singleton and can not be instances with multiple cores running

Open XenuIsWatching opened this issue 2 years ago • 4 comments

The Input Processor requires the PlayerInputManager which is a singleton class. This means that only one can exist. So if multiple LibretroInstances are running at the same time the OnPlayerJoined will be called at the same time for all running instances whenever a player wants to join a specific instance.

Essentially what happens if the player presses "Start Button", all instances will receive the "Start Button" Action.

How I have this set is with a PlayerInputManager with the "Join Behavior" set to "Join Players Manually", where the player can walk up in the virtual environment to a console/arcade and press a button and it will join them to that libretro instance, but whats happening is that it will joing them to ALL libretro instances.

XenuIsWatching avatar Aug 29 '23 18:08 XenuIsWatching

Video showing what's going on here

https://youtu.be/ncOWxODxG1M

XenuIsWatching avatar Aug 29 '23 20:08 XenuIsWatching

In the current implementation there's no way to "disconnect" a player, say you join as player 1 on a keyboard, then you're the player 1 on keyboard for all instances. The join behavior is basically scene based rather than libretro instance based. This should be pretty easy to modify so you can join and quit manually, going the way you started handling it.

Outside of player joining, the implemented way to enable or disable input for one instance is to set the EnableInput property to true or false on the bridge instance. Under the hood it queues a EnableInputThreadCommand command to the bridge, which simply disables input processing on the wrapper (aka the actual core callback from the core), or rather returns false for all inputs as far as the core is concerned.

Skurdt avatar Aug 29 '23 20:08 Skurdt

Thanks, I just went through your suggestion and use the enable input property with toggling that bool

XenuIsWatching avatar Sep 13 '23 22:09 XenuIsWatching

hi. I can't use the quest 2 controller as input device to play with the games. Can you explaine me how you have set the controller to play with the emulator games?

stefanoditore avatar Apr 12 '24 13:04 stefanoditore