2001-12-14 20:56:37 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
2001-12-14 20:56:37 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2009-12-04 23:02:12 +03:00
|
|
|
// Copyright (C) 2002-2009 The Bochs Project
|
2001-12-14 20:56:37 +03:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
2009-02-08 12:05:52 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2009-12-04 23:02:12 +03:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2001-12-14 20:56:37 +03:00
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Methods of bx_keymap_c :
|
|
|
|
//
|
2002-03-06 12:31:55 +03:00
|
|
|
// - loadKeymap(Bit32u convertStringToSymbol(const char*));
|
|
|
|
// loads the configuration specified keymap file if keymapping is enabled
|
|
|
|
// using convertStringToSymbol to convert strings to client constants
|
2001-12-14 20:56:37 +03:00
|
|
|
//
|
2002-03-06 12:31:55 +03:00
|
|
|
// - loadKeymap(Bit32u convertStringToSymbol(const char*), const char* filename);
|
2008-02-06 01:57:43 +03:00
|
|
|
// loads the specified keymap file
|
2002-03-06 12:31:55 +03:00
|
|
|
// using convertStringToSymbol to convert strings to client constants
|
2001-12-14 20:56:37 +03:00
|
|
|
//
|
2002-03-24 12:11:04 +03:00
|
|
|
// - isKeymapLoaded () returns true if the keymap contains any valid key
|
|
|
|
// entries.
|
|
|
|
//
|
2002-03-06 12:31:55 +03:00
|
|
|
// - convertStringToBXKey
|
2002-03-24 12:11:04 +03:00
|
|
|
// convert a null-terminate string to a BX_KEY code
|
2001-12-14 20:56:37 +03:00
|
|
|
//
|
2002-10-08 10:14:53 +04:00
|
|
|
// - findHostKey(Bit32u key)
|
|
|
|
// - findAsciiChar(Bit8u ch)
|
2002-03-24 12:11:04 +03:00
|
|
|
// Each of these methods returns a pointer to a BXKeyEntry structure
|
2002-10-08 10:14:53 +04:00
|
|
|
// corresponding to a key. findHostKey() finds an entry whose hostKey
|
|
|
|
// value matches the target value, and findAsciiChar() finds an entry
|
|
|
|
// whose ASCII code matches the search value.
|
2001-12-14 20:56:37 +03:00
|
|
|
|
2002-03-06 12:31:55 +03:00
|
|
|
// In case of unknown symbol
|
|
|
|
#define BX_KEYMAP_UNKNOWN 0xFFFFFFFF
|
|
|
|
|
|
|
|
// Structure of an element of the keymap table
|
2008-02-06 01:57:43 +03:00
|
|
|
typedef struct BOCHSAPI {
|
2002-03-11 18:04:58 +03:00
|
|
|
Bit32u baseKey; // base key
|
|
|
|
Bit32u modKey; // modifier key that must be held down
|
|
|
|
Bit32s ascii; // ascii equivalent, if any
|
2002-10-08 10:14:53 +04:00
|
|
|
Bit32u hostKey; // value that the host's OS or library recognizes
|
2009-12-04 23:02:12 +03:00
|
|
|
} BXKeyEntry;
|
2001-12-14 20:56:37 +03:00
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
class BOCHSAPI bx_keymap_c : public logfunctions {
|
2001-12-14 20:56:37 +03:00
|
|
|
public:
|
|
|
|
bx_keymap_c(void);
|
2009-12-04 23:02:12 +03:00
|
|
|
~bx_keymap_c(void);
|
2001-12-14 20:56:37 +03:00
|
|
|
|
2002-03-06 12:31:55 +03:00
|
|
|
void loadKeymap(Bit32u(*)(const char*));
|
|
|
|
void loadKeymap(Bit32u(*)(const char*),const char *filename);
|
2009-12-04 23:02:12 +03:00
|
|
|
bx_bool isKeymapLoaded();
|
2002-03-06 12:31:55 +03:00
|
|
|
|
2002-10-08 10:14:53 +04:00
|
|
|
BXKeyEntry *findHostKey(Bit32u hostkeynum);
|
|
|
|
BXKeyEntry *findAsciiChar(Bit8u ascii);
|
2007-10-25 03:09:59 +04:00
|
|
|
const char *getBXKeyName(Bit32u key);
|
2001-12-14 20:56:37 +03:00
|
|
|
|
|
|
|
private:
|
2002-03-06 12:31:55 +03:00
|
|
|
Bit32u convertStringToBXKey(const char *);
|
2008-02-06 01:57:43 +03:00
|
|
|
|
2002-03-11 18:04:58 +03:00
|
|
|
BXKeyEntry *keymapTable;
|
2002-03-06 12:31:55 +03:00
|
|
|
Bit16u keymapCount;
|
2009-12-04 23:02:12 +03:00
|
|
|
};
|
2001-12-14 20:56:37 +03:00
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
BOCHSAPI extern bx_keymap_c bx_keymap;
|