Win10 mouse workaround

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Win10 mouse workaround

Postby Sirius » Mon Mar 12, 2018 7:05 am

Hello people,

I've put together a smallish hack that alleviates the mouse problem for Uru on Windows 10. This is not perfect, but I thought some of you might be interested.
Run uru_rclickfix.exe in the attached zip. Alternatively, you can use the AutoHotkey script source provided.
The program will sit in your system tray while it's active.

How it works:
When your cursor is near an edge of Uru's window, it will be warped back to center without moving the camera.

Issues:
- alt-tabbing while holding a mouse button might cause bugs. Don't do it.
- moving the mouse too fast may prevent the script from warping the cursor. I recommend to lower your mouse sensitivity in Windows' settings, and augment it in Uru.
- Uru won't detect mouse movement during the frame it's warping the cursor, so turning won't be 100% smooth.
- clicking HUD elements near the edge of the screen (KI, Relto book) may wrongly relocate the cursor. Hold down left control while clicking HUD elements.

Also, I only have Complete Chronicles on my Win10 PC, and I don't remember the process name for MOULa. If you want this script to work in MOUL, you might have to use the AHK file instead of the EXE, and replace all occurences of "UruExplorer.exe" in the file with the name of the executable for MOUL.

Again this is not a perfect solution, nevertheless I hope it might help some of you 8-)
Attachments
uru_rclickfix.zip
(512.88 KiB) Downloaded 389 times
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Win10 mouse workaround

Postby Tsar Hoikas » Mon Mar 19, 2018 2:13 pm

What's interesting about this is that your fix actually duplicates (to some degree) the very code that is problematic in Uru itself. From what I can tell, in Windows 10, the C++ code for this causes the OS to echo the mouse position change back to Uru. It moves the cursor back to the center of the screen in response to the OS echo, which causes the avatar movement to be affected. IIRC I tried ignoring the next cursor event after the client did that, but that did not fix it. I guess I'm just curious why this script works when it's so very similar to the already existing C++.
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Win10 mouse workaround

Postby Sirius » Mon Mar 19, 2018 2:54 pm

Yeah, I simply copied what Uru is actually trying to do, using a smaller detection window ;) As long as the mouse cursor doesn't move too fast, that works, despite the hitch.
If I had to guess, the difference is that this script actually sends "Up" then "Down" events. Those seem to be processed in two different frames despite being sent at the same time, causing the hitch and cursor blink when nearing the edge of the screen - but also giving time for the client to ignore the movement.

Interestingly enough, I noticed almost no other games rely on repositioning the mouse when nearing the edge of the screen. They usually do one of the following:
  • trap the mouse within the window's area (which seems to be a native Windows feature), then rely only on mouse movement deltas instead of raw position. This way, even if the cursor is stuck at the border of the screen and doesn't change location, it still generates valid deltas.
  • reposition the cursor to the window's center each frame, and somehow ignore the movement it generates
Dunno how relevant that is to Uru, thought I'd mention it :shrug:
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Win10 mouse workaround

Postby Tsar Hoikas » Mon Mar 19, 2018 4:31 pm

I had noticed that's what other games do as well. My attempted fix was to lock the cursor at the center of the client window when the cursor is grabbed for movement events and use the movement delta. For some reason though, my attempts to move the cursor to the center of the window never worked properly, and the cursor would meander outside of the client window. D'oh! I might try this one more time as I might have been trying to reposition the cursor while handling a WM_MOUSEMOVE message, which might have been problematic.
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Win10 mouse workaround

Postby Deledrius » Mon Mar 26, 2018 10:00 pm

We have a workaround! :D
User avatar
Deledrius
Gehn Shard Admin
 
Posts: 1377
Joined: Mon Oct 01, 2007 1:21 pm

Re: Win10 mouse workaround

Postby Sirius » Mon Mar 26, 2018 10:57 pm

Great work ! 8-)
I wonder how hard it would be to create a proxy DLL for Complete Chronicles, that intercepts the SetCursorPos message and sends WM_MOUSEMOVE back to the engine... I'll have a look into this, maybe even Autohotkey can do it.
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Win10 mouse workaround

Postby Deledrius » Tue Mar 27, 2018 4:23 am

Could that be added to UruLaunch?
User avatar
Deledrius
Gehn Shard Admin
 
Posts: 1377
Joined: Mon Oct 01, 2007 1:21 pm

Re: Win10 mouse workaround

Postby Sirius » Wed Mar 28, 2018 3:15 am

That would be a good use of the program I guess.

Personally I created a proxy user32 DLL so that I can intercept the SetCursorPos method (and later fix it). But user32 is one of the few DLLs that can't be overridden by simply placing it into Uru's folder. D'oh.
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron