Closed stefanoditore closed 6 months ago
also, there is a way to forse the player join with the keyboard and mouse processor profile ?
The first input device you use will be player 1, any other devices used afterwards will add more players.
You can add quest controller bindings (or any other device supported by unity) to the Input System Asset (LibretroInputActions.inputactions). The current configuration includes mouse/keyboard and gamepad.
The device gets registered only after the game launched, so you can technically start the game with a mouse using the menu, and use the quest controller to play the game afterwards.
For a more advanced input configuration (like multiple devices for a single player), you will have to implement your own logic and replace the existing one for player joining.
Thank you very much for your response. I will try to modify the scripts as you suggested tomorrow. However, the strange thing is that every time I press a button or joystick on the Quest controller, a new player is added. Instead of associating the Quest controller with the library, is it possible to make Libretro ignore input from Quest controllers?
Does it add player 2 or a player for every single button? this seems really strange.
If your quest is mapped using a tool to press keys on the keyboard this is not a library issue I think. It will obviously see 2 devices.
You could go into InputProcessor.cs and prevent the script to add more players besides player 1 (ie. stop adding stuff in the Dictionary if there is anything in there). Or use manual joining on the PlayerInput component to add players manually.
it add players every time i touch any button om the quest controller. I don't know why. how i can use manual joining on the PlayerInput component to add players manually? i am using the project from the link in the github. Can you explain me this step? thanks
ok, i have edited the inputprocessor.cs script and now i just have player1 and, as you say, the devices get registered only after the game launched, so i lounch the game with keyboard and mouse and it registred only them. But everytime i need to loynch the game and after activate the quest2 and his controller. there is a way to force the library to start with mouse and keyboard also if there are otbers devices connected? and just the last question, there are differences between the "usage example" project linked in the page and the library of this github? thankyou for your support.
When you start a game it doesn't register any device, it also doesn't matter what is connected. It only adds a player when you press something after a core has launched (you can see in the console when a new player joins). If you only want mouse and keyboard, just press any key after a core has started.
If the goal is to use VR, it would be much easier to setup your scene as a proper VR project and start games using quest controllers and normal VR interactions. And also setup the libretro input asset to have the proper quest button bindings (as opposed to use a keyboard mapper).
The sample project contains the scene with the menu and basic mouse interaction to start the library with a specific core and rom. It has this repository as a dependency (in Packages/manifest.json). Cloning the sample repo will pull this automatically (adding the dependency to your own project will do the same). To modify anything in this without unity complaining, you have to clone this repo as a subfolder in Packages.
thankyou. this is a fantastic library
Hi, sorry to bother you again. I followed your advice and recreated the project from scratch (without using the example one from the link). I set the join behavior to a specific input action and limited the number of players to 1. In the previous project, I hadn't modified the input action asset, but I had imported a wrapper library that simulated physical button input so I could play with the Oculus Quest controllers. Now I have recreated the project and I would like to avoid using this workaround. So I have modified the libretro actions asset by adding bindings for the Quest controllers. However, I ran into some problems. Adding the Quest controller buttons to the actions (and exporting the class with the same name and namespace) makes the controller inputs (for now I have only tried the thumbsticks) work if I instantiate the class (e.g. GamepadUp.performed, start or complete is detected and I can associate any method with it) but it is not detected by the game. I don't know if I need to modify the inputplayerprocessor or inputpricessor scripts by adding something to make the event detectable. Even though, since these are input actions, once triggered by any physical input or should they still be detected by the emulator (even if in fact they don't happen), or am I wrong? Can you give me some suggestions or examples? Thank you very much for your availability.
The library's input script don't need modifications at all to get other input devices working (at least common ones, even the quest 2 touch controllers). You only need to add the bindings on the input asset.
I added a vr scene example on the LibretroUnityFE repo (https://github.com/Skurdt/LibretroUnityFE). Only analog, a, b, start, select are bound. I didn't have to limit to 1 player to get it working but don't use any keyboard, mouse or gamepad to prevent adding players.
My guess is that your vr scene is not setup correctly. (Mine is very basic but it does allow to start the game using the menu and the touch controllers).
hello, thankyou for your work. I have tried your vr project but the analog of quest controller not work (the buttons yes), i cannont understand why.
if it's for a different core than the one I used (mame2003plus), then you would have to add bindings for the d-pad
ok, i try and now the controllers work. I have only a problem when i change game. I have set the gamesdirectiry with "application.datapath" and it seems that all work, but when i change game rom, the new rom is loaded and work, but i have a lot of problem from the burst compiler. The right way to change rom is to call the function Stopcontent() and after the startcontent(core, directory, romname)? I have also tryed to stopallcoroutines, to deinizialize, to deactivate the libretroinstance component, to destroy it or the gameobject, but however i have errors. There is something that i have to do to change rom in runtime?
If the controller problem is solved, I'd rather you close this issue and open new ones for other unrelated issues. It would also help to describe the use case (what core/rom), as well as what kind of error (with console logs, or anything else that could help).
ok. thankyou
problem solved
hello, i am working on a project with quest 2. When i toch any keys on the joypad a new player join in. There is a way to avoid this? moreover, i am trying to use a keyboard wrapper to be able to use quest controller to play with the emulators, but i can't start the game with the quest controller. There is a way to use the quest controller to send input to the emulator? thanks