SlimDX Wrong Joystick State on startup - joystick

I use SlimDX and DirectInput to handle a XBox 360 Gamepad for Windows. Everything is working fine but I have the following problem:
When a button is pressed while starting the application, the button state is NOT shown as pressed in the joystick state. The same with the analog sticks: if I hold the stick fully in one direction on startup, the position is shown as zero and changes upon first little movement of the stick.
Is there a way to get the real state of the joystick at startup ?

Using XInput instead of DirectInput solves the problem.

Related

Programmatically Press a Game Controller Button on Windows

TLDR
Have a USB Game Controller, searching for a method in any Windows compatible language to press a button on it.
Detail
I have Windows gaming PC and a set of four Ultimarc Ultrasticks built into an arcade cabinet. Each Ultimarc Joystick appears as 16 button device on Windows, because of a shift key feature I have no interest in using. It would eat a button and slow response time. My layout uses 8 buttons, which is exactly how many inputs the joystick has.
However, I'm hopeful I can use the fact that those buttons exist for the device to add a virtual start button to each joystick.
I'm open to using any language, but looking for a method to programmatically press the 9th button on this joystick, which is available as far as windows knows, despite not having a physical input.
I'm familiar with key remappers that create a virtual game pad with their keys mapped to other physical devices, but those come with the complexity of having duplicate joysticks on the system, and don't seem necessary if I can just virtually press this one more button, since all other buttons and axes are mapped as I want.

absolute mouse buttons on dock

I have created an absolute mouse piece of hardware.
This is very much like a wacom tablet, but it just uses a regular mouse going into a piece of hardware that then increments or decrements the X and Y coordinates in order to specify the exact location of the mouse (yes I need to do this for another reason).
While everything works fine on multiple operating systems, it works fine on Mac OSX Yosemite except ---->
When I move to the dock, if I click on an icon it will not start the application, I can move the icon and once open I can close the app or scroll, anything you would expect from a mouse, it will not start properly. Also the back arrow in the system settings/preferences will only operate if I am on the exact right location on the button, i.e. normally there is no back action, but if I mess with it and get it in just the right location it will finally work.
This sounds like an oversight in the operating system, does anyone have any insight into this?

Simulating Mac Mouse Events beyond CGCreateMouseEvent

I've been successfully using CG mouse events to simulate mouse down/drag/up events using a specialized hardware controller. However, I come across some applications in which using these CG mouse events has no effect- that is, I can click and drag the actual mouse to change controls within a certain area of the application, but simulating these exact same movements using CGCreateMouseEvent (tried posting to HID system state and CombinedSession state) does not work.
Perhaps these apps are listening specifically for a mouse/touchpad hardware device? Is there any way to more "realistically " simulate mouse events so that these app think the actual mouse/touchpad is dragging?

2 Mice, capturing exclusively one mouse on windows (DirectInput, DDK, Linux, anything)

I have connected 2 mice to PC and I wish one mouse to work as regular mouse and capture second mouse exclusively.
First I was trying DirectInput. It showed 2 devices with word mouse in InstanceName.
But only one device had DeviceType.Mouse and it was only really working device.
When I was acquiring it was blocking both mice.
Second I decided to create driver. I downloaded WinDDK. There is Mouse Filter driver sample.
I was able to compile it.
But I am not driver programmer. It is complex for me to understand but it has some code related to PS/2 mouse. All my mice are USB.
It should be installed with .INF file. I prefer it be dynamically loaded.
I am not quite sure that it is right direction.
I do it for my hobbyist robotic project. I wish PC take some information from mouse as sensor.
I think there must be existing similar projects or solutions.
I have linux pc on my table as well. May be better to attach mouse to linux and parse
/dev/input/mouse0
/dev/input/mouse1
/dev/input/mouse2
looks like
sudo cat /dev/input/mouse1 - gives some data but does not block device from clicks and movements.
I hope simple solution already exists
Cheers
Max
For Linux, you need to either declare the first mouse as the CorePointer or configure the second mouse to have SendCoreEvents false. See the xorg.conf(5) man page for more details.

No keyboard input from GLUT while mouse is moving (In OS X)

So I just built an OpenGL application on a Mac for the first time. I'm using GLUT to get keyboard input. The trouble is, I've discovered that if I'm moving the mouse at the same time I push a button on the keyboard, my keyboard function doesn't get called! If I push a button when the mouse isn't moving, it gets called just fine. The same goes for my keyUp function. Why could this be?
I'm also having trouble with the mouse motionFunc - it seems to not be getting called every frame and lead to choppy mouse input ...
Can you provide a code sample? It sounds like a bug in your event handling code.
That said, GLUT is no longer developed and you should not be using it. There are numerous better alternatives, the most popular being SDL. Others include GLFW and SFML, and you can even use Qt.

Resources