Controllable (Forge)

Controllable (Forge)

4M Downloads

Autoselect controller xInput2 xInput3 etc?

dennore opened this issue · 8 comments

commented

Hey…

Is there a way to tell my minecraft instance with controller id it will autoselect?

Background: i want to use multimc with 4 controllers but dont want to hassle ingame settings to set the correct controller on each startup…

nucleos coop didnt work … all instances show all 4 controllers and it always take xinput1 on all 4 instances. Also i dont need mice/keyboard anyways…

if not can you implement that easily?

regards
Dennor

commented

ok never mind i found a guide to compile it on the forge website

and i have to say, that it works perfectly as expected.
i compiled 3 versions with GLFW.GLFW_JOYSTICK_2-4
and placed it in the mods folder for each instance
now all 4 instances get different controllers assigned, (as long as they are connected when i start the instance?!)

when i disconnect and reconnect controller4 then the 4th. minecraft messes up and will not reassign the controller?!
i dont know why
when i restart the 4th. minecraft instance it assigns the 4th controller back correctly

commented

Unfortuantely there is no way to uniquely identifier controllers, which makes it difficult to auto connect back to the correct one. The only method would be to remember the name of the last controller, however this will not work nicely since if you have two of the same controller it won't know which is the correct one. I don't think I can implement this feature reliably unfortuantely.

commented

Maybe a screenshot will show my issue better... i always need to set player2-4 manually, because it only auto-connects to 1st controller by default... then you can controll all 4 instances with the same controller o.0

image

can you send me a jar file with GLFW.GLFW_JOYSTICK_2 i would love to test if it works, but i failed miserably trying to compile java :(

commented

What about controllable.java line 163
I wouldn’t be GLFW.GLFW_JOYSTICK_2 just the second controller on the system?

/* Attempts to load the first controller connected if auto select is enabled */
if(Config.CLIENT.options.autoSelect.get())
{
if(GLFW.glfwJoystickPresent(GLFW.GLFW_JOYSTICK_1) && GLFW.glfwJoystickIsGamepad(GLFW.GLFW_JOYSTICK_1))
{
setController(new Controller(GLFW.GLFW_JOYSTICK_1));
}

commented

GLFW_JOYSTICK_X isn't guaranteed to be the same controller. It depends on when it's plugged in and how it's handled by the OS.

commented

I fixed autoselecting to happen on each connect of a new gamepad... so it always works now even when game already running... this mod is so awesome now. Thanks Mr. crayfish

commented

Hey MrCrayfish,

i just noticed your fabric version and its working awesome for me already! thanks so much,
now i can use vulkanmod together with controller !!! my kids will love you for that fps boost,
when they play splitscreen on the TV.
but could you please consider again to add the feature to set the prefered controller id like i described before? please , please, please 🙏

default is first (1) and then the user can choose up to 16? 🤔

image

commented

Hey MrCrayFish,

can you give me some hope, that you might implement this feature?

thanks and best wishes
dennor