-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
filter the sdl joystick number via command line #17503
base: master
Are you sure you want to change the base?
Conversation
SDL/SDLJoystick.cpp
Outdated
if(_njoy < numjoys) { | ||
setUpController(_njoy); | ||
if (controllers.size() > 0) { | ||
cout << "pad 1 has been assigned to control pad: " << SDL_JoystickNameForIndex(_njoy) << endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is all over the place here. Please use an editor that respects editorconfig, or just manually switch to tabs, 4-width, when editing PPSSPP.
SDL/SDLJoystick.h
Outdated
@@ -30,4 +30,5 @@ class SDLJoystick{ | |||
bool registeredAsEventHandler; | |||
std::vector<SDL_GameController *> controllers; | |||
std::map<int, int> controllerDeviceMap; | |||
int _njoy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The convention we use (but not followed everywhere yet, as seen here) is to have a _ suffix, not prefix, for member variables.
Signed-off-by: Nicolas Adenis-Lamarre <nicolas.adenis.lamarre@gmail.com>
fixed. |
While the PSP of course was a handheld console that could not have multiple inputs, the controller mapping works like this: device input -> control mapper -> psp game inputs So when you see device pad numbers, that's for the device input. At least on Windows, it's perfectly possible to plug in four controllers, and map things such that all buttons on controller 1 press X for the emulated PSP, and the second one could have all buttons mapped to O, etc. Maybe you'd even want to do this for some crazy dance controller. -[Unknown] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried this might even break the steam deck, I think it had specific behavior when you put the device to sleep that was supported by these change events? Or was that only audio?
-[Unknown]
@@ -41,16 +41,19 @@ SDLJoystick::SDLJoystick(bool init_SDL ) : registeredAsEventHandler(false) { | |||
cout << "gamecontrollerdb.txt missing" << endl; | |||
} | |||
cout << "SUCCESS!" << endl; | |||
setUpControllers(); | |||
//setUpControllers(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this comments out all calls to setUpControllers()
, but also modifies it. That's confusing.
Git remembers code forever, so if we don't need this anymore the line should be removed and so should the entire method.
-[Unknown]
@@ -186,7 +189,7 @@ void SDLJoystick::ProcessInput(SDL_Event &event){ | |||
axis.value = event.caxis.value / 32767.0f; | |||
if (axis.value > 1.0f) axis.value = 1.0f; | |||
if (axis.value < -1.0f) axis.value = -1.0f; | |||
axis.deviceId = DEVICE_ID_PAD_0 + getDeviceIndex(event.caxis.which); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So for anyone who is not using your new parameter, and who has multiple controller devices, such as probably the author of #8993, this will break their use of PPSSPP.
Wouldn't it be better if your use case was only activated when your parameter was passed?
-[Unknown]
the aim is to be able to play with the pad i want (by sdl id). not always the first found. In case i've many pads plugged on my computer, i've to unplug the others.
it is not perfect.
maybe the SDL_CONTROLLERDEVICEADDED should clean controllers.
however, the current way it not good too. it initialise all pads, but apply events only on pad 0 (the code make think it is possible to have multiple players in psp, but i don't think it is possible) (key.deviceId = DEVICE_ID_PAD_0 + getDeviceIndex(event.cbutton.which);)