From 911cc38865c4c3d4c20efac4e71de8eb822eb00e Mon Sep 17 00:00:00 2001 From: ripsaw8080 Date: Sat, 20 Apr 2019 22:50:31 +0000 Subject: [PATCH] Add logic in mouse driver to ignore button events that are out of sequence. Fixes International Rugby Challenge when clicking to lock the mouse. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4214 --- src/ints/mouse.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ints/mouse.cpp b/src/ints/mouse.cpp index c312fb5e..b463a60f 100644 --- a/src/ints/mouse.cpp +++ b/src/ints/mouse.cpp @@ -525,18 +525,21 @@ void Mouse_ButtonPressed(Bit8u button) { switch (button) { #if (MOUSE_BUTTONS >= 1) case 0: + if (mouse.buttons&1) return; mouse.buttons|=1; Mouse_AddEvent(MOUSE_LEFT_PRESSED); break; #endif #if (MOUSE_BUTTONS >= 2) case 1: + if (mouse.buttons&2) return; mouse.buttons|=2; Mouse_AddEvent(MOUSE_RIGHT_PRESSED); break; #endif #if (MOUSE_BUTTONS >= 3) case 2: + if (mouse.buttons&4) return; mouse.buttons|=4; Mouse_AddEvent(MOUSE_MIDDLE_PRESSED); break; @@ -553,18 +556,21 @@ void Mouse_ButtonReleased(Bit8u button) { switch (button) { #if (MOUSE_BUTTONS >= 1) case 0: + if (!(mouse.buttons&1)) return; mouse.buttons&=~1; Mouse_AddEvent(MOUSE_LEFT_RELEASED); break; #endif #if (MOUSE_BUTTONS >= 2) case 1: + if (!(mouse.buttons&2)) return; mouse.buttons&=~2; Mouse_AddEvent(MOUSE_RIGHT_RELEASED); break; #endif #if (MOUSE_BUTTONS >= 3) case 2: + if (!(mouse.buttons&4)) return; mouse.buttons&=~4; Mouse_AddEvent(MOUSE_MIDDLE_RELEASED); break; @@ -698,6 +704,8 @@ static void Mouse_Reset(void) { mouse.mickey_x = 0; mouse.mickey_y = 0; + mouse.buttons = 0; + for (Bit16u but=0; but