From f39d11ef7eafcaa5413b4152d6ed5c19caf1e9db Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Thu, 16 Jul 2020 11:14:29 +0200 Subject: [PATCH] input: round dead zone when saving --- core/input/mapping.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/input/mapping.cpp b/core/input/mapping.cpp index 23a9e0690..0cf3f6a75 100644 --- a/core/input/mapping.cpp +++ b/core/input/mapping.cpp @@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License along with reicast. If not, see . */ +#include #include "mapping.h" #include "cfg/ini.h" #include "stdclass.h" @@ -141,7 +142,7 @@ void InputMapping::load(FILE* fp) dz = std::min(dz, 100); dz = std::max(dz, 0); - this->dead_zone = ((float) dz) / 100; + this->dead_zone = (float)dz / 100.f; for (u32 i = 0; i < ARRAY_SIZE(button_list); i++) { @@ -218,7 +219,7 @@ bool InputMapping::save(const char *name) ConfigFile mf; mf.set("emulator", "mapping_name", this->name); - mf.set_int("emulator", "dead_zone", this->dead_zone * 100); + mf.set_int("emulator", "dead_zone", (int)std::round(this->dead_zone * 100.f)); for (u32 i = 0; i < ARRAY_SIZE(button_list); i++) {