Problem remapping button 1 and 2 to simulated keystroke

x64 Replacement/Alternative to Microsoft's IntelliMouse application.
Forum rules
Please read the forum rules before posting for the first time.
The more information you can provide, the quicker and more accurately someone can help.
NOTE: To reduce spam, new users can not post links, files or images until they have at least 4 posts.
Post Reply
Lupin-III
New User
Posts: 2
Joined: Fri Jan 21, 2011 11:49 am

Problem remapping button 1 and 2 to simulated keystroke

Post by Lupin-III »

Hi Phil,

I'm using xmouse v1.52
windows 7 x64
kensington expert mouse (trackball 4 button, w/ wheel)
using hid compliant mouse driver

I'm trying to use xmouse to remap my trackball's buttons 1 and 2 to simulate a keyboard key, and using buttons 3 and 4 as my left/right click. I'm setting this up for the game Dead Space, as it doesn't normally allow mouse buttons to be remapped. Once inside the game, it doesn't seem to be using the simulated keystrokes, and the 1 and 2 buttons are still behaving as left/right click. I turned on the debugging log and it does seem as if it's switching over to the dead space controls.

Here's a snip from the log. I held down the left button (remapped as simulated keystroke u, repeat while button is pressed) for a few seconds to get a good look at it in the log. It does seem like it's repeating the keystroke, but the game isn't receiving a keystroke, and still acting like it's getting a left/right click. The remapped 3 and 4 buttons are working as I intended as the left and right click though.

21-01-2011 04:01:27> Enabling application specific button settings for 'dead space.exe'...
21-01-2011 04:01:27> Left = Simulated Keystrokesu Right = Simulated Keystrokesy Middle = Left Click 4th = Right Click 5th = Nothing (Don't intercept) Tilt Left = Nothing (Don't intercept) Tilt Right = Nothing (Don't intercept) InvertScrolling=off ScrollPages=off

21-01-2011 04:01:50> MouseHookData: Message=0x0201 (WM_LBUTTONDOWN), X=1159, Y=541, mouseData=0x00000000, flags=0x00000000, time=626761769, dwExtraInfo=0x0
21-01-2011 04:01:50> Translating Left Button Down: Action 28 (Simulated Keystrokes)
21-01-2011 04:01:50> SendKeyState: VKCode=0x55 Scancode=0x16 Flags=0x0 Release=0:
21-01-2011 04:01:50> SendKeyState: VKCode=0x55 Scancode=0x16 Flags=0x0 Release=1:
21-01-2011 04:01:50> SendKeyState: VKCode=0x55 Scancode=0x16 Flags=0x0 Release=0:
21-01-2011 04:01:50> SendKeyState: VKCode=0x55 Scancode=0x16 Flags=0x0 Release=1:
21-01-2011 04:01:50> Re-enable Timer: Delay 34 (milliseconds)
21-01-2011 04:01:50> SendKeyState: VKCode=0x55 Scancode=0x16 Flags=0x0 Release=0:
21-01-2011 04:01:50> SendKeyState: VKCode=0x55 Scancode=0x16 Flags=0x0 Release=1:
21-01-2011 04:01:50> Re-enable Timer: Delay 34 (milliseconds)
21-01-2011 04:01:50> SendKeyState: VKCode=0x55 Scancode=0x16 Flags=0x0 Release=0:
21-01-2011 04:01:50> SendKeyState: VKCode=0x55 Scancode=0x16 Flags=0x0 Release=1:
21-01-2011 04:01:50> Re-enable Timer: Delay 34 (milliseconds)

*** repeated quite a bit ***

21-01-2011 04:01:54> MouseHookData: Message=0x0202 (WM_LBUTTONUP), X=1159, Y=541, mouseData=0x00000000, flags=0x00000000, time=626765684, dwExtraInfo=0x0
21-01-2011 04:01:54> Translating Left Button Up: Action 28 (Simulated Keystrokes)




Any ideas on what's going on here? I've done a similar configuration in the games Mass Effect 1 & 2, and those don't mind it. Love this program by the way. Even back when I was using an OS that kensington supported, your software was still superior to theirs.
User avatar
phil
Site Admin
Posts: 7670
Joined: Sun Apr 06, 2003 11:12 pm

Re: Problem remapping button 1 and 2 to simulated keystroke

Post by phil »

Some games get mouse data in different ways. If they don't rely on windows messages then the game may still be seeing the left/right buttons as default. In fact I'd be surprised if most games dont work this way - XMBC generally is only going to be useful remapping buttons that the game does not usually see/use at all.

The interesting question here, does the game respond to both the default button click AND the simulated keystroke, it sounds like it ignores the keystrokes?

Again, some games do not accept injected keyboard presses, usually to deter "cheating"/scripting. I have to say, I've not found many games that don't work but there are one or two that I've had trouble with in the past, some of which have been bugs in XMBC and some have been the game not accepting the injected messages.

Unfortunately without the game, I don't think I will be able to test this one to see if the problem is the game or XMBC. Have you tried the various different methods of sending simulated keystrokes in the sim-keys configuration?

Thanks,
Phil
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
Lupin-III
New User
Posts: 2
Joined: Fri Jan 21, 2011 11:49 am

Re: Problem remapping button 1 and 2 to simulated keystroke

Post by Lupin-III »

I changed the simulated keystroke from 'repeat' to 'during' and that worked. The buttons are still working as left/right clicks as well as the simulated keystrokes, but that's not causing a problem... in fact, it's a little more convenient that way since the normal buttons still work like they should in the menus.

To answer your question, the game wasn't responding to the keystrokes before. I tested it by remapping some keys to the simulated ones using the keyboard, but it wasn't responding to them when getting it from the trackball.

Thanks for the help! I guess I was under the impression that to fool the game into thinking the mouse buttons were keyboard buttons, I'd have to make it behave the exact same way... by having the key repeated while the button was held down. I'll keep this in mind in the future if I run into other games designed by nazis who don't think people need full control in how they customize their controls.
User avatar
phil
Site Admin
Posts: 7670
Joined: Sun Apr 06, 2003 11:12 pm

Re: Problem remapping button 1 and 2 to simulated keystroke

Post by phil »

Actually during is the most likely option to work, because that essentially holds the key down while the button is down, thus any normal key-repeat patern should apply.

Anyway I'm glad you got it working :)
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
Post Reply