Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XinputDevice.cpp limited to one Xinput device? #8250

Closed
RowdyRocket opened this issue Dec 1, 2015 · 5 comments
Closed

XinputDevice.cpp limited to one Xinput device? #8250

RowdyRocket opened this issue Dec 1, 2015 · 5 comments

Comments

@RowdyRocket
Copy link

With the ability to now do multiplayer on the same PC with port shifting opens the requirement for detection of multiple gamepads. I am able to connect multiple PPSSPP's using Onelight's port shifting though it is unable to detect any other controllers other then the first connected.

Could this be the cause?

Extracted from XinputDevice.cpp

        // If there's an XInput pad, skip following pads. This prevents DInput and XInput
        // from colliding.
        return UPDATESTATE_SKIP_PAD;

I've been out of programming for a while now so sorry if I'm chasing the wrong thread but I've also noticed that people using Dinput controllers don't seem to have the same issue. So perhaps this is the cause?...

Extracted from XinputDevice.cpp

            key.deviceId = DEVICE_ID_X360_0;

Extracted from DinputDevice.cpp

        key.deviceId = DEVICE_ID_PAD_0 + pDevNum;

Notice the XinputDevice has no integer for multiple controllers. On my system it detects it as x360.

For those using DinputDevice they are detected as Pad1, Pad2, etc.

Then there's this...

Extracted from KeyMap.cpp

const char *GetDeviceName(int deviceId) {
    switch (deviceId) {
    case DEVICE_ID_ANY: return "any";
    case DEVICE_ID_DEFAULT: return "built-in";
    case DEVICE_ID_KEYBOARD: return "kbd";
    case DEVICE_ID_PAD_0: return "pad1";
    case DEVICE_ID_PAD_1: return "pad2";
    case DEVICE_ID_PAD_2: return "pad3";
    case DEVICE_ID_PAD_3: return "pad4";
    case DEVICE_ID_PAD_4: return "pad5";
    case DEVICE_ID_PAD_5: return "pad6";
    case DEVICE_ID_PAD_6: return "pad7";
    case DEVICE_ID_PAD_7: return "pad8";
    case DEVICE_ID_PAD_8: return "pad9";
    case DEVICE_ID_PAD_9: return "pad10";
    case DEVICE_ID_X360_0: return "x360";
    case DEVICE_ID_ACCELEROMETER: return "accelerometer";
    case DEVICE_ID_MOUSE: return "mouse";
    default:
        return "unknown";
    }
}

Dinput allows for up to 10 controllers.
Xinput only allows 1.

Been forever since I've done any programming. Several of my friends and myself are anxious to get this working any help would be amazing.

Thanks!

@unknownbrackets
Copy link
Collaborator

PPSSPP only supports one controller input at a time. UPDATESTATE_SKIP_PAD was added because some controllers support BOTH xinput and directinput - and so you get the button press TWICE from two different devices. This simply makes xinput "win", and ignores DirectInput when an XInput controller is detected.

Perhaps there's another option, though, which would allow using the other directinput devices when an xinput device is configured. Your basic problem is that you want to be able to map buttons on other controllers, right?

-[Unknown]

@RowdyRocket
Copy link
Author

Good to know. Thanks for the info. Yeah, I have four xInput controllers and I'm only able to use one, the others are ignored making it impossible to do multiplayer on one PC. Maybe make it ignore dInput if x is detected?

Doesn't seem to be a problem on any other emulator or program I've used. Maybe I'll dig into Dolphin and get some ideas?

@lightfirst
Copy link

@RowdyRocket have you make 2 x360 controllers work?

@RowdyRocket
Copy link
Author

Not without issues yet. If you're only needing two players you can use AntiMicro for your second controller. The second players window has to be active as you play but it works for now.

@hrydgard
Copy link
Owner

@RowdyRocket That should have made this usable, at least. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants