evilC / UCR

Universal Control Remapper [ALPHA]
MIT License
196 stars 31 forks source link

Reading Input from 2 mice #184

Open SebastianoCurreli opened 7 years ago

SebastianoCurreli commented 7 years ago

Hi, I'm trying to get the input of two mice movements (2 axes each) mapped to keyboard keys. I know it may seem silly, but I'm trying to use mice as "movement sensors" for some custom built hardware. Apparently, getting one full mouse mapping is ok (mapping it to UP_DN_L_R keys respectively), while the other hand the second one is not working (i.e. to WASD keys). As far as I understood your app uses Windows RawInput facilities, thus it should be possible to select between all the plugged in USB devices. Maybe there is something really dumb I'm missing here...

I'm using a W10 machine with 64bit architecture, and UCR v0.1.16

evilC commented 7 years ago

In the MouseToButtons plugin is a "Select Mouse" button which will make that plugin only respond to a specific mouse.
You may well need to set this each boot, as the number may change.
Also, UCR will not hide any of the mouse movement from the game - if you want to do that, I have a script here that can do that.

SebastianoCurreli commented 7 years ago

Actually, I was already trying to use that feature, but instead of showing any mouse specific "address" it just shows these options: "Any mouse" "Clear" even if both the mice are connected, this means that I can't differentiate between them.

evilC commented 7 years ago

Hmm, UCR would normally only do this if the devices were sending as ID 0, which I have seen before for some devices.
What happens if you run sample script 1 from this thread?
What IDs are the mice showing up as?

SebastianoCurreli commented 7 years ago

If I run the you referenced (both normal and as admin) I get: "Error at line 1.

include file "MouseDelta.ahk" cannot be opened.

The program will exit." If I move it to the plug in folder of UCR, and run UCR.exe I receive the following error:

"Error at line 13.

include file "MouseDelta.ahk" cannot be opened.

The program will exit."

Then the GUI starts normally and behaves as reported above.

evilC commented 7 years ago

You need to put the Library script from the same post into the same folder.

SebastianoCurreli commented 7 years ago

Done, the "mouse watcher" can see properly the two mice in a distinctive manner, showing XY deltas followed by distinct IDs (MouseID: 238881181; MouseID: 65593 respectively).

evilC commented 7 years ago

Hmm, maybe there is an issue. I just tried in UCR and the ID did not show up until I selected "Any Mouse".
ie try opening the menu, select "Any Mouse", then reopen menu, do you see ID?

SebastianoCurreli commented 7 years ago

If I start to randomly unplug either of the mice then one ID appears (ID 49414799, just for the sake of being precise). Which unfortunately still doesn't allow the multiple distinct input.

SebastianoCurreli commented 7 years ago

Maybe it could be of some help the introduction of a "list devices" module, which at each startup of UCR instantiates the ID of all the USB devices connected.

evilC commented 7 years ago

Strange. How about the demo in this post? Does that identify both mice and filter out the appropriate movement?

evilC commented 7 years ago

Correction, this demo should be able to filter out movement on a per-device basis, but I am not sure you need that feature?

SebastianoCurreli commented 7 years ago

I tried the following: Downloaded the SharpDX.dll and SharpDX.RawInput.dll files, placed in UCR folder. Copy-Pasted the demo script you suggested in "..,UCR\Plugins\Core", and run it. I get: Error at line 4. Line Text: #include Error: Function Library not found. The program will exit.

evilC commented 7 years ago

These are nothing to do with UCR.
Instructions are in the first post.

SebastianoCurreli commented 7 years ago

Sorry for the delay, but night crept in... I've tried the full instructions on the post you linked. I think there might be some compatibility issue with either the CLR script or the sharpDX.dll provided there with my machine, because basically nothing works. Can you please provide me a .zip with minimal requirement that you think should work on W10 64bit reading 2 or 3 mice? I'll be happy to test them.

evilC commented 7 years ago

Here is a link to a zip with all the required files.
What is your OS, 32 or 64-bit?

Edit: Changed zip, it now contains CLR.ahk

SebastianoCurreli commented 7 years ago

Thanks evilC! My OS is Windows 10 Pro 64Bit, now I'll give a try to the .zip

SebastianoCurreli commented 7 years ago

now the script works, but I in the select mouse menu I still see just the "any mouse" option

evilC commented 7 years ago

While on Any, MultiMouse.ahk should show a tooltip any time one of your mice moved, and it should contain the VID/PID (Hardware IDs) of your mice. Do you see info coming from both mice?

SebastianoCurreli commented 7 years ago

Nope, I just see the menu image

evilC commented 7 years ago

No it should look like this when you move your mouse:
image

evilC commented 7 years ago

Try this version
It should report that MouseDelta.dll replied 'OK' to the subscription request.

SebastianoCurreli commented 7 years ago

that's the reply of Debug:

image

so apparently the subscription request fails, I guess...

evilC commented 7 years ago

Confirms my suspicion then. It's going to be hard to work out what is wrong via chat - do you have Skype or TeamViewer or something? Do you have visual studio? Willing to install it? Drop me an email at evilc@evilc.com

SebastianoCurreli commented 7 years ago

Thanks buddy you are super kind! I'll drop you a PVT email.

evilC commented 7 years ago

FYI I have now started working on a new version of UCR, and support for multiple mice is planned.
I am implementing keyboard / mouse support using the Interception driver, which should mean per-device, blockable remappings will be supported.