diff --git a/.clang-format b/.clang-format index 7e38e8e4b..c5bb52eed 100644 --- a/.clang-format +++ b/.clang-format @@ -16,3 +16,4 @@ IndentPPDirectives: AfterHash IndentExternBlock: NoIndent PointerAlignment: Right SpaceAfterCStyleCast: true +SortIncludes: false diff --git a/src/config.c b/src/config.c index 01710ebc4..69c4e7c6b 100644 --- a/src/config.c +++ b/src/config.c @@ -180,8 +180,8 @@ load_general(void) lang_id = plat_language_code(p); mouse_sensitivity = ini_section_get_double(cat, "mouse_sensitivity", 1.0); - if (mouse_sensitivity < 0.5) - mouse_sensitivity = 0.5; + if (mouse_sensitivity < 0.1) + mouse_sensitivity = 0.1; else if (mouse_sensitivity > 2.0) mouse_sensitivity = 2.0; diff --git a/src/device/isapnp.c b/src/device/isapnp.c index 45752a3ca..669a45eec 100644 --- a/src/device/isapnp.c +++ b/src/device/isapnp.c @@ -1064,11 +1064,15 @@ isapnp_reset_device(void *priv, uint8_t ldn) static const device_t isapnp_device = { - "ISA Plug and Play", - "isapnp", - 0, - 0, - isapnp_init, isapnp_close, NULL, - { NULL }, NULL, NULL, - NULL + .name = "ISA Plug and Play", + .internal_name = "isapnp", + .flags = 0, + .local = 0, + .init = isapnp_init, + .close = isapnp_close, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index fce923e4f..4f9ccabed 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -136,6 +136,7 @@ extern int is_pentium; /* TODO: Move back to cpu/cpu.h when it's figured out, how to remove that hack from the ET4000/W32p. */ extern int fixed_size_x, fixed_size_y; extern double mouse_sensitivity; /* (C) Mouse sensitivity scale */ +extern double mouse_x_error, mouse_y_error; /* Mouse error accumulators */ extern int pit_mode; /* (C) force setting PIT mode */ extern int fm_driver; /* (C) select FM sound driver */ diff --git a/src/qt/qt_progsettings.ui b/src/qt/qt_progsettings.ui index 05775489f..fa0818652 100644 --- a/src/qt/qt_progsettings.ui +++ b/src/qt/qt_progsettings.ui @@ -88,7 +88,7 @@ - 50 + 10 200 diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index 6beb37516..f0e5b12e0 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -54,6 +54,7 @@ extern "C" { #include <86box/video.h> double mouse_sensitivity = 1.0; +double mouse_x_error = 0.0, mouse_y_error = 0.0; } struct mouseinputdata { @@ -151,8 +152,14 @@ RendererStack::mousePoll() #endif this->mouse_poll_func(); - mouse_x *= mouse_sensitivity; - mouse_y *= mouse_sensitivity; + double scaled_x = mouse_x * mouse_sensitivity + mouse_x_error; + double scaled_y = mouse_y * mouse_sensitivity + mouse_y_error; + + mouse_x = static_cast(scaled_x); + mouse_y = static_cast(scaled_y); + + mouse_x_error = scaled_x - mouse_x; + mouse_y_error = scaled_y - mouse_y; } int ignoreNextMouseEvent = 1; diff --git a/src/unix/unix_sdl.c b/src/unix/unix_sdl.c index 3d989bf53..b023299d2 100644 --- a/src/unix/unix_sdl.c +++ b/src/unix/unix_sdl.c @@ -44,6 +44,7 @@ int resize_pending = 0; int resize_w = 0; int resize_h = 0; double mouse_sensitivity = 1.0; /* Unused. */ +double mouse_x_error = 0.0, mouse_y_error = 0.0; /* Unused. */ static uint8_t interpixels[17842176]; extern void RenderImGui(); diff --git a/src/win/win_mouse.c b/src/win/win_mouse.c index bb592f419..dfc0ac691 100644 --- a/src/win/win_mouse.c +++ b/src/win/win_mouse.c @@ -29,6 +29,7 @@ int mouse_capture; double mouse_sensitivity = 1.0; /* Unused. */ +double mouse_x_error = 0.0, mouse_y_error = 0.0; /* Unused. */ typedef struct { int buttons;