Archive for July 7th, 2008

Keyboard troubles in 2008

Monday, July 7th, 2008

Bug reported in KP :

“I can’t jump while moving backward + left or right! However the jump works when moving forward +left or right”.

Well, change your keyboard. After investigation, this is neither a DirectInput nor a Win32 problem: it’s a low-level keyboard issue. Some keyboards don’t support the key combination, period. Others, USB keyboard in particular, seem more friendly (and the bug doesn’t happen with them).

Quick test to see if your keyboard is “bad”:

  • run this exe from the DirectX SDK: \Program Files\Microsoft DirectX SDK (August 2007)\Samples\C++\DirectInput\Bin\x86\Keyboard.exe
  • create an Exclusive, Foreground, Immediate device
  • press keys S, D and Space simultaneously.

If it says: “Data 0×1f 0×20 0×39″ you’re good, go play KP. If 0×39 is missing, you’re screwed. Like me.

…I seem to remember this wasn’t an issue on an ST, but I’ll shut up.

EDIT: this is really a low-level keyboard issue

Debug console for Win32 app

Monday, July 7th, 2008

I keep forgetting this one so let me post it once and for all. Adding a debug console to a Win32 app takes 4 lines of code.

if(AllocConsole())
{
freopen(”CONOUT$”, “wt”, stdout);

SetConsoleTitle(L”Debug Console”);

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
}

You can then printf your way out of trouble.

shopfr.org cialis