From: Maarten t. H. <ma...@tr...> - 2008-03-15 13:13:45
|
Hi, Attached are the modifications I had to make to get my PS/2 to GC keyboard adapter working properly. The adapter from "May Flash" and on the box it is called "GC Keyboard & PS Controller Adapter 2in1" (it can convert PSX joypads as well). There are two parts to the modifications: - getting the key codes from the raw data - a few changes in the key mapping The raw data was located in different nibbles as in the original code. I don't know if my adapter is different from the other keyboards/adapters, whether the data format is different in Wii mode compared to GC mode or whether the old code was simply broken. The old code for the third key does look broken: key[2] = (raw[0] << 4) & 0xFF; key[2] |= (raw[1] << 28) & 0xFF; The second statement has no effect, but if you replace "<<" by ">>", it starts making sense. Since this only makes a difference if 3 keys are pressed simultaneously, it's likely nobody noticed it, so the rest of it might still be correct. If you look at the diff, the key mapping looks totally different, but that is because I had to realign the columns; in fact there are only a few changes: 0A: scroll Lock 36: PrtSc and numpad-slash 37: numpad-star 39: semicolon 3A: apostrophe 3F: backslash 53: caps Lock cursors: 36 and listed I'm using a US/International PS/2 PC keyboard, so differences are probably not due to a PC keyboard layout difference. I am looking for someone with a different keyboard/adapter to test whether this new code works with it. And if it doesn't, if there is some way to auto-detect the keyboard type (maybe using other parts of the raw data). Bye, Maarten |