Seems that under WinCE, any key that can’t translate to UNICODE became
an unknown key. Don’t know why the programmers weren’t keeping the
untranslated virtual key instead of using the translated one, but when I
commented out these three lines, the WinCE directional pad started
generating proper SDLKEY_LEFT etc. Fix is as follows:
#ifdef NO_GETKEYBOARDSTATE
/* this is the workaround for the missing ToAscii() and ToUnicode()
in CE (not necessary at KEYUP!) */
if ( SDL_TranslateUNICODE ) {
MSG m;
m.hwnd = hwnd;
m.message = msg;
m.wParam = wParam;
m.lParam = lParam;
m.time = 0;
if ( TranslateMessage(&m) && PeekMessage(&m, hwnd, 0, WM_USER,
PM_NOREMOVE) && (m.message == WM_CHAR) ) {
GetMessage(&m, hwnd, 0, WM_USER);
// wParam = m.wParam; //Why are we doing this?
} else {
// wParam = 0; //Again
}
} else {
// wParam = 0; //again
}
#endif /* NO_GETKEYBOARDSTATE */