Write a wrapper, through which you run your game.
Have the wrapper say
- Any key press, send unchanged to child process.
- if no key-press within N seconds from last key press, send X-key to child process.
- Anything returned from child, send unchanged to parent stdout/error
If it's controled stricktly through keyboard bindings, then it's not that difficult, but if it's controled through mouse-movements aswell, then it will introduce some difficulties, which you can overcome, but not without alot of trouble.