From 362c5be657c49f3f649ab0c0c9802da356197fb3 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 20 Jun 2013 01:11:45 -0700 Subject: [PATCH] Tweak the ctrl analog rounding to be safer. --- Core/HLE/sceCtrl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceCtrl.cpp b/Core/HLE/sceCtrl.cpp index 7d032010f4..7f828cb904 100644 --- a/Core/HLE/sceCtrl.cpp +++ b/Core/HLE/sceCtrl.cpp @@ -161,11 +161,11 @@ void __CtrlSetAnalog(float x, float y, int stick) { std::lock_guard guard(ctrlMutex); if (stick == 0) { - ctrlCurrent.analog[0] = (u8)(x * 127.5f + 128.f); - ctrlCurrent.analog[1] = (u8)(-y * 127.5f + 128.f); + ctrlCurrent.analog[0] = (u8)ceilf(x * 127.5f + 127.5f); + ctrlCurrent.analog[1] = (u8)ceilf(-y * 127.5f + 127.5f); } else { - ctrlCurrent.analogRight[0] = (u8)(x * 127.5f + 128.f); - ctrlCurrent.analogRight[1] = (u8)(-y * 127.5f + 128.f); + ctrlCurrent.analogRight[0] = (u8)ceilf(x * 127.5f + 127.5f); + ctrlCurrent.analogRight[1] = (u8)ceilf(-y * 127.5f + 127.5f); } }