Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGGGHHH

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG

Post by Micha »

phrashee wrote:
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.)
See the Wiki page.
phrashee wrote:
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)
All ASCII codes, plus a handful of special codes for things like PGUP/PGDN/HOME/... those are defined at the top of MyOpenGLView.h, as you've already found in your very first posting.
phrashee wrote:
3)Reassign the keys to make oolite more playable.
Again, see the Wiki page.



There should really be no need to dig through the code or look at translation tables.
For example, to change the key to launch a missile to 'l' and to change the keys to step through the compass modes to PGUP/PGDN:
keyconfig.plist:

Code: Select all

key_launch_missile = "l";
key_prev_compass_mode = 307; // PageUp
key_next_compass_mode = 308; // PageDown
Not everything can be remapped (for example, to switch views), nor can every key be used (for example, caps-lock).
The glass is twice as big as it needs to be.
phrashee
Above Average
Above Average
Posts: 20
Joined: Tue Jan 10, 2012 2:18 pm

Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG

Post by phrashee »

ll ASCII codes, plus a handful of special codes for things like PGUP/PGDN/HOME/... those are defined at the top of MyOpenGLView.h, as you've already found in your very first posting.

WRONG, HERE IS the start of MYOPENGLVIEW.h - direct from the source code....(minus opening comments and copyright)

#import "OOCocoa.h"
#import "OOOpenGL.h"

#include <SDL.h>

#define OpenGLViewSuperClass NSObject
#define MOUSEVIRTUALSTICKSENSITIVITYFACTOR 0.95f
#define MOUSEX_MAXIMUM 0.6
#define MOUSEY_MAXIMUM 0.6

#define MAX_CLEAR_DEPTH 100000000.0
// 100 000 km.

#define NUM_KEYS 320
#define MOUSE_DOUBLE_CLICK_INTERVAL 0.40

#define SNAPSHOTS_PNG_FORMAT 1

@class Entity, GameController, OpenGLSprite;

enum GameViewKeys
{
gvFunctionKey1 = 241,
gvFunctionKey2,
gvFunctionKey3,
gvFunctionKey4,
gvFunctionKey5,
gvFunctionKey6,
gvFunctionKey7,
gvFunctionKey8,
gvFunctionKey9,
gvFunctionKey10,
gvFunctionKey11,
gvArrowKeyRight,
gvArrowKeyLeft,
gvArrowKeyDown,
gvArrowKeyUp,
gvMouseLeftButton = 301,
gvMouseDoubleClick,
gvHomeKey,
gvEndKey,
gvInsertKey,
gvDeleteKey,
gvPageUpKey,
gvPageDownKey,
gvNumberKey0 = 48,
gvNumberKey1,
gvNumberKey2,
gvNumberKey3,
gvNumberKey4,
gvNumberKey5,
gvNumberKey7,
gvNumberKey8,
gvNumberKey9 //57
};

Maybe i could assume that numberkey1=49, numberkey2=50 etc...... However this is not obivious at first glance to someone who does not write code daily...


How the hell is the average user supposed to figure that out....i'm not even sure if my assumption is correct.

And "see the wiki" sin.........AGAIN AGAIN AGAIN......So where did you find this then
key_prev_compass_mode = 307; // PageUp
key_next_compass_mode = 308; // PageDown

I'm sorry, I really am, But it is no frustrating when you tell someone again and again and again "Please dont point me to the wiki page where the information ISN'T there"

Where on the wiki are the keycodes 307, 308, I dont see them anywhere

Its not at the links here either...

"al)! (If you don't have a hex/decimal calculator handy try this table or this online converter.)"

or here.

You'll find a list of Linux keycodes here. Note th


AS TONS OF USERS HAVE ALREADY STATED... THE CODES DONT MATCH

How the hell is the average user supposed to figure that out....

I am at point of gritting my teeth in frustration. I used to do Tech support for a ISP, we didnt use scripts, and If i didnt listen to what a customer said, I would have got canned. I hate it when other tech people do this to others. If they are Paid, Volunteer or otherwise and I've done both....

I appreciate your effort up to this point and I'm just going to drop it and post my results......I'm tired of being pointed to information there IS NOT THERE. I'm tired of being pointed at the same damn link. It Appears you are tired of it also, so you do what frustrates the person best in order not to have to deal with it. Well you got what u wanted.

There is 30 pages of other users with the same problem..... NO ONE HAS changed the wiki. NO ONE has bothered., And if my assumption is correct, I HAD TO DIG THROUGH THE CODE TO FIGURE IT OUT!

It's a shame i wasted my time on this instead of setting up my router box... i'm disappointed in myself and again as usual in the others in my community.

Annoyed and done with it. It's sad that trying to solve some problem for the other users ends up in so much frustration.
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Re: Wacky Keyboard Codes in keyconfig.plist...... AARRRRRGGG

Post by Micha »

phrashee wrote:
Annoyed and done with it. It's sad that trying to solve some problem for the other users ends up in so much frustration.
I'm sorry you feel that way. I did attempt to work out what you were wanting and I'm sorry if I misunderstood or if my replies were unclear.

Based on your first couple of messages I went with the assumption that you pretty much knew what you were talking about (especially since you mentioned a coding background) and just had trouble working out where the special keycodes come from (which, without knowing more about the code, is hardly surprising as they are bespoke).

Since your only question seemd to be about the keycodes I told you what they are, and why Google didn't help. Furthermore, since you had already started digging into the code I figured you knew enough about it and just needed pointing in the right direction.

The questions you asked where we pointed you at the Wiki -are- in the Wiki: all the possible key commands which can be mapped in Oolite are there, and instructions on how to make your own keyconfig.plist. It's pointless repeating that here. In fact I spent some time yesterday (during my lunch hour) adding the 2 or 3 additional commands added in the last version of Oolite.

The bit which -isn't- in the Wiki are the non-ASCII key codes, which based on your first posting, I presumed you had more or less worked out. And for this information nobody pointed you at the Wiki but rather at the code which you had already found and seen.
Again, apologies if I assumed that you knew more about coding and that that was sufficient.

Anyway, here are the codes (again):

Code: Select all

enum GameViewKeys
{
gvFunctionKey1 = 241,
gvFunctionKey2,  // 242
gvFunctionKey3, // 243
gvFunctionKey4, // 244....
gvFunctionKey5,
gvFunctionKey6,
gvFunctionKey7,
gvFunctionKey8,
gvFunctionKey9,
gvFunctionKey10,
gvFunctionKey11,
gvArrowKeyRight,
gvArrowKeyLeft,
gvArrowKeyDown,
gvArrowKeyUp,
gvMouseLeftButton = 301,
gvMouseDoubleClick, // 302
gvHomeKey, // 303...
gvEndKey,
gvInsertKey,
gvDeleteKey,
gvPageUpKey,
gvPageDownKey,
gvNumberKey0 = 48,
gvNumberKey1, // 49
gvNumberKey2, // 50...
gvNumberKey3,
gvNumberKey4,
gvNumberKey5,
gvNumberKey7,
gvNumberKey8,
gvNumberKey9 //57
};
and they do increase linearly from the last explicitly stated constant, as you correctly surmised.
I'll add them to the Wiki page when I get some time..

I'll (continue) to do my best to explain, but please remember that nobody here is a paid support engineer, many people on the forum don't have english as their first language (myself included), and we're all just doing this in our spare time (of which there isn't much) and for fun.


Cheers,
- Micha.
The glass is twice as big as it needs to be.
Post Reply