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

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

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

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

by evilC » 11 Sep 2018, 11:58

carlitototo wrote:Hello Hello !
First post here, and kind of a noob to ahk, otherwise wuldn't be asking this selly question ! ! !

How do we use this librairy ?! Like, I can't figure out how to properly do something with it !

To explain the whole thing, I'm creating a bot for a game called trove to use multiple account at the same time on the same computer and reproduce the movement of the first game instance to the otherones, we got the key binded, works flawlessly, and even have an autolog, because loading 7 accounts is time consumming ( can't run more, computer can't handle it ! ). But since we need to bind the mouse movement, and this is the only option I found ( and probably the best ) How can I use it to send mouse movements to other instances ? I tried to test with the example above, but couldn't do anything, really a noob I guess ^^

Someone is up for help ?

Merci beaucoup :)

- Carlitototo
This library is not for sending mouse movement, it is for responding to it

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

by evilC » 11 Sep 2018, 11:57

Ducky wrote:Yeah, can we get some code that presses d when it moves to the right, and presses a for left? I am a total novice in programming too.
This is exactly what Sample Script 2 does.

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

by Ducky » 11 Sep 2018, 08:27

Yeah, can we get some code that presses d when it moves to the right, and presses a for left? I am a total novice in programming too.

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

by carlitototo » 05 Jun 2018, 15:09

Hello Hello !
First post here, and kind of a noob to ahk, otherwise wuldn't be asking this selly question ! ! !

How do we use this librairy ?! Like, I can't figure out how to properly do something with it !

To explain the whole thing, I'm creating a bot for a game called trove to use multiple account at the same time on the same computer and reproduce the movement of the first game instance to the otherones, we got the key binded, works flawlessly, and even have an autolog, because loading 7 accounts is time consumming ( can't run more, computer can't handle it ! ). But since we need to bind the mouse movement, and this is the only option I found ( and probably the best ) How can I use it to send mouse movements to other instances ? I tried to test with the example above, but couldn't do anything, really a noob I guess ^^

Someone is up for help ?

Merci beaucoup :)

- Carlitototo

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

by Helgef » 27 Mar 2018, 04:05

Hello, maybe I have something, I do not recall, I will check later. Please send me a pm in a few days if I forget.

Cheers.

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

by brutus_skywalker » 27 Mar 2018, 03:13

Helgef wrote: Someone asked for a mouse recorder in the ask for help section, so I tried to make a simple one.
My idea was, to save the delta info, eg, dx,dy, and then playback is simply MouseMove,dx,dy,0,R.
I realised quite quickly, that if you have any mouse acceleration or sensitivity settings on the mouse, the delta info doesn't match the mouse cursor, this is of course as (should be) expected, I felt stupid.
However, when I disabled these settings, to verify that my mouse recorder worked, in principle at least, I found that still some delta info seemed to be lost.
....
Sup dude, did you by any chance complete this mouse recorder, by all indications i'm guessing the code in that post was relating to an implementation as a UCR plugin.

I was wondering if you could post an abstraction of sorts that allows something like this, i only ask because you might have already done it, just as plugin for UCR:

Code: Select all

MouseDelta_start()   ;starts recording mouse delta to global deltaX & deltaY, concatenating all movements to one global variable pair
MouseDelta_stop()    ;stops recording, such that the movement pair recorded above can be used to replay that mouse delta movement.

MouseMove3D(){		;rough but gets the idea across, i hope.
Global
;recreate mouse delta movement, handy in games where coordinate based movement is effectively useless, this should allow moving the mouse in 3D space - i think - when paired with mouse delta data.

;move mouse single units movement, as massive jumps per deltaX 'distance' seamingly results in movement jumps that result in inconsistent movement,especially if deltaX exceeds the dimensions of the monitor.
Loop, deltaX
	{
	If A_Index = deltaX
		Break
	DllCall("mouse_event", "UInt", 0x01, "UInt", 1, "UInt", 0)
	}
Loop, deltaY
	{
	If A_Index = deltaY
		Break
	DllCall("mouse_event", "UInt", 0x01, "UInt", 0, "UInt", 1)
	}
}

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

by masheen » 18 Nov 2017, 20:51

evilC wrote:For anyone interested, I managed to implement MouseDelta as a C# DLL - see here
Can i to simulate this delta using PostMessage?

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

by evilC » 03 Jun 2017, 11:57

For anyone interested, I managed to implement MouseDelta as a C# DLL - see here

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

by bestguest » 19 May 2017, 15:24

Hi,

Thank you for making these scripts! I want to implement your sniper-mode script but I am completely new to ahk....I was searching around for a way to change my DPI since my mouse has no driver or buttons to switch it and came accross your thread.
So I downloaded the LIBRARY, the first code in the first post and saved it as "MouseDelta.ahk" and then downloaded sniper-mode into same folder. Ran sniper-mode as administrator but when I press F12 the mouse sensitivity doesnt change.
What am I doing wrong?
If you could help out a noob in need :) I would be very grateful!
Also, how can I tweak the script to, make the mouse move faster instead of slower, at 600 DPI instead from default 400dpi while holding a button?

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

by evilC » 29 Apr 2017, 11:05

It would certainly be worth speaking to the interception guys, I dunno if Interception can do what you want, but they probably would.
AHKHID is going to be of no use at the moment, it uses the same technique as MouseDelta (Reading via RawInput API)
Our stumbling block is with blocking / intercepting.

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

by phasermaniac » 14 Apr 2017, 18:54

Do you think ahkhid can help?
https://autohotkey.com/board/topic/5357 ... -glovepie/
This guy seems that did something similar and says:
I have been successfully getting raw HID input (which must then be parsed) from my wacom cintiq with the AHKHID library

<!-- m -->http://www.autohotke... ... ght=ahkhid<!-- m -->

There are some test apps that you can use to capture your tablet's HID I/O messages. I also use BlockInput to block the tablet driver from adjusting the mouse, and use Autohotkey to handle the mouse movement instead

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

by phasermaniac » 12 Apr 2017, 17:59

Thanks you two anyway, do you think its woth to talk with interception guys or do you think it can't be done? For me, so much difficult, and it's so specific... most people use ir guns and they don't have this problem

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

by Helgef » 12 Apr 2017, 12:20

The code I provided doesn't really help you, it is just meant to get the names of the devices, I didn't test my earlier suggestion to send custom input messages. And even if it would work, we might not know where to send it in your case. In the end, there should be more sophisticated solutions, but that is beyond me.

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

by phasermaniac » 12 Apr 2017, 11:05

Sorry I'm a bit lost with this code, never played with dlls and so. Doesn't it resolves anything to you evilC? It seems to show the correct ID for mice for me

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

by phasermaniac » 11 Apr 2017, 14:46

many thanks for your interest Helgef.
For me seems its working nice. Tried plugging and unplugging and reports the correct number of devices

So with theis method, can rawinput false pulsations be sent?

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

by Helgef » 11 Apr 2017, 11:19

I only found one mouse, I have two connected, and this is what I got, \\?\HID#VID_045E&PID_00CB#7&311ffe2c&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}, not very exciting. :thumbdown:

Code: Select all

Msgbox, % GetMiceList()
GetMiceList(){
	static cbSize:=A_PtrSize*2
	static RIDI_DEVICENAME:=0x20000007
	DllCall("GetRawInputDeviceList", "UptrP", 0, "UintP", puiNumDevices, "Uint", cbSize)
	VarSetCapacity(pRawInputDeviceList,puiNumDevices*cbSize,0)
	r:=DllCall("GetRawInputDeviceList", "Uptr", &pRawInputDeviceList, "UintP", puiNumDevices, "Uint", cbSize)
	Loop, % puiNumDevices {
		hDevice:=NumGet(&pRawInputDeviceList,cbSize*(A_Index-1),"Uptr")
		dwType:=NumGet(&pRawInputDeviceList, cbSize*(A_Index),"Uint")
		if (dwType) ; RIM_TYPEMOUSE=0
			continue
		uiCommand:=RIDI_DEVICENAME
		DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "PtrP", 0, "UintP", pcbSize)
		VarSetCapacity(pData,pcbSize*(A_IsUnicode?2:1),0)
		DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "Ptr", &pData, "UintP", pcbSize)
		str.=StrGet(&pData)  "`n" 
	}
	return str
}
/*
---------------------------
20170411174902.ahk
---------------------------
\\?\HID#VID_045E&PID_00CB#7&311ffe2c&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}
---------------------------
OK   
---------------------------
*/
Edit: This code has errors it seems.

Edit3:
It should be more like this,but this crashes :eh:

Code: Select all

Msgbox, % GetMiceList()
GetMiceList(){
	static cbSize:=A_PtrSize*2
	static RIDI_DEVICENAME:=0x20000007
	DllCall("GetRawInputDeviceList", "Uptr", 0, "UintP", puiNumDevices, "Uint", cbSize)
	VarSetCapacity(pRawInputDeviceList,puiNumDevices*cbSize,0)
	r:=DllCall("GetRawInputDeviceList", "Uptr", &pRawInputDeviceList, "UintP", puiNumDevices, "Uint", cbSize)
	Loop, % puiNumDevices {
		hDevice:=NumGet(&pRawInputDeviceList+0,cbSize*(A_Index-1),"Uptr")
		dwType:=NumGet(&pRawInputDeviceList+0, cbSize*(A_Index-1)+A_PtrSize,"Uint")
		if (dwType) ; RIM_TYPEMOUSE=0
			continue
		uiCommand:=RIDI_DEVICENAME
		DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "Ptr", 0, "UintP", pcbSize)
		if !pcbSize
			continue
		VarSetCapacity(pData,pcbSize*(A_IsUnicode?2:1)+2,0)
		DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "Ptr", &pData, "UintP", pcbSize)
		str.=StrGet(&pData)  "`n`n" 
	}
	return str
}
This seems better, but it gives me four results, as I said, I have only two mice. Sorry for derailing. :offtopic:

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

by Helgef » 11 Apr 2017, 10:49

evilC wrote:the major problem is to work out if it is possible to send fake input data that appears to come from an attached device.
Maybe set up your own RAWINPUT structure, then pass its adress as the lParam of a WM_INPUT message. I guess you would try to send WM_INPUT to one of your own scripts with mouse delta active, and see if it responds. But then there is the problem of knowing where (which HWND) to send it to. Just a thought.

About GetRawInputDeviceList, that could be used to fetch all mouse devices and list them by name in the UCR mouse selection control. So the control could list all mice on creation, instead of being added when detected via movement.

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

by evilC » 11 Apr 2017, 10:23

Most of this appears to be relevant to interpreting the data that comes in from the guns - this is not the major problem at the moment, the major problem is to work out if it is possible to send fake input data that appears to come from an attached device.

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

by evilC » 11 Apr 2017, 10:21

Arg, I wish I knew more about RawInput...

The way I send fake input is using the mouse_event API call, though it can also be done using SendInput.
Both of these calls have a dwExtraInfo parameter which I normally never use.

The docs say: An additional value associated with the mouse event. An application calls GetMessageExtraInfo to obtain this extra information
This is set using SetMessageExtraInfo

Code: Select all

LPARAM WINAPI SetMessageExtraInfo(
  _In_ LPARAM lParam
);
So this appears to allow you to set the LPARAM for the input?
Is the driver expecting something in LPARAM that identifies where the input came from?

Top