General Question Keymapping Help

Trekky0623

New member
Joined
Jan 6, 2009
Messages
3
Reaction score
0
Points
0
Is there a way to Keymap keys not listed in the keymap.cfg document? For example, I don't have a numpad, so I have set the thrusters to using the keys I, O, P, K, L, and ;. However, one lander uses the K key to extend the ladder. Is there a way to remap this so I don't extend the ladder everytime I try to use the thrusters?
 

Trekky0623

New member
Joined
Jan 6, 2009
Messages
3
Reaction score
0
Points
0
Yes, I've tried that. It still doesn't solve the problem of editing the keymapping of specific ships, such as pressing K to lower the ladder or pressing E to spacewalk, etc. They aren't in the keymap.cfg file.
 

Hielor

Defender of Truth
Donator
Beta Tester
Joined
May 30, 2008
Messages
5,580
Reaction score
2
Points
0
Yes, I've tried that. It still doesn't solve the problem of editing the keymapping of specific ships, such as pressing K to lower the ladder or pressing E to spacewalk, etc. They aren't in the keymap.cfg file.

They cannot be changed internally to Orbiter. The DLL accepts the key input directly, and you'd have to modify the DLL to change what keys it accepts.
 

James.Denholm

Addon ponderer
Joined
Feb 8, 2008
Messages
811
Reaction score
0
Points
0
Location
Victoria, Australia
Which, by the way, is impossible (editing a dll, that is), unless you can get the source code of the dll, or reverse-engineer the dll.
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,320
Reaction score
25
Points
113
Location
Sydney, Australia
They cannot be changed internally to Orbiter. The DLL accepts the key input directly, and you'd have to modify the DLL to change what keys it accepts.
Which, by the way, is impossible (editing a dll, that is), unless you can get the source code of the dll, or reverse-engineer the dll.
Another alternative would be to write a plugin that hooks that vessel's clbkConsumeBufferedKey function when it is the focus vessel and then calls the original function with a modified key argument. This way, when a key is pressed (eg, [q]), a [k] would be sent to the vessel code instead. So, it is possible but more trouble than it would be worth, IMHO.

How about a USB numeric keypad?
 

Hielor

Defender of Truth
Donator
Beta Tester
Joined
May 30, 2008
Messages
5,580
Reaction score
2
Points
0
Another alternative would be to write a plugin that hooks that vessel's clbkConsumeBufferedKey function when it is the focus vessel and then calls the original function with a modified key argument. This way, when a key is pressed (eg, [q]), a [k] would be sent to the vessel code instead. So, it is possible but more trouble than it would be worth, IMHO.

How would you hook the vessel's clbkConsumeBufferedKey method? It's a class function, so the normal method of registering a different method in its place wouldn't work, I don't think.
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,320
Reaction score
25
Points
113
Location
Sydney, Australia
How would you hook the vessel's clbkConsumeBufferedKey method? It's a class function, so the normal method of registering a different method in its place wouldn't work, I don't think.
Correct. This is not function overloading. agentgonzo used the technique for VESSEL2::clbkDrawHUD for LaunchMFD's HUD interface. What you are doing is replacing the pointer in the VESSEL2 class instance's virtual method table for the VESSEL2::clbkxxx function with a pointer to your own function with the same signature. So, when the Orbiter core calls that function, it actually calls your replacement function. Your replacement function can do anything like, including calling the original function.

There are issues though if more than one addon tries to hijack the VMT because you don't know whether the function pointers in the VMT are original or hooked. When you remove your hooks and put the buffered function pointers back, the VMT can end up pointing to functions that don't exist since there are no guarantees about the order in which Orbiter calls addons. There was some discussion about it here:
http://www.orbiter-forum.com/showthread.php?t=4768#13

That discussion resulted in the VMT Hijackers League, a plugin for registering hooking addons and implementing their associated hooks. All addons hooking using VMT Hijackers League should work nicely together. Those that don't use it will cause problems. See the thread here for a detailed description of how it works (including source code):
http://orbiter-forum.com/showthread.php?t=4947
 
Top