Move the internal screen rotation compensation to after value mapping.
This commit is contained in:
parent
cd8cfcfcd7
commit
fac4c2a90b
1 changed files with 26 additions and 19 deletions
|
@ -137,25 +137,6 @@ static void __EmuScreenVblank()
|
||||||
// TODO: This should be a callback too, so we don't actually call the __Ctrl functions
|
// TODO: This should be a callback too, so we don't actually call the __Ctrl functions
|
||||||
// from settings screens, etc.
|
// from settings screens, etc.
|
||||||
static void SetPSPAxis(char axis, float value, int stick) {
|
static void SetPSPAxis(char axis, float value, int stick) {
|
||||||
switch (g_Config.iInternalScreenRotation) {
|
|
||||||
case ROTATION_LOCKED_HORIZONTAL:
|
|
||||||
// Standard rotation.
|
|
||||||
break;
|
|
||||||
case ROTATION_LOCKED_HORIZONTAL180:
|
|
||||||
value = -value;
|
|
||||||
break;
|
|
||||||
case ROTATION_LOCKED_VERTICAL:
|
|
||||||
value = axis == 'Y' ? value : -value;
|
|
||||||
axis = (axis == 'X') ? 'Y' : 'X';
|
|
||||||
break;
|
|
||||||
case ROTATION_LOCKED_VERTICAL180:
|
|
||||||
value = axis == 'Y' ? -value : value;
|
|
||||||
axis = (axis == 'X') ? 'Y' : 'X';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Can we move the rest of this logic into ControlMapping too?
|
// TODO: Can we move the rest of this logic into ControlMapping too?
|
||||||
|
|
||||||
static float history[2][2] = {};
|
static float history[2][2] = {};
|
||||||
|
@ -170,6 +151,32 @@ static void SetPSPAxis(char axis, float value, int stick) {
|
||||||
// It's a bit non-ideal to run through this twice, once for each axis, but...
|
// It's a bit non-ideal to run through this twice, once for each axis, but...
|
||||||
ConvertAnalogStick(x, y);
|
ConvertAnalogStick(x, y);
|
||||||
|
|
||||||
|
switch (g_Config.iInternalScreenRotation) {
|
||||||
|
case ROTATION_LOCKED_HORIZONTAL:
|
||||||
|
// Standard rotation. No change.
|
||||||
|
break;
|
||||||
|
case ROTATION_LOCKED_HORIZONTAL180:
|
||||||
|
x = -x;
|
||||||
|
y = -y;
|
||||||
|
break;
|
||||||
|
case ROTATION_LOCKED_VERTICAL:
|
||||||
|
{
|
||||||
|
float new_y = -x;
|
||||||
|
x = y;
|
||||||
|
y = new_y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ROTATION_LOCKED_VERTICAL180:
|
||||||
|
{
|
||||||
|
float new_y = y = x;
|
||||||
|
x = -y;
|
||||||
|
y = new_y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
__CtrlSetAnalogXY(stick, x, y);
|
__CtrlSetAnalogXY(stick, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue