[Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

Post gaming related scripts
unbreakable
Posts: 6
Joined: 26 Mar 2017, 06:07

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

28 Mar 2017, 07:06

evilC wrote:Depends on your definition of "Remap".
If you need it to block the original function (ie make the mouse wheel on one particular device NOT scroll pages etc, in addition to performing the new function), then no, this is currently not possible.
If all you need to do is add another function to the wheel of one mouse, then yes, this is possible.
hmm, and what about buttons, the same is true for mouse buttons(on one particular device)?
With UCR I was able to remap (and block the original function) for two main mouse axis X and Y. So, Axis Z (scroll wheell) is somewhat special?
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

28 Mar 2017, 07:32

When you use UCR to remap mouse movement, it does NOT block the original movement.

The ONLY tech that I am currently aware of that can block mouse input from specific mice is Interception. Using this requires coding in C++
There is new tech on the horizon that will let me do this, but it is likely to be a number of months off.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

28 Mar 2017, 09:43

evilC wrote:If you need it to block the original function (ie make the mouse wheel on one particular device NOT scroll pages etc, in addition to performing the new function), then no, this is currently not possible.
Actually, yes you can do it with MouseDelta, I basically do this in my Cursor plugin, all mouse functions are blocked, then I remap or redirect the raw input to which ever location the cursor which generated the input resides. However, if this is intended for any game that also reads raw input, it wont work, but for scrolling windows, no problems. My guess is that most games do not read the raw input of the mouse buttons, just the axes.

Cheers.
unbreakable
Posts: 6
Joined: 26 Mar 2017, 06:07

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

28 Mar 2017, 11:51

evilC wrote:When you use UCR to remap mouse movement, it does NOT block movement.
...Interception. Using this requires coding in C++.
Unfortunately I am complete noob in programming.
You are right, UCR doesn't block the original function. I didn't notice that at first glance. However I've decided to try to remap scroll wheel anyway(maybe it's not so important to block original movement as i thought at first). So, would you be so kind to tell me how to remap scroll wheel of particular mouse to vJoy Axis1 ? How to find out ID of needed mouse, and how to use that ID in script?

Helgef wrote:Actually, yes you can do it with MouseDelta, I basically do this in my Cursor plugin, all mouse functions are blocked, then I remap or redirect the raw input to which ever location the cursor which generated the input resides. However, if this is intended for any game that also reads raw input, it wont work, but for scrolling windows, no problems. My guess is that most games do not read the raw input of the mouse buttons, just the axes.Cheers.
Yes, this is intended for flight sims. Let me make sure I've got this right: it's possible to block original function of mouse buttons in games, but it cannot be done for mouse axes?
P.S. Your Cursor plugin does not work on my PC (Errors at lines 231, 368)
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

28 Mar 2017, 12:36

If blockinput, Mousemove stops the mouse in game, the axes are blocked ;). That would mean the game doesn't consider the raw input. As for the buttons, try eg rbutton::return in the game, it should stop the right mouse button from functioning.
If these blocking methods work in game, your request shouldn't be hard to implement.

Regarding errors, I'll look in to it, if you do not mind, which version of ucr are you using? And what error do you get? To be clear, the plugin doesn't do what you ask for, I was just referring to the methods it uses, as potential methods for doing what you are asking for. You are welcome to try it anyways of course :wave:
unbreakable
Posts: 6
Joined: 26 Mar 2017, 06:07

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

28 Mar 2017, 17:19

The command "blockinput, Mousemove" doesn't do anything at all, not only in games but everywhere(it doesn't effect on my mice at all in all programs). Is it suppose to be like that? At the same time "rbutton::return" stops the right mouse button from functioning in games(with some exceptions).
Helgef wrote:Regarding errors,..
My mistake! No errors. It works, but probably not how it was suppose to - I can move only my "main" mouse cursor. UCR v0.1.13
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

28 Mar 2017, 22:24

You might need to run script as administrator for the mouseblock. Further question or issues about my plugin should be either in the appropriate thread or pm me, we are off topic now.
Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

29 Mar 2017, 01:05

evilC wrote:When you use UCR to remap mouse movement, it does NOT block the original movement.

The ONLY tech that I am currently aware of that can block mouse input from specific mice is Interception. Using this requires coding in C++
There is new tech on the horizon that will let me do this, but it is likely to be a number of months off.
FYI: Not sure you're aware, but there is a kind of test version of an Interception ahk wrapper It does work but it needs more than one process running to be usable i.e. you can't have hotkeys in the same script as the main Interception Loop. It may work using autohotkey.dll's multi-threading, I haven't tested it that way so don't know. Also whats this new tech you mention ? if you don't mind me asking.
Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

29 Mar 2017, 23:59

Thanks, I'll have to keep an eye on ViGEm, while I knew about it as a program, I didn't know that functionality would be implemented.
unbreakable
Posts: 6
Joined: 26 Mar 2017, 06:07

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

31 Mar 2017, 04:11

Could somebody tell me how to write script commands for particular device(mouse) or at least advise where I can find that info? I've been trying to find that in the AutoHotkey Documentation and youtube videos but in vain so far. I would be very grateful!
phasermaniac

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

08 Apr 2017, 20:24

Hi! Nice project.
I have 2 crt lightguns working nice in win10, they work by rawinput, absolute coordinates with Mame and other amulators.
But I have a problem: no drivers for windows 7 or 10 that flashes the screen when shot, and crt lightguns need it to track fine in dark colors, and this makes unplayable almost every game.

Another crt lightgun user found a solution, that at my unexpert understanding does the next:
A program which produces the flash under a keypress,
An electronics citcuit to divide trigger in two buttons: one for activating the flasher program, and the other the original trigger button but delayed and shortened by a timer.

I have talked with him and seems wanting to share his project, but I found the electronics part a little difficult, and I think I have not enough space for it inside my lightguns.

Do you think this can do the delay and remap function the electronics do?
Because I suppose the complication is to manipulate the rawinput data before it arrives to the emulator, isn't it?
Do you think if I do a script with your library will work ?
Because if it was for one lightgun in a directinput emulator I think it can ba done with plain ahk, or amI wrong?
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

09 Apr 2017, 12:32

Hi,
RawInput does return absolute position information, but MouseDelta currently ignores it.

I could maybe see if I can rig up a version that logs it out, and if it can detect the coords from the gun, then you should be golden.


I had a look at the RAWMOUSE structure which RawInput uses, and it seems that a RAWMOUSE struct can contain either delta OR absolute values.
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

usFlags seems to hold 0 for relative data, or 1 for absolute.
MouseDelta currently does not look at this value, it only pulls the device id from the header, and x/y from the RAWMOUSE struct.

So I *think* that with an absolute device like a light gun, then the x and y that MouseDelta reports should be absolute values.

Did you try example script #1 with your light gun? Could you see data coming from it? What did it look like?

BTW, AFAIK "Aboslute" mouse values will not be screen coordinates, it will be a value between 0..65535
But no biggie, we could remap those - as long as we can extract some form of absolute data from the device, then yeah we could probably rig something up
phasermaniac
Posts: 74
Joined: 09 Apr 2017, 14:05

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

09 Apr 2017, 14:10

hi EvilC, thanks for responding, actually I don't need to manipulate the coordinates.
What I have to do is when "Gun1 button0" is fired, block it, fire another button instead, and after a particular amount miliseconds, fire the "Gun1 button0". And the same for "Gun2 button0" but the may be sepparated, because each player shot must go to each players aiming.

I was testing your mouse delta with the MouseWatcher.ahk, and I can see the coordinates of an absolute device. while a normal mouse have a ID number like ID=65689, The absolute device is listed with ID=0. I am getting values from x=1 to x=39300 in the first monitor and from x=39300 to x=65515 in the second, and from y=1 to y=65475.
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

09 Apr 2017, 16:55

So what, there is some driver or something that is listening to the guns via RawInput, and you need to manipulate what they see?
Currently, you cannot block by device, and seeing as they report as device 0, even if you could block device 0, that would block all synthetic output (as that is device 0).
I don't really know that much about how all this works I am afraid.

From your description of the other guy's solution, it sounds like he added an extra button to the guns, and rigged it such that when you pressed the trigger on the gun, then new button gets pressed just before the normal button.
Then he bound the flash to the new button, and so does not have to alter how the emulator sees the RawInput.
phasermaniac
Posts: 74
Joined: 09 Apr 2017, 14:05

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

09 Apr 2017, 17:29

I have to do the trick before the data arrives to the emulator, as the shot button press may arrive after the flashing to be correctly positioned.
The guns are seen as absolute mice, and use the same buttons as mice.
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

09 Apr 2017, 18:34

Altering how the game sees the rawinput I don't think is going to be possible at this time.
Maybe in the future, but it reporting as id 0 complicates matters.
You could try using hooking hotkeys or blockinput to block it from seeing the buttons pressed, but I think your chances of success are low.
phasermaniac
Posts: 74
Joined: 09 Apr 2017, 14:05

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

10 Apr 2017, 01:55

I thought about it, and may be I cando it without hidding or blinding any button, because the gun have buttons I'm not using like button3, and I can set it tohe trigger with the driver, and say the emulators trigger is button0
when click on Gun0button3 I need fire another button instead, and after a particular amount miliseconds, fire the "Gun1 button0". And the same for the other gun.
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

10 Apr 2017, 04:01

ADDING new input is not a problem, it is stopping input that has already been sent that is tricky.
So yeah, if you have a way to do it by altering the gun so that it reports the fire using a button that normally does nothing, then we should hopefully be able to have it trigger the flash, then fake the button that the trigger normally sends.
phasermaniac
Posts: 74
Joined: 09 Apr 2017, 14:05

Re: [Library] MouseDelta - See mouse input the way games see it. (Use for mouse axis->key or joystick)

10 Apr 2017, 09:45

That would be perfect!
So I wilth Mousedelta library would be ok? or needs some modification?
how I remap each guns buttons to be sepparated? I need something like:

Gun1button4:: ;no action in emus
Send gun1button5 ;no action in emus, fires the flash
Sleep,50
send, gun1button0 -> shot P1


Gun2button4:: ;no action in emus
Send gun2button5 ;no action in emus, fires the flash
Sleep,50
send, gun2button0 -> shot P2

Return to “Gaming Scripts (v1)”

Who is online

Users browsing this forum: No registered users and 29 guests