1 |
2 |
alfik |
/////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// $Id: keymap.h 10209 2011-02-24 22:05:47Z sshwarts $
|
3 |
|
|
/////////////////////////////////////////////////////////////////////////
|
4 |
|
|
//
|
5 |
|
|
// Copyright (C) 2002-2009 The Bochs Project
|
6 |
|
|
//
|
7 |
|
|
// This library is free software; you can redistribute it and/or
|
8 |
|
|
// modify it under the terms of the GNU Lesser General Public
|
9 |
|
|
// License as published by the Free Software Foundation; either
|
10 |
|
|
// version 2 of the License, or (at your option) any later version.
|
11 |
|
|
//
|
12 |
|
|
// This library is distributed in the hope that it will be useful,
|
13 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 |
|
|
// Lesser General Public License for more details.
|
16 |
|
|
//
|
17 |
|
|
// You should have received a copy of the GNU Lesser General Public
|
18 |
|
|
// License along with this library; if not, write to the Free Software
|
19 |
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
20 |
|
|
//
|
21 |
|
|
/////////////////////////////////////////////////////////////////////////
|
22 |
|
|
|
23 |
|
|
/////////////////////////////////////////////////////////////////////////
|
24 |
|
|
//
|
25 |
|
|
// Methods of bx_keymap_c :
|
26 |
|
|
//
|
27 |
|
|
// - loadKeymap(Bit32u convertStringToSymbol(const char*));
|
28 |
|
|
// loads the configuration specified keymap file if keymapping is enabled
|
29 |
|
|
// using convertStringToSymbol to convert strings to client constants
|
30 |
|
|
//
|
31 |
|
|
// - loadKeymap(Bit32u convertStringToSymbol(const char*), const char* filename);
|
32 |
|
|
// loads the specified keymap file
|
33 |
|
|
// using convertStringToSymbol to convert strings to client constants
|
34 |
|
|
//
|
35 |
|
|
// - isKeymapLoaded () returns true if the keymap contains any valid key
|
36 |
|
|
// entries.
|
37 |
|
|
//
|
38 |
|
|
// - convertStringToBXKey
|
39 |
|
|
// convert a null-terminate string to a BX_KEY code
|
40 |
|
|
//
|
41 |
|
|
// - findHostKey(Bit32u key)
|
42 |
|
|
// - findAsciiChar(Bit8u ch)
|
43 |
|
|
// Each of these methods returns a pointer to a BXKeyEntry structure
|
44 |
|
|
// corresponding to a key. findHostKey() finds an entry whose hostKey
|
45 |
|
|
// value matches the target value, and findAsciiChar() finds an entry
|
46 |
|
|
// whose ASCII code matches the search value.
|
47 |
|
|
|
48 |
|
|
// In case of unknown symbol
|
49 |
|
|
#define BX_KEYMAP_UNKNOWN 0xFFFFFFFF
|
50 |
|
|
|
51 |
|
|
// Structure of an element of the keymap table
|
52 |
|
|
typedef struct BOCHSAPI {
|
53 |
|
|
Bit32u baseKey; // base key
|
54 |
|
|
Bit32u modKey; // modifier key that must be held down
|
55 |
|
|
Bit32s ascii; // ascii equivalent, if any
|
56 |
|
|
Bit32u hostKey; // value that the host's OS or library recognizes
|
57 |
|
|
} BXKeyEntry;
|
58 |
|
|
|
59 |
|
|
class BOCHSAPI bx_keymap_c : public logfunctions {
|
60 |
|
|
public:
|
61 |
|
|
bx_keymap_c(void);
|
62 |
|
|
~bx_keymap_c(void);
|
63 |
|
|
|
64 |
|
|
void loadKeymap(Bit32u(*)(const char*));
|
65 |
|
|
void loadKeymap(Bit32u(*)(const char*),const char *filename);
|
66 |
|
|
bx_bool isKeymapLoaded();
|
67 |
|
|
|
68 |
|
|
BXKeyEntry *findHostKey(Bit32u hostkeynum);
|
69 |
|
|
BXKeyEntry *findAsciiChar(Bit8u ascii);
|
70 |
|
|
const char *getBXKeyName(Bit32u key);
|
71 |
|
|
|
72 |
|
|
private:
|
73 |
|
|
Bit32u convertStringToBXKey(const char *);
|
74 |
|
|
|
75 |
|
|
BXKeyEntry *keymapTable;
|
76 |
|
|
Bit16u keymapCount;
|
77 |
|
|
};
|
78 |
|
|
|
79 |
|
|
BOCHSAPI extern bx_keymap_c bx_keymap;
|