Don't do a keyboard hack...
You could buy an Ipac, Keywiz, or some other encoder.
Or, if you really want to hack something, use a PC gamepad. Lots of games accept joystick input, and for those that don't, there is a program called joy-to-key that will take your joystick inputs and convert them to keyboard inputs.