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

Post gaming related scripts
User avatar
evilC
Posts: 3413
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, 10:28

So the gun sends regular mouse buttons?
gun1Button0 == LMB?
gun1Button1 == RMB?

What is gun2Button0? LMB on a different mouse?

MouseDelta does not normally pay attention to button input, but I could give you code that does.
If the guns do just behave like a mouse though, unless gun0 and gun1 report as different mice, we would not need MouseDelta, we could just use a regular hotkey.

Try this script - does it show a tooltip when you press some of the gun buttons?

Code: [Select all] [Download] GeSHi © Codebox Plus

~LButton::
~RButton::
~MButton::
~XButton1::
~XButton2::
Tooltip % A_ThisHotkey
return
phasermaniac
Posts: 47
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, 10:54

Yes, gun buttons are regular mouse buttons. this is the driver I use:
http://www.arcadehits.net/pics/ups/Top-G_005.jpg

gun 0 and gun 1 reports as diferent mice, ID=65591 is gun1 ID=65592 is gun1 and 65593 is a regular mouse.

When i press mouse left button or some of the gun trigger I get "~LButton"message
User avatar
evilC
Posts: 3413
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, 11:00

OK, so we need MouseDelta to be able to differentiate between the mice.

I can make you a modified version of MouseDelta that reports button numbers instead of axis position, so that is no problem.

Now that I know that the different guns report as different IDs though, that is a bit of a problem.
I do not know how to send fake mouse data as a *specific* mouse, only as ID 0.

Can you rig the emulator so that it responds to keys for the triggers?
ie we write code that listens for gun 1 trigger being pressed, and when it sees it pressed, flashes the screen, then sends F1.
The game is then told that the trigger is in fact F1, not mouse ID#65591 button 1

Is this possible?
Helgef
Posts: 2109
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)

10 Apr 2017, 11:20

phasermaniac wrote:gun 0 and gun 1 reports as diferent mice, ID=65591 is gun1 ID=65592 is gun1 and 65593 is a regular mouse.

My observations are that the ids change on reboot. You might need some id identification procedure rather than hardcoding it.
phasermaniac
Posts: 47
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, 11:39

I use a program that makes some emus that supported only one gun playable with 2 guns, and it save the following ids for guns:
P1Device = \\?\HID#VID_0B9A&PID_016A&Col01#7&28d4c0d1&3&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}
P2Device = \\?\HID#VID_0B9A&PID_016A&Col01#7&3b8e7176&8&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}
they don't change.

emulators like mame, supermodel let you map the triggers as you want but others won't. Would be easy this way?
phasermaniac
Posts: 47
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, 11:50

I asked the author of this program (Demulshooter) if he thinks would work:
"But as far as DemulShooter is concerned, it will not recognize these kind of script-sent inputs :
To be able to dissociate devices I have to ask windows to forward me all raw-input message so that I can identify them and treat them
Most of the time, ahk scripts and other program are sending direct input messages, and it totally different"
User avatar
evilC
Posts: 3413
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, 13:54

Helgef wrote:
phasermaniac wrote:gun 0 and gun 1 reports as diferent mice, ID=65591 is gun1 ID=65592 is gun1 and 65593 is a regular mouse.

My observations are that the ids change on reboot. You might need some id identification procedure rather than hardcoding it.


This begs the question of how MAME knows which ID is for which gun.

I wonder if this value that we have been using as "MouseID" is actually a pointer to a GUID or something?

RAWINPUTHEADER

hDevice
Type: HANDLE
A handle to the device generating the raw input data.
phasermaniac
Posts: 47
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, 14:53

Take care because

P1Device = \\?\HID#VID_0B9A&PID_016A&Col01#7&28d4c0d1&3&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}
P2Device = \\?\HID#VID_0B9A&PID_016A&Col01#7&3b8e7176&8&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}

And

ID=65591 is gun1 ID=65592 is gun1 and 65593

Are data taken from different computers so don't correspond
User avatar
evilC
Posts: 3413
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, 17:21

Still not sure that's gonna help us achieve his ideal goal.
Current plan of remapping the trigger to something inactive is not gonna fly, because we can only send as ID 0 (ie AFAIK mouse_event always sends as ID 0), so the driver will not recognize button presses as coming from the guns, or at least not from player 2.

I think Interception could probably solve this, but I am not that down with C++ I am afraid, also potentially nefarius' ViGEm suite may be able to sort this (if he gets around to finishing it)

Unless we can find some way of faking the gun triggers, then basically the only option I see is to physically mod his guns to add a two-stage trigger, and have the first stage do the flash.
phasermaniac
Posts: 47
Joined: 09 Apr 2017, 14:05

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

11 Apr 2017, 09:15

This was posted by nuvee plugins autor (dual lightguns suport for ps1 and ps2 emulators)
http://ngemu.com/threads/input-plugin-nuvee-psx-controller.143143/
Seems the way the plugin comunicates with emulator.
May it help in some way?

typedef void (CALLBACK* PADhandleHID)(LPARAM);


case WM_INPUT:
PAD1_handleHID( lParam );
PAD2_handleHID( lParam );
return TRUE;
User avatar
evilC
Posts: 3413
Joined: 27 Feb 2014, 12:30

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

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] [Download] GeSHi © Codebox Plus

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?
User avatar
evilC
Posts: 3413
Joined: 27 Feb 2014, 12:30

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

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.
Helgef
Posts: 2109
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)

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.
Helgef
Posts: 2109
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)

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] [Expand] [Download] GeSHi © Codebox Plus


Edit: This code has errors it seems.

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

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


This seems better, but it gives me four results, as I said, I have only two mice. Sorry for derailing. :offtopic:
phasermaniac
Posts: 47
Joined: 09 Apr 2017, 14:05

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

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?
phasermaniac
Posts: 47
Joined: 09 Apr 2017, 14:05

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

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
Helgef
Posts: 2109
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)

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.
phasermaniac
Posts: 47
Joined: 09 Apr 2017, 14:05

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

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

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 4 guests