https://bugs.winehq.org/show_bug.cgi?id=36873
Bug ID: 36873 Summary: Chronology (.NET 4.0 game) based on 'OpenTK': mouse input non-functional, mouse cursor invisible Product: Wine Version: 1.7.21 Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: focht@gmx.net
Hello folks,
the GOG.com version installs .NET Framework 4.0 client profile on its own in clean 32-bit WINEPREFIX (without Mono).
If the mouse is moved (either in fullscreen or virtual desktop mode), the console is spammed with:
--- snip --- fixme:win:GetMouseMovePointsEx (16 0x33ea10 0x33e5cc 64 1) stub fixme:win:GetMouseMovePointsEx (16 0x33ea10 0x33e5cc 64 1) stub fixme:win:GetMouseMovePointsEx (16 0x33ea10 0x33e5cc 64 1) stub --- snip ---
Source: http://source.winehq.org/git/wine.git/blob/bdc9b147b948b3476815c52f7fc53f4c2...
--- snip --- 1427 int WINAPI GetMouseMovePointsEx(UINT size, LPMOUSEMOVEPOINT ptin, LPMOUSEMOVEPOINT ptout, int count, DWORD res) { 1428 1429 if((size != sizeof(MOUSEMOVEPOINT)) || (count < 0) || (count > 64)) { 1430 SetLastError(ERROR_INVALID_PARAMETER); 1431 return -1; 1432 } 1433 1434 if(!ptin || (!ptout && count)) { 1435 SetLastError(ERROR_NOACCESS); 1436 return -1; 1437 } 1438 1439 FIXME("(%d %p %p %d %d) stub\n", size, ptin, ptout, count, res); 1440 1441 SetLastError(ERROR_POINT_NOT_FOUND); 1442 return -1; 1443 } --- snip ---
MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646259%28v=vs.85%2...
That noisy stub (although annoying) doesn't seem to be the problem here.
See here for discussion and how it's implemented in 'OpenTK':
https://github.com/opentk/opentk/issues/76
https://github.com/opentk/opentk/blob/develop/Source/OpenTK/Platform/Windows...
--- snip --- void HandleMouseMove(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam) { unsafe { Point point = new Point( (short)((uint)lParam.ToInt32() & 0x0000FFFF), (short)(((uint)lParam.ToInt32() & 0xFFFF0000) >> 16));
// GetMouseMovePointsEx works with screen coordinates Point screenPoint = point; Functions.ClientToScreen(handle, ref screenPoint); int timestamp = Functions.GetMessageTime();
// & 0xFFFF to handle multiple monitors http://support.microsoft.com/kb/269743 MouseMovePoint movePoint = new MouseMovePoint() { X = screenPoint.X & 0xFFFF, Y = screenPoint.Y & 0xFFFF, Time = timestamp, };
// Max points GetMouseMovePointsEx can return is 64. const int numPoints = 64; MouseMovePoint* movePoints = stackalloc MouseMovePoint[numPoints];
// GetMouseMovePointsEx fills in movePoints so that the most // recent events are at low indices in the array. int points = Functions.GetMouseMovePointsEx( (uint)MouseMovePoint.SizeInBytes, &movePoint, movePoints, numPoints, Constants.GMMP_USE_DISPLAY_POINTS);
int lastError = Marshal.GetLastWin32Error();
// No points returned or search point not found if (points == 0 || (points == -1 && lastError == Constants.ERROR_POINT_NOT_FOUND)) { // Just use the mouse move position OnMouseMove(point.X, point.Y); } else if (points == -1) { throw new System.ComponentModel.Win32Exception(lastError); } else { ... --- snip ---
That information might be still useful for 'GetMouseMovePointsEx' implementation though.
$ wine --version wine-1.7.21-75-g0a4c786
Regards
https://bugs.winehq.org/show_bug.cgi?id=36873
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |dotnet
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #1 from Austin English austinenglish@gmail.com --- This is your friendly reminder that there has been no bug activity for over a year. Is this still an issue in current (1.7.51 or newer) wine?
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #2 from Anastasius Focht focht@gmx.net --- Hello folks,
obviously still present.
https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/user32/input.c#l1458
$ wine --version wine-1.7.51
Regards
https://bugs.winehq.org/show_bug.cgi?id=36873
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |user32
--- Comment #3 from Anastasius Focht focht@gmx.net --- Hello folks,
revisiting, still present.
$ sha1sum setup_chronology_2.0.0.3.exe f254cd745c4b7879df7d1503ea556fecbf94795f setup_chronology_2.0.0.3.exe
$ du -sh setup_chronology_2.0.0.3.exe 344M setup_chronology_2.0.0.3.exe
$ wine --version wine-4.4
Regards
https://bugs.winehq.org/show_bug.cgi?id=36873
Tom Hobson tomhobsonleeds@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |tomhobsonleeds@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #4 from Tom Hobson tomhobsonleeds@gmail.com --- This is now affecting Mount & Blade II: Bannerlord.
https://bugs.winehq.org/show_bug.cgi?id=36873
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Chronology (.NET 4.0 game) |Multiple games have |based on 'OpenTK': mouse |non-functional mouse input, |input non-functional, mouse |invisible mouse cursor |cursor invisible |(Chronology, Mount & Blade | |II: Bannerlord)
--- Comment #5 from Anastasius Focht focht@gmx.net --- Hello Tom,
thanks for the information. I've updated the summary line to be more generic and mention your game. I've just retested Chronology 2.0.0.3 from GOG.com and it's still present.
$ wine --version wine-5.5-126-g5c0e699dba
Regards
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #6 from Tom Hobson tomhobsonleeds@gmail.com --- Hi Anastasius,
Unsure if this will aid you in getting the game running (but it should combat the error), but here is a patch that helped get M&B:II going: https://github.com/ValveSoftware/Proton/issues/3706#issuecomment-607021113
Cheers
https://bugs.winehq.org/show_bug.cgi?id=36873
Ryan S. Northrup northrup@yellowapple.us changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |northrup@yellowapple.us
--- Comment #7 from Ryan S. Northrup northrup@yellowapple.us --- Created attachment 66797 --> https://bugs.winehq.org/attachment.cgi?id=66797 GetMouseMovePointsEx
https://bugs.winehq.org/show_bug.cgi?id=36873
Ryan S. Northrup northrup@yellowapple.us changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |leslie_alistair@hotmail.com | |, z.figura12@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #8 from Ryan S. Northrup northrup@yellowapple.us --- Patch attached (as an actual patch). Also CC'ing Alistair and Zebediah for inclusion in wine-staging.
The patch partially implements GetMouseMovePointsEx by storing the previous mouse cursor position and returning the current (and, if count > 1, previous) cursor positions. This is a deviation from the documented behavior (where Windows actively tracks the last 64 cursor positions), but it seems to be Good Enough™ in practice (at least for M&B2).
Alistair/Zebediah: given the deviation from Windows' behavior, can we get this into wine-staging?
https://bugs.winehq.org/show_bug.cgi?id=36873
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Staged patchset| |https://github.com/wine-sta | |ging/wine-staging/tree/mast | |er/patches/user32-GetMouseM | |ovePointsEx Status|NEW |STAGED
--- Comment #9 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- (In reply to Ryan S. Northrup from comment #8)
Patch attached (as an actual patch). Also CC'ing Alistair and Zebediah for inclusion in wine-staging.
Thanks Ryan. I've based the patch in staging on your patch, can you please test it to see that I didn't break anything?
Thanks
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #10 from Ryan S. Northrup northrup@yellowapple.us --- Hi Alistair,
Thanks for the quick turnaround!
At a quick glance I don't think the patch as it exists in the wine-staging repo is going to work; one of our findings in the Proton GitHub thread on this issue (https://github.com/ValveSoftware/Proton/issues/3706) was that the two points returned have to be different from one another for the program to actually recognize it as a mouse movement. That's why I opted to store the coordinates from the previous call in those static variables (so that any mouse movement changes would register an actual change in mouse position).
If there's a policy against static variables in functions, then that's understandable, but if that's the case then we'd need to generate that second position some other way. We previously tried just incrementing the x and y coordinates by 1, which mostly worked except for camera rotation in the game's world map (it would only turn counterclockwise).
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #11 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- There is no policy as to not use statics. I just don't like them unless required and in this case it might be.
I would be interested to know, if the GetCursorPos has the same values as ptin?
If you add a fixme line to output the four values (ptin.x/y and pos.x/y) and then attached the log here?
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #12 from Ryan S. Northrup northrup@yellowapple.us --- Happy to get a log for you, but I can (and previously did) indeed confirm that the cursor position the game's passing into the function is consistently identical to the one from GetCursorPos.
https://bugs.winehq.org/show_bug.cgi?id=36873
Ryan S. Northrup northrup@yellowapple.us changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #66797|0 |1 is obsolete| |
--- Comment #13 from Ryan S. Northrup northrup@yellowapple.us --- Created attachment 66799 --> https://bugs.winehq.org/attachment.cgi?id=66799 GetMouseMovePointsEx v2
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #14 from Ryan S. Northrup northrup@yellowapple.us --- Created attachment 66800 --> https://bugs.winehq.org/attachment.cgi?id=66800 Input/output coordinate log
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #15 from Ryan S. Northrup northrup@yellowapple.us --- Both the requested log and the revised patch which generated it (reintroducing the static vars for the previous cursor position) are now attached. The "ptin:" line is the position the application's passing in, the "ptout[0]" line is the mouse position returned from GetCursorPos, and the "ptout[1]" line is the previous position (i.e. the values of last_x and last_y at the time of function call).
So, from a sample:
168045.639:0035:0073:trace:win:GetMouseMovePointsEx (24 0x4e43f298 0x4e43f2b0 64 1) semi-stub 168045.639:0035:0073:trace:win:GetMouseMovePointsEx ptin: 466 775 168045.639:0035:0073:trace:win:GetMouseMovePointsEx ptout[0]: 466 775 168045.639:0035:0073:trace:win:GetMouseMovePointsEx ptout[1]: 479 787
We can see that "ptin" and "ptout[0]" are identical, even though the former came from the function args and the latter came from GetCursorPos.
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #16 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- Thanks for confirming.
I've updated the patch with the one you attached. Thanks.
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #17 from Ryan S. Northrup (RyNo) northrup@yellowapple.us --- Perfect! Thank you so much for your help on this (and in general; y'all rock).
Anastasius: can you confirm whether or not the issue persists on your end with the current wine-staging? I don't have a copy of Chronology on hand.
https://bugs.winehq.org/show_bug.cgi?id=36873
Arek Hiler ahiler@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ahiler@codeweavers.com
--- Comment #18 from Arek Hiler ahiler@codeweavers.com --- https://www.winehq.org/pipermail/wine-devel/2020-September/173639.html
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #19 from Arek Hiler ahiler@codeweavers.com --- I've tried to fully implement GMMPEx():
https://www.winehq.org/pipermail/wine-devel/2020-October/174989.html https://source.winehq.org/patches/data/193956
I've tested it with M&B2 and the mouse movement feels right. I've got one round of review from Julliard and after that I had hard time getting his attention again. It may be worth giving it a spin in wine-staging.
Ryan, Alistair and Zebediah what do you think?
https://bugs.winehq.org/show_bug.cgi?id=36873
--- Comment #20 from Arek Hiler ahiler@codeweavers.com --- Nevermind. This just got in upstream as f7edc328184c4755c81dec5372b3ae5ac7b8c5df
https://bugs.winehq.org/show_bug.cgi?id=36873
Julian Rüger jr98@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jr98@gmx.net
https://bugs.winehq.org/show_bug.cgi?id=36873
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|STAGED |RESOLVED Fixed by SHA1| |f7edc328184c4755c81dec5372b | |3ae5ac7b8c5df Resolution|--- |FIXED
--- Comment #21 from Gijs Vermeulen gijsvrm@gmail.com --- (In reply to Arek Hiler from comment #20)
Nevermind. This just got in upstream as f7edc328184c4755c81dec5372b3ae5ac7b8c5df
In that case, marking FIXED.
If anyone still has issues with either of these games, please open a new bug.
https://bugs.winehq.org/show_bug.cgi?id=36873
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #22 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 5.20.
https://bugs.winehq.org/show_bug.cgi?id=36873
erkankarabulut erkankkarabulut@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |erkankkarabulut@gmail.com
--- Comment #23 from erkankarabulut erkankkarabulut@gmail.com --- Hello,
There is a similar bug on the game Drakensang, which is opened a year ago. Link for the bug issue:https://bugs.winehq.org/show_bug.cgi?id=47386.
In short, cursor is visible but it is not possible to graphically move it, although it workes on the background. Because I can see that buttons are highlighted when I blindly move the mouse and I am also able to click on them and everything works normally. Any quick solution to this issue?
Thanks in advance.