Closed jvook closed 3 years ago
I'm not sure what you mean by the right analog stick works. The PSP didn't have a right analog stick, and I don't think this game supported sixaxis PS3 right analog sticks on the PSP Go, which is the only way games ever supported the right analog.
Or do you mean that moving the analog stick to the left does not work, but moving it to the right does?
-[Unknown]
Or do you mean that moving the analog stick to the left does not work, but moving it to the right does?
That's what he meant, yes. For some reason pushing the stick to the left doesn't do anything but to the right it works normally. I even tried increasing analog sensitivity, thinking maybe the analog needed to be pushed further for the action to register, but nope. And even if you bind PSP analog left and right to some digital buttons/keys, right will work but not left.
I don't think it will help but just in case, here's a log (I'm loading a state, but the issue is there even if I don't): https://pastebin.com/04yQsKs1
And just like OP, no issue in standalone for me either.
This should be where the analog state is read from libretro: https://github.com/hrydgard/ppsspp/blob/ff2a6eeda2d00210f1a1f7bc0ab0ad99e7bc60b6/libretro/libretro.cpp#L753
Which doesn't look terribly different from: https://github.com/notaz/pcsx_rearmed/blob/fbf19ce6b6c02da47a67f58e23d8294cfcd18f55/frontend/libretro.c#L1127
I will say that ideally, this should only be called when the value changes, and should be mapped to a square (i.e. upper left should be min x, min y - not a circle.) I've no idea if libretro does that.
That said, the range seems slightly questionable, depending on how the conversion is happening. input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X)
seems to be an int16_t based on this documentation, which would go from -32768 to +32767. Dividing by a fixed 32768 should be giving a slight bias, where left (-1.0f) would go all the way but right (normally +1.0f) will slightly underuse the range.
That's probably not the issue here.
I don't personally use libretro or know even how to compile a build for it to use (and am not very interested in it), but if someone wants to look at this my suggestion would be to log the value returned by input_state_cb for the left and right directions of the analog stick, and then verify what value __CtrlSetAnalogX()
receives. You could also try setting that to a fixed -1.0f or 1.0f, and see how the game behaves.
-[Unknown]
If I replace this line with __CtrlSetAnalogX(1.0f, CTRL_STICK_LEFT);
the camera keeps rotating like if I was holding the analog to the right.
With "-1.0f" it keeps rotating like if I was holding it to the left.
edit: Oh and just to be clear I'm not a dev, I have no idea how to get the value of "input_state_cb", etc. 😅 But I can compile RA and the core, so if you want me test some specific changes in the code, I can test that.
Someone on the RA discord made me test with "32767.0f" and it worked fine, I can now rotate the camera properly left and right with the analog, but it's apparently not a "real" fix?
Try replacing the line with:
__CtrlSetAnalogX((float)(((double)input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X) + 32768.0) / 32767.5) - 1.0f, CTRL_STICK_LEFT);
-[Unknown]
According to the libreto docs the range from an axis is [-0x7fff, 0x7fff] with a caveat of "some devices may return -0x8000". Personaly i've not seen and device or frontend return a -0x800 under any circustances and any well behaved frontend should respect the explicitly defined range.
We are seeing a -0x7fff / 32768.0f being passed to the ppsspp input methods and that -0.999969.... is just not quite enough register a full left deflection. A 32767.0f division on its own will be fine to deal with the explicit axis range and the slight overflow with -0x8000 should get caught with the clamp_u8 call further down.
Guessing its probably safe to go with 32767.0f as the divisior.
Yeah, just go with 32767.0. A PR will be accepted :)
Just tried this last night on Switch libretro PPSSPP and the left analog press is still not working
What happens?
Entering an analog stick left command in final fantasy tactics doesn't work. Analog right does work.
What are you using?
Libretro
What hardware / device and operating system?
Windows
What PPSSPP version (standalone/official), and did it work before?
This issue has existed for all libretro PPSSPP core versions. I believe that the issue predates the current developer's involvement with the libretro core. This thread tracked the issue 4+ years ago: https://forums.libretro.com/t/controller-issue-in-ppsspp-core-with-fft-wotl/5180
The issue does not exist in standalone PSP and as far as I know it never has had this issue.
Which game or games?
FF tactics US, other regions untested.
Checklist