Sunday, July 5, 2009

No, it's not vaporware!

No, this is not vaporware! I'm actually able to walk and run in Far Cry 2 now using my treadmill. Actually, most of the time now have been with hacking with the Wii Remote! I'm currently tweaking around with a GlovePIE script, so I can use the Wiimote to be able to turn and change direction. Remember, walking on the treadmill only takes me back and forth. I want a cool way changing direction as well! And with the Wiimote I also get bonuses as the IR, the accelerometers build in and a few extra buttons. I also happen to have a gun holder, so I can transform the Wiimote into a "gun" which suits the game I'm testing this with perfectly. The Wiimote can also rumble, which it now does when shooting... The Nunchuck adds even more extra goodness!

One extra little thing that adds to the experience is that the game takes place in Africa, and since it's hot here now because of summer, it feels even more that I'm actually there. You sweat and get tired fast, hehe. Also, swinging the Nunchuck throws a grenade in the game...

Sunday, May 24, 2009

I'm Back!

Yes, it's true, I'm back home again and will now continue with this lovely project!

Wednesday, March 18, 2009

Put on hold for a moment

Yea, I will go away for a month in a few days, so this project will be on hold until then. So far I've managed to set up a project and combined libusb and the KernelHotkey Driver and figured out how to handle the raw data from libusb! So, now I get lovely 0 (zero) standing still, increasing or decreasing in value depending on which way and how fast it goes!

More to come...

Tuesday, March 10, 2009

And We Have the Key to the Key Events!

Well, well. Thanks to a guy named Jorick Jester and his wonderful KernelHotKey driver, I've now managed to send keyboard events to games! And everything else for that matter since it's on a super low level. You actually intercept the event just after the key press. And, if you want, you can do whatever you want with the event, before it even reaches anything else...

You start by pressing a key on the keyboard you want to send from. That is, you identify the keyboard first. When that is done, I get, and keep a reference to that keyboard in my application. And then, I can send events as if I pressed on the keyboard using that reference! Pretty nifty! Games are none the wiser!

Usually, games have protection against these kind of things, because of cheaters. But, since this is on such a low level, they can't tell if I pressed a key physically or not. Also, I will naturally not use this to cheat in games. This is for a good cause.

Sunday, March 8, 2009

The Next Step


Phidgets package arrived. While still investigating the "send key events to games" issue, I have been thinking about what the next step would be when it is solved. The image to the left is the Phidget 3 Axis Accelerometer. With this I may use it to control the direction you are looking in the game.

Below you can see what some did with a mouse and a accelerometer. Quite neat and may very well be something I do too.


( Project URL )



Well, this will not work with the treadmill, but since it is a classic I included it here:

Sunday, March 1, 2009

When you are almost there...

I can see the goal line, but someone just moved it further away... The issue now is to make the keyboard events I'm sending reach the games. From what I have read, many games uses DirectX's DirectInput, which reads at a low driver level. Meaning SendInput I'm testing with now may not be enough. I may have to inject/override/hook some functions or some other way put the keyboard events into the keyboard driver buffer...

However, the good news is that I know it's possible. It works for instance in GlovePIE, so it's just a matter of figuring out how, compared to the first major issue I had which had an unknown solution.

Sunday, February 22, 2009

libusb FTW!

After dealing with this library back and forth, having issues making it work properly, I managed to solve it at last. Thanks goes to a French guy named Clement, who helped me!

The HID driver Windows thinks is the best driver to use, is now disabled, and I use LibUSB-Win32 instead!

Now, the main issue about games receiving mouse events from the mouse used with the treadmill is solved. HID driver is disabled, and I speak with the mouse through libusb - which is the only application that will receive the events!

Typically, I will get some raw data like this:

8: 00 00 28 00 00 00 d8 ff
8: 00 00 1e 00 00 00 e2 ff
8: 00 00 2a 00 00 00 d6 ff
8: 00 00 1f 00 00 00 e1 ff
8: 00 00 2a 00 00 00 d6 ff
8: 00 00 22 00 00 00 de ff
8: 00 00 2b 00 00 00 d5 ff
8: 00 00 20 00 00 00 e0 ff
8: 00 00 28 00 00 00 d8 ff
8: 00 00 20 00 00 00 e0 ff
8: 00 ff 29 00 ff ff d7 ff
8: 00 00 24 00 00 00 dc ff
8: 00 00 28 00 00 00 d8 ff
8: 00 00 22 00 00 00 de ff
8: 00 00 27 00 00 00 d9 ff
8: 00 00 21 00 00 00 df ff
8: 00 00 27 00 00 00 d9 ff
8: 00 00 1d 00 00 00 e3 ff


And, if it goes slowly this is what I get:

8: 00 00 04 00 00 00 fc ff
8: 00 00 03 00 00 00 fd ff
8: 00 00 03 00 00 00 fd ff
8: 00 00 03 00 00 00 fd ff
8: 00 00 04 00 00 00 fc ff
8: 00 00 03 00 00 00 fd ff
8: 00 00 02 00 00 00 fe ff
8: 00 00 04 00 00 00 fc ff
8: 00 00 02 00 00 00 fe ff
8: 00 00 03 00 00 00 fd ff

I basically have two options from here:
  1. Try to send mouse events to GlovePIE (only), and use that normally.
  2. Send keystrokes from my application. This is the last resort, if I can't make above work. For basic simple keystrokes this is manageable from my application, but if I want to go crazy, it would be best to use GlovePIE, so that is why I will try to solve sending mouse events from my application to GlovePIE first.

Wednesday, February 18, 2009

After Some More Research...

Seems like I may solve the issue by doing a filter driver. This is really hardcore stuff.

OR

I want to give heads up to Phidgets! This may very well be a solution. Waiting for response to see if they may be able to help out with a hardware phidget which can help me out... If this can be solved with Phidgets, there are some other cool phidgets which can be used to trigger other things in the game...


Current issue is as follows:

Detailed (Technical)

The RegisterRawInputDevices function will only work on the thread that called it, aka, the application. With this I can identify which mouse send the event, but it will not intercept messages going to other processes (other threads) since each process (in user mode) thinks it's the only process running in the system. When the input focus is moved to a different application window, those WM_INPUT messages only go to that window. They don't propagate system-wide.

The only way to see mouse messages system-wide is to implement a LowLevelMouseProc and use the Windows Hooks functions (SetWindowsHookEx). But, in doing so, I also lose the ability to get the Raw Input data since raw isn't supported by the hook messages. And, with the Global Hooks, I'm not able to identify the mouse, which led me to using RawInput, which doesn't work globally, which...


In short

Microsoft sucks.

Thursday, February 12, 2009

Where it all began...

So, I thought... how to make this gaming thing more real, fun and at the same time - exercise? Or, how can I exercise and have fun at the same time? Really, I want to bring as realistic experience to gaming as possible and more than just pressing buttons and moving one arm. Not just PLAYING the game - Be IN the game.

A few months ago, I bought a USB bike, and been using it a lot. So, one can say this is the next step. Pun intended. :)

The main goal is to let my treadmill work with... say FPS games. So I can walk/run on the treadmill and that will move the character in the game. Then we'll see what could be next.

As you can see in the header image, I'm using a Saitek Pro Gamer Command Unit and under the treadmill, I have taped a Razer Deathadder mouse. I'm using this 1800 DPI mouse, since it really has to have high DPI to be able to catch the fast speed going when running on the treadmill. This has been tested, and works really well. I tried a mouse with less than 1000 DPI, and that one couldn't handle running speeds.

The Pro Gamer Command Unit is for all commands one can do in a game. So I can e.g. open doors... The mouse is connected to the computer and I was testing around with GlovePIE. Worked perfectly. This in front of my projected screen, it will surely feel like walking in the game. :)

However...

If it wasn't for games seemingly just grabbing input from every mouse connected to the computer, I would be all set by now. So, this will be the adventure of figuring out a way to make it work walking/running on the treadmill and let the character only walk/run in the game...

I welcome any help I can get!

Enjoy!