Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGGGHHH
Moderators: winston, another_commander, Getafix
Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGGGHHH
I have spent hours trying to figure this out.....with no luck whatsoever....
I Decided after losing my keyconfig.plist file that i wanted to define some new keys for certain things like ECM trigger, Fuel-injector trigger etc.....
I also decided i would like to use keys like ESC, home, end, pgup, pgdn, etc....
Imagine my surprise when I looked at the wiki and found that the keyboard codes table files listed on the wiki DON'T MATCH what is listed in the keyconfig.plist file.
I should note that my past experiences in life include Assembly Language Programming so Decimal and Hexadecimal are NOT NEW to me..,
So its not unclear what the **** i am talking about... here is a little segment posted from that file.
{
key_roll_left = 253; // left arrow
key_roll_right = 252; // right arrow
key_pitch_forward = 255; // up arrow
key_pitch_back = 254; // down arrow
Now..... No table i found via Google lists these keycodes in decimal or hexdecimal whatsoever.....
I even used some linux command line utilites (i even used the options) to no avail.....
All I could find was this and searching for the stuff mentioned in the posts GOT ME NOWHERE!
"OK, I found out the key codes for those keys that have no ASCII codes; they were in MyOpenGLView.h in SDL (or Cocoa) sources. Here they are: gvArrowKeyUp = 255, gvArrowKeyDown = 254, gvArrowKeyLeft = 253, gvArrowKeyRight = 252, gvFunctionKey1 = 241, gvFunctionKey2 = 242, gvFunctionKey3 = 243, gvFunctionKey4 = 244, gvFunctionKey5 = 245, gvFunctionKey6 = 246, gvFunctionKey7 = 247, gvFunctionKey8 = 248, gvFunctionKey9 = 249, FunctionKey10 = 250, gvFunctionKey11 = 251, gvMouseLeftButton = 301, gvMouseDoubleClick = 302, gvHomeKey = 303, gvEndKey = 304, gvNumberKey0 = 48, gvNumberKey1 = 49, gvNumberKey2 = 50, gvNumberKey3 = 51, gvNumberKey4 = 52, gvNumberKey5 = 53, gvNumberKey6 = 54, gvNumberKey7 = 55, gvNumberKey8 = 56, gvNumberKey9 = 57"
that is from this link ( on the Oolite site ) imagine that!!!! ( another user with the same query)
http://wiki.alioth.net/index.php/Talk:O ... d_Controls
And by some fasincating conidence this (It talks about oolite dev buts it posted under some other guys name)
http://cocoadev.com/index.pl?GameKeyboardHandlingAlmost
Okay, I fixed up the code using key_pressed_for_keycode to store the translated keypress between press and release, that solves the problem with the shift key being pressed or released while a key is held down. I used these very routines in Oolite ( http://oolite.aegidian.org/ )
I've just about pulled my hair out over this.... Does anyone know why the Above Key codes work???????? and what the keycodes actually are, because nothing on the wiki or the web i have found matches!.....
Cheers
I Decided after losing my keyconfig.plist file that i wanted to define some new keys for certain things like ECM trigger, Fuel-injector trigger etc.....
I also decided i would like to use keys like ESC, home, end, pgup, pgdn, etc....
Imagine my surprise when I looked at the wiki and found that the keyboard codes table files listed on the wiki DON'T MATCH what is listed in the keyconfig.plist file.
I should note that my past experiences in life include Assembly Language Programming so Decimal and Hexadecimal are NOT NEW to me..,
So its not unclear what the **** i am talking about... here is a little segment posted from that file.
{
key_roll_left = 253; // left arrow
key_roll_right = 252; // right arrow
key_pitch_forward = 255; // up arrow
key_pitch_back = 254; // down arrow
Now..... No table i found via Google lists these keycodes in decimal or hexdecimal whatsoever.....
I even used some linux command line utilites (i even used the options) to no avail.....
All I could find was this and searching for the stuff mentioned in the posts GOT ME NOWHERE!
"OK, I found out the key codes for those keys that have no ASCII codes; they were in MyOpenGLView.h in SDL (or Cocoa) sources. Here they are: gvArrowKeyUp = 255, gvArrowKeyDown = 254, gvArrowKeyLeft = 253, gvArrowKeyRight = 252, gvFunctionKey1 = 241, gvFunctionKey2 = 242, gvFunctionKey3 = 243, gvFunctionKey4 = 244, gvFunctionKey5 = 245, gvFunctionKey6 = 246, gvFunctionKey7 = 247, gvFunctionKey8 = 248, gvFunctionKey9 = 249, FunctionKey10 = 250, gvFunctionKey11 = 251, gvMouseLeftButton = 301, gvMouseDoubleClick = 302, gvHomeKey = 303, gvEndKey = 304, gvNumberKey0 = 48, gvNumberKey1 = 49, gvNumberKey2 = 50, gvNumberKey3 = 51, gvNumberKey4 = 52, gvNumberKey5 = 53, gvNumberKey6 = 54, gvNumberKey7 = 55, gvNumberKey8 = 56, gvNumberKey9 = 57"
that is from this link ( on the Oolite site ) imagine that!!!! ( another user with the same query)
http://wiki.alioth.net/index.php/Talk:O ... d_Controls
And by some fasincating conidence this (It talks about oolite dev buts it posted under some other guys name)
http://cocoadev.com/index.pl?GameKeyboardHandlingAlmost
Okay, I fixed up the code using key_pressed_for_keycode to store the translated keypress between press and release, that solves the problem with the shift key being pressed or released while a key is held down. I used these very routines in Oolite ( http://oolite.aegidian.org/ )
I've just about pulled my hair out over this.... Does anyone know why the Above Key codes work???????? and what the keycodes actually are, because nothing on the wiki or the web i have found matches!.....
Cheers
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
Unfortunately I also don't know a lot about keyboard codes. I seem to remember, though, that not all keys are actually mappable for Oolite. So you may be out of luck for at least some of the special keys.
Things like home, end, pgup etc. seem to suggest that you're on Windows. If I'm wrong and you're on a Mac I have one more suggestion: Try the Oolite Keymapper. That's a useful tool which creates a keyconfig by walking you through all commands and letting you press the key you want it assigned to.
At the very least you'll be able to open the created keyconfig and have a look at the codes that were assigned. That'll tell you what the codes for the special keys are.
Things like home, end, pgup etc. seem to suggest that you're on Windows. If I'm wrong and you're on a Mac I have one more suggestion: Try the Oolite Keymapper. That's a useful tool which creates a keyconfig by walking you through all commands and letting you press the key you want it assigned to.
At the very least you'll be able to open the created keyconfig and have a look at the codes that were assigned. That'll tell you what the codes for the special keys are.
- Cmdr. Maegil
- Sword-toting nut-job
- Posts: 1294
- Joined: Tue Feb 27, 2007 10:28 pm
- Location: On the mend in Western Africa
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
Sometime ago I asked for handlers directly over the player's controls, but to no avail.
Afterwards, I tried to fiddle on an OXP trying to make it change the ASC to "+" when in battle by
Afterwards, I tried to fiddle on an OXP trying to make it change the ASC to "+" when in battle by
.trigger
ing a jQuery.event
on a keydown
- but it wouldn't recognize jQuery
, even if the keycode were correct...You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
I'm obviously not one of them.
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
I have no clue what you want to show with above example. Or there is a wiki page I don't know about because your example from the keyconfig.plist does match the codes on the wiki exactly when I compare them:phrashee wrote:and found that the keyboard codes table files listed on the wiki DON'T MATCH what is listed in the keyconfig.plist file.
...
here is a little segment posted from that file.
{
key_roll_left = 253; // left arrow
key_roll_right = 252; // right arrow
key_pitch_forward = 255; // up arrow
key_pitch_back = 254; // down arrow
Code: Select all
! Action !! Key !! Keycode (Dec) !! Keycode (Hex) !! BBC Key !! Notes
|-align="center"
! Roll Left
| Left arrow || 253 || FD || , || <
|-align="center"
! Roll Right
| Right arrow || 252 || FC || . || >
|-align="center"
! Pitch Forward
| Up arrow || 255 || FF || s ||
|-align="center"
! Pitch Back
| Down arrow || 254 || FE || x ||
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- JazHaz
- ---- E L I T E ----
- Posts: 2991
- Joined: Tue Sep 22, 2009 11:07 am
- Location: Enfield, Middlesex
- Contact:
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
This might be my fault. I might have screwed up the table when I added the BBC keyboard keys.
JazHaz
Thanks to Gimi, I got an eBook in my inbox tonight (31st May 2014 - Release of Elite Reclamation)!Gimi wrote:Maybe you could start a Kickstarter Campaign to found your £4500 pledge.drew wrote:£4,500 though! <Faints>
Cheers,
Drew.
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
The keycodes in these tables and the config plist are indeces into an internal array in Oolite. For ASCII characters, the index happens to match the ASCII code. The same logic also maps joystick and mouse buttons into the same array. See the src/SDL/MyOpenGLView.m:pollControls function for more details.phrashee wrote:I've just about pulled my hair out over this.... Does anyone know why the Above Key codes work???????? and what the keycodes actually are, because nothing on the wiki or the web i have found matches!.....
Cheers
So it's hardly surprising that non-Oolite online resources give you no answers!
The glass is twice as big as it needs to be.
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
Interesting. Tell us more please, what were you trying to accomplish?Cmdr. Maegil wrote:Afterwards, I tried to fiddle on an OXP trying to make it change the ASC to "+" when in battle by.trigger
ing ajQuery.event
on akeydown
- but it wouldn't recognizejQuery
, even if the keycode were correct...
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
Why would you expect this to work? jQuery is a web scripting library that abstracts web browsery stuff and needs to be included with your web page. Any similarity between Oolite and a web browser is purely coincidental.Cmdr. Maegil wrote:Sometime ago I asked for handlers directly over the player's controls, but to no avail.
Afterwards, I tried to fiddle on an OXP trying to make it change the ASC to "+" when in battle by.trigger
ing ajQuery.event
on akeydown
- but it wouldn't recognizejQuery
, even if the keycode were correct...
E-mail: [email protected]
- Cmdr. Maegil
- Sword-toting nut-job
- Posts: 1294
- Joined: Tue Feb 27, 2007 10:28 pm
- Location: On the mend in Western Africa
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
I took the TAF reset OXP and tried to make it change the ASC to the current target mode if the player had lock-on onto another ship.Wildeblood wrote:Interesting. Tell us more please, what were you trying to accomplish?Cmdr. Maegil wrote:Afterwards, I tried to fiddle on an OXP trying to make it change the ASC to "+" when in battle by.trigger
ing ajQuery.event
on akeydown
- but it wouldn't recognizejQuery
, even if the keycode were correct...
Since I couldn't find a JS handler to do that, I googled on how to simulate a key press. I don't remember the exact syntax, but I tried it and Oolite logged something to the effect that it didn't recognize
jQuery
.[EDIT:] it's not that I expected it to work, it was pure trial and error - I'm too green on JS to even be able to make such judgements...
Last edited by Cmdr. Maegil on Mon Jan 16, 2012 3:46 pm, edited 2 times in total.
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
I'm obviously not one of them.
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
Now, I am no Objective-C coder, but from what little coding I have done (in Python) no less,, and the books i have read about c, I think this points to the magic I am looking for..
case SDLK_HASH: if (!shift) keys[126] = YES; break; // ~ (really #)
case SDLK_BACKQUOTE: if (!shift) keys[96] = YES; break; // `
case SDLK_SEMICOLON: keys[59] = YES; break; // ;
case SDLK_QUOTE: keys[39] = YES; break; // '
case SDLK_LEFTBRACKET: keys[91] = YES; break; // [
case SDLK_RIGHTBRACKET: keys[93] = YES; break; // ]
case SDLK_HOME: keys[gvHomeKey] = YES; break;
case SDLK_END: keys[gvEndKey] = YES; break;
case SDLK_INSERT: keys[gvInsertKey] = YES; break;
case SDLK_PAGEUP: keys[gvPageUpKey] = YES; break;
case SDLK_PAGEDOWN: keys[gvPageDownKey] = YES; break;
case SDLK_SPACE: keys[32] = YES; break;
case SDLK_RETURN: keys[13] = YES; break;
case SDLK_TAB: keys[9] = YES; break;
case SDLK_KP8:
case SDLK_UP: keys[gvArrowKeyUp] = YES; break;
case SDLK_KP2:
case SDLK_DOWN: keys[gvArrowKeyDown] = YES; break;
case SDLK_KP4:
case SDLK_LEFT: keys[gvArrowKeyLeft] = YES; break;
case SDLK_KP6:
case SDLK_RIGHT: keys[gvArrowKeyRight] = YES; break;
case SDLK_KP_MINUS: keys[45] = YES; break; // numeric keypad - key
case SDLK_KP_PLUS: keys[43] = YES; break; // numeric keypad + key
case SDLK_KP_ENTER: keys[13] = YES; break;
case SDLK_KP_MULTIPLY: keys[42] = YES; break; // *
And I am assuming that keys is the array you are speaking off. So now i just need to find this Table, and I assume that the number in the brackets in the index into the array, yes?
Cheers
case SDLK_HASH: if (!shift) keys[126] = YES; break; // ~ (really #)
case SDLK_BACKQUOTE: if (!shift) keys[96] = YES; break; // `
case SDLK_SEMICOLON: keys[59] = YES; break; // ;
case SDLK_QUOTE: keys[39] = YES; break; // '
case SDLK_LEFTBRACKET: keys[91] = YES; break; // [
case SDLK_RIGHTBRACKET: keys[93] = YES; break; // ]
case SDLK_HOME: keys[gvHomeKey] = YES; break;
case SDLK_END: keys[gvEndKey] = YES; break;
case SDLK_INSERT: keys[gvInsertKey] = YES; break;
case SDLK_PAGEUP: keys[gvPageUpKey] = YES; break;
case SDLK_PAGEDOWN: keys[gvPageDownKey] = YES; break;
case SDLK_SPACE: keys[32] = YES; break;
case SDLK_RETURN: keys[13] = YES; break;
case SDLK_TAB: keys[9] = YES; break;
case SDLK_KP8:
case SDLK_UP: keys[gvArrowKeyUp] = YES; break;
case SDLK_KP2:
case SDLK_DOWN: keys[gvArrowKeyDown] = YES; break;
case SDLK_KP4:
case SDLK_LEFT: keys[gvArrowKeyLeft] = YES; break;
case SDLK_KP6:
case SDLK_RIGHT: keys[gvArrowKeyRight] = YES; break;
case SDLK_KP_MINUS: keys[45] = YES; break; // numeric keypad - key
case SDLK_KP_PLUS: keys[43] = YES; break; // numeric keypad + key
case SDLK_KP_ENTER: keys[13] = YES; break;
case SDLK_KP_MULTIPLY: keys[42] = YES; break; // *
And I am assuming that keys is the array you are speaking off. So now i just need to find this Table, and I assume that the number in the brackets in the index into the array, yes?
Cheers
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
Not sure what you mean by 'find this Table'.phrashee wrote:So now i just need to find this Table
As Eric pointed out, there's a Wiki table here which has the standard key configuration and all the correct (Oolite) keycodes.. (although it does appear that some commands are missing) so if you want to remap any keys, just create your own keyconfig.plist (the Wiki gives more details).
NB: You can only remap ASCII keys and the special keys which Oolite already knows about. If you have a weird & wonderful key on your keyboard which you want to use, then you'll have to edit the source code to add it in yourself.
The glass is twice as big as it needs to be.
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
Ah, sorry I should have explained in greater detail.
So, I am looking for the table that represents the keys array.
I tried using the grep (pattern matching) command in linux at the beginning of the file tree (./oolite-source-1.xx) and tried
grep -r "keys" - Which returned nothing.
thats supposed to do a recursive search for any line that matches the text string "keys".
Cheers
phrashee
Ok... screwed up here.... Brain got exhausted....
I should have used grep -r "keys" * | less
So, I am looking for the table that represents the keys array.
I tried using the grep (pattern matching) command in linux at the beginning of the file tree (./oolite-source-1.xx) and tried
grep -r "keys" - Which returned nothing.
thats supposed to do a recursive search for any line that matches the text string "keys".
Cheers
phrashee
Ok... screwed up here.... Brain got exhausted....
I should have used grep -r "keys" * | less
Last edited by phrashee on Mon Jan 16, 2012 6:05 pm, edited 1 time in total.
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
Are you looking for where the keys array is defined in the source-code?
If so, src/SDL/MyOpenGLView.h:101
EDIT: or src/Cocoa/MyOpenGLView.h for Mac-users.
I'm really failing to understand what you're trying to achieve though..
If so, src/SDL/MyOpenGLView.h:101
EDIT: or src/Cocoa/MyOpenGLView.h for Mac-users.
Code: Select all
BOOL keys[NUM_KEYS];
The glass is twice as big as it needs to be.
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
I'm really failing to understand what you're trying to achieve though..
Yeah, I have almost lost sight of it, myself I went from simply editing a file to configure keys to reading source code to achieve the same means.
My objectives are
1) is to simply figure out which keys I can use in oolite (without modifying the source, which may be possible but my experience in compiling software so far says it wont be any fun, even if my work is perfect.)
2) Figure out the codes that OOLITE understands for those keys ..... (sorry about the capitals but its needed to Oolite translating those keys)..Some many posts go "oh the scancodes are at this web page or that web page which is useless because Oolite dosent understand those codes)
3)Reassign the keys to make oolite more playable.
I'm not the first user to get stuck figuring this out, and I wont be the last...
I'm in the process of putting together a textfile which will hopefully address this, there are so many posts about this its not even funny.
the textfile will hopefully list these codes so others dont suffer as well, maybe if I am successful it can be put on the wiki in place of the confusion that is there presently.
Cheers
phrashee
p.s.: Ah looks to me that the array i am looking for is actually called keycodetrans. Name is pretty self-explanatory (Line 108)
Yeah, I have almost lost sight of it, myself I went from simply editing a file to configure keys to reading source code to achieve the same means.
My objectives are
1) is to simply figure out which keys I can use in oolite (without modifying the source, which may be possible but my experience in compiling software so far says it wont be any fun, even if my work is perfect.)
2) Figure out the codes that OOLITE understands for those keys ..... (sorry about the capitals but its needed to Oolite translating those keys)..Some many posts go "oh the scancodes are at this web page or that web page which is useless because Oolite dosent understand those codes)
3)Reassign the keys to make oolite more playable.
I'm not the first user to get stuck figuring this out, and I wont be the last...
I'm in the process of putting together a textfile which will hopefully address this, there are so many posts about this its not even funny.
the textfile will hopefully list these codes so others dont suffer as well, maybe if I am successful it can be put on the wiki in place of the confusion that is there presently.
Cheers
phrashee
p.s.: Ah looks to me that the array i am looking for is actually called keycodetrans. Name is pretty self-explanatory (Line 108)
Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG
Or maybe keycodetrans is not what i am looking for.
Oh well, I never said i actually knew Objective C. The only coding i have done in life beyond 30 lines or so has been in a billion flavors of basic (mostly retro) and Assembly (6510, 80386 and some Pentium instructions) .
Oh well..
Oh well, I never said i actually knew Objective C. The only coding i have done in life beyond 30 lines or so has been in a billion flavors of basic (mostly retro) and Assembly (6510, 80386 and some Pentium instructions) .
Oh well..