Chittering Clawbug Duskwolf Posted January 4, 2008 Share Posted January 4, 2008 First, the bad news: New Macbooks don't have the "emulated numeric keypad" feature where you get a keypad by typing {jkluio789}. This makes the Avernum games a lot more annoying to play, as you can't move effectively. (The arrow keys move you in kind of weird directions, and don't work at all for the diagonals.) The good news: There's a simple solution. Right now, it's impractical for anyone except developers. (To those who are: DYLD_INSERT_LIBRARIES.) However, Jeff could integrate it into the games pretty easily - consider this a black-box code contribution. Here it is. Note that this should be configured to only apply to x86 systems - it's not useful on PPC, as Powerbooks have numeric keypad built-in. Code: #define FN_KEY 0x8000000000000000LLstruct { int from, to; } keypad_conv[9] = { {26, 89}, {28, 91}, {25, 92}, {32, 86}, {34, 87}, {31, 88}, {38, 83}, {40, 84}, {37, 85}};void GetKeysWrapper(uint64_t *buf) { int i; GetKeys(buf); if(buf[1]) return; for(i = 0; i < 9; i++) { if(buf[0] == (FN_KEY | (1LL << keypad_conv[i].from))) { buf[0] = 1LL << keypad_conv[i].to; buf[1] = 1LL << (keypad_conv[i].to - 64); return; } }} Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted January 4, 2008 Share Posted January 4, 2008 Out of curiosity, what exactly does the proposed code block do? At a glance it's clear that it's mapping some set of nine inputs to nine others, but from what to what is it mapping? Basically, what would the difference to the user be when using the keyboard? (Save us all having to look up the virtual key codes please. ) Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Callie Posted January 4, 2008 Share Posted January 4, 2008 Have you e-mailed Jeff by any chance? Many laptops I've seen have numeric keyboards that work only if number lock is on. However, I highly doubt you wouldn't have noticed that already. Quote Link to comment Share on other sites More sharing options...
Chittering Clawbug Duskwolf Posted January 4, 2008 Author Share Posted January 4, 2008 Excalibur, Apple decided to drop NumLock and the numeric keypad from the most recent revision of MacBooks. I'm not quite sure why, but my code restores it within Avernum. Good point about mailing Jeff, BTW. I'll go ahead and do that. Niemand, the specific mapping this implements is: Fn+j -> keypad 1 Fn+k -> keypad 2 Fn+l -> keypad 3 Fn+u -> keypad 4 Fn+i -> keypad 5 Fn+o -> keypad 6 Fn+7 -> keypad 7 Fn+8 -> keypad 8 Fn+9 -> keypad 9 Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted January 5, 2008 Share Posted January 5, 2008 Nice; looks really useful, Duskwolf. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.