I'm still alive. And still coding. And I'll be staying an extra week to continue crossing stuff off the big TKDWC whiteboard.
I have to write about a very cool hack I did for work this weekend. We wanted some controller rumble in the game, which one should be able to add with a few DirectInput calls. But the game engine abstracts the input process enough that I can't access the DirectInput devices directly.
The solution: use a windows API hook to replace the DirectInput initialization function, and then replace a few values in the function pointer table that it returns. It's simply a matter of
- Making a copy of the pointer to each gamepad device when it's created, and
- Altering the flags to get an exclusive lock when the input device is acquired.
No modifications to the game engine are necessary. It calls the DirectInput functions, which appear to behave normally. Oh, and I found out about this API hook technique *accidentally* when I was google searching for something else. Good weekend :D