Indent changes
This commit is contained in:
parent
0396a9d86f
commit
df70fa0a2f
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gui.cc,v 1.93 2006-03-04 12:43:47 vruppert Exp $
|
||||
// $Id: gui.cc,v 1.94 2006-04-10 19:02:30 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -110,8 +110,7 @@ bx_gui_c::~bx_gui_c()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheight)
|
||||
void bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheight)
|
||||
{
|
||||
BX_GUI_THIS new_gfx_api = 0;
|
||||
BX_GUI_THIS host_xres = 640;
|
||||
@ -232,8 +231,8 @@ bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheight)
|
||||
show_headerbar();
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::update_drive_status_buttons (void) {
|
||||
void bx_gui_c::update_drive_status_buttons (void)
|
||||
{
|
||||
BX_GUI_THIS floppyA_status =
|
||||
DEV_floppy_get_media_status(0)
|
||||
&& (SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->get() == BX_INSERTED);
|
||||
@ -252,7 +251,7 @@ bx_gui_c::update_drive_status_buttons (void) {
|
||||
DiskEject(1);
|
||||
#endif
|
||||
replace_bitmap(BX_GUI_THIS floppyA_hbar_id, BX_GUI_THIS floppyA_eject_bmap_id);
|
||||
}
|
||||
}
|
||||
if (BX_GUI_THIS floppyB_status)
|
||||
replace_bitmap(BX_GUI_THIS floppyB_hbar_id, BX_GUI_THIS floppyB_bmap_id);
|
||||
else {
|
||||
@ -263,16 +262,15 @@ bx_gui_c::update_drive_status_buttons (void) {
|
||||
DiskEject(1);
|
||||
#endif
|
||||
replace_bitmap(BX_GUI_THIS floppyB_hbar_id, BX_GUI_THIS floppyB_eject_bmap_id);
|
||||
}
|
||||
}
|
||||
if (BX_GUI_THIS cdromD_status)
|
||||
replace_bitmap(BX_GUI_THIS cdromD_hbar_id, BX_GUI_THIS cdromD_bmap_id);
|
||||
else {
|
||||
replace_bitmap(BX_GUI_THIS cdromD_hbar_id, BX_GUI_THIS cdromD_eject_bmap_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::floppyA_handler(void)
|
||||
void bx_gui_c::floppyA_handler(void)
|
||||
{
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get() == BX_FLOPPY_NONE)
|
||||
return; // no primary floppy device present
|
||||
@ -290,8 +288,7 @@ bx_gui_c::floppyA_handler(void)
|
||||
BX_GUI_THIS update_drive_status_buttons();
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::floppyB_handler(void)
|
||||
void bx_gui_c::floppyB_handler(void)
|
||||
{
|
||||
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() == BX_FLOPPY_NONE)
|
||||
return; // no secondary floppy device present
|
||||
@ -309,8 +306,7 @@ bx_gui_c::floppyB_handler(void)
|
||||
BX_GUI_THIS update_drive_status_buttons();
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::cdromD_handler(void)
|
||||
void bx_gui_c::cdromD_handler(void)
|
||||
{
|
||||
Bit32u handle = DEV_hd_get_first_cd_handle();
|
||||
if (BX_GUI_THIS dialog_caps & BX_GUI_DLG_CDROM) {
|
||||
@ -332,15 +328,13 @@ bx_gui_c::cdromD_handler(void)
|
||||
BX_GUI_THIS update_drive_status_buttons();
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::reset_handler(void)
|
||||
void bx_gui_c::reset_handler(void)
|
||||
{
|
||||
BX_INFO(( "system RESET callback." ));
|
||||
bx_pc_system.Reset( BX_RESET_HARDWARE );
|
||||
BX_INFO(("system RESET callback"));
|
||||
bx_pc_system.Reset(BX_RESET_HARDWARE);
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::power_handler(void)
|
||||
void bx_gui_c::power_handler(void)
|
||||
{
|
||||
// the user pressed power button, so there's no doubt they want bochs
|
||||
// to quit. Change panics to fatal for the GUI and then do a panic.
|
||||
@ -352,8 +346,7 @@ bx_gui_c::power_handler(void)
|
||||
BX_EXIT (1);
|
||||
}
|
||||
|
||||
Bit32s
|
||||
bx_gui_c::make_text_snapshot (char **snapshot, Bit32u *length)
|
||||
Bit32s bx_gui_c::make_text_snapshot(char **snapshot, Bit32u *length)
|
||||
{
|
||||
Bit8u* raw_snap = NULL;
|
||||
char *clean_snap;
|
||||
@ -384,8 +377,7 @@ bx_gui_c::make_text_snapshot (char **snapshot, Bit32u *length)
|
||||
|
||||
// create a text snapshot and copy to the system clipboard. On guis that
|
||||
// we haven't figured out how to support yet, dump to a file instead.
|
||||
void
|
||||
bx_gui_c::copy_handler(void)
|
||||
void bx_gui_c::copy_handler(void)
|
||||
{
|
||||
Bit32u len;
|
||||
char *text_snapshot;
|
||||
@ -403,8 +395,7 @@ bx_gui_c::copy_handler(void)
|
||||
}
|
||||
|
||||
// Check the current text snapshot against file snapchk.txt.
|
||||
void
|
||||
bx_gui_c::snapshot_checker(void * this_ptr)
|
||||
void bx_gui_c::snapshot_checker(void *this_ptr)
|
||||
{
|
||||
char filename[BX_PATHNAME_LEN];
|
||||
strcpy(filename,"snapchk.txt");
|
||||
@ -451,8 +442,7 @@ bx_gui_c::snapshot_checker(void * this_ptr)
|
||||
}
|
||||
|
||||
// create a text snapshot and dump it to a file
|
||||
void
|
||||
bx_gui_c::snapshot_handler(void)
|
||||
void bx_gui_c::snapshot_handler(void)
|
||||
{
|
||||
char *text_snapshot;
|
||||
Bit32u len;
|
||||
@ -481,8 +471,7 @@ bx_gui_c::snapshot_handler(void)
|
||||
|
||||
// Read ASCII chars from the system clipboard and paste them into bochs.
|
||||
// Note that paste cannot work with the key mapping tables loaded.
|
||||
void
|
||||
bx_gui_c::paste_handler(void)
|
||||
void bx_gui_c::paste_handler(void)
|
||||
{
|
||||
Bit32s nbytes;
|
||||
Bit8u *bytes;
|
||||
@ -498,17 +487,14 @@ bx_gui_c::paste_handler(void)
|
||||
DEV_kbd_paste_bytes (bytes, nbytes);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bx_gui_c::config_handler(void)
|
||||
void bx_gui_c::config_handler(void)
|
||||
{
|
||||
if (BX_GUI_THIS dialog_caps & BX_GUI_DLG_RUNTIME) {
|
||||
SIM->configuration_interface (NULL, CI_RUNTIME_CONFIG);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::toggle_mouse_enable(void)
|
||||
void bx_gui_c::toggle_mouse_enable(void)
|
||||
{
|
||||
int old = SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get();
|
||||
BX_DEBUG (("toggle mouse_enabled, now %d", !old));
|
||||
@ -527,8 +513,7 @@ Bit32u get_user_key(char *key)
|
||||
return BX_KEY_UNKNOWN;
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::userbutton_handler(void)
|
||||
void bx_gui_c::userbutton_handler(void)
|
||||
{
|
||||
Bit32u shortcut[4];
|
||||
Bit32u symbol;
|
||||
@ -599,8 +584,7 @@ bx_gui_c::userbutton_handler(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::mouse_enabled_changed (bx_bool val)
|
||||
void bx_gui_c::mouse_enabled_changed (bx_bool val)
|
||||
{
|
||||
// This is only called when SIM->get_init_done is 1. Note that VAL
|
||||
// is the new value of mouse_enabled, which may not match the old
|
||||
@ -616,8 +600,7 @@ bx_gui_c::mouse_enabled_changed (bx_bool val)
|
||||
BX_GUI_THIS mouse_enabled_changed_specific (val);
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::init_signal_handlers ()
|
||||
void bx_gui_c::init_signal_handlers()
|
||||
{
|
||||
#if BX_GUI_SIGHANDLER
|
||||
if (bx_gui_sighandler)
|
||||
@ -632,37 +615,31 @@ bx_gui_c::init_signal_handlers ()
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_text_charmap(Bit8u *fbuffer)
|
||||
void bx_gui_c::set_text_charmap(Bit8u *fbuffer)
|
||||
{
|
||||
memcpy(& BX_GUI_THIS vga_charmap, fbuffer, 0x2000);
|
||||
for (unsigned i=0; i<256; i++) BX_GUI_THIS char_changed[i] = 1;
|
||||
BX_GUI_THIS charmap_updated = 1;
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_text_charbyte(Bit16u address, Bit8u data)
|
||||
void bx_gui_c::set_text_charbyte(Bit16u address, Bit8u data)
|
||||
{
|
||||
BX_GUI_THIS vga_charmap[address] = data;
|
||||
BX_GUI_THIS char_changed[address >> 5] = 1;
|
||||
BX_GUI_THIS charmap_updated = 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bx_gui_c::beep_on(float frequency)
|
||||
void bx_gui_c::beep_on(float frequency)
|
||||
{
|
||||
BX_INFO(( "GUI Beep ON (frequency=%.2f)",frequency));
|
||||
BX_INFO(("GUI Beep ON (frequency=%.2f)", frequency));
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::beep_off()
|
||||
void bx_gui_c::beep_off()
|
||||
{
|
||||
BX_INFO(( "GUI Beep OFF"));
|
||||
BX_INFO(("GUI Beep OFF"));
|
||||
}
|
||||
|
||||
int
|
||||
bx_gui_c::register_statusitem(const char *text)
|
||||
int bx_gui_c::register_statusitem(const char *text)
|
||||
{
|
||||
if (statusitem_count < BX_MAX_STATUSITEMS) {
|
||||
strncpy(statusitem_text[statusitem_count], text, 8);
|
||||
@ -673,16 +650,14 @@ bx_gui_c::register_statusitem(const char *text)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
|
||||
void bx_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
|
||||
{
|
||||
*xres = 1024;
|
||||
*yres = 768;
|
||||
*bpp = 32;
|
||||
}
|
||||
|
||||
bx_svga_tileinfo_t *
|
||||
bx_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info)
|
||||
bx_svga_tileinfo_t *bx_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info)
|
||||
{
|
||||
if (!info) {
|
||||
info = (bx_svga_tileinfo_t *)malloc(sizeof(bx_svga_tileinfo_t));
|
||||
@ -732,8 +707,7 @@ bx_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info)
|
||||
return info;
|
||||
}
|
||||
|
||||
Bit8u *
|
||||
bx_gui_c::graphics_tile_get(unsigned x0, unsigned y0,
|
||||
Bit8u *bx_gui_c::graphics_tile_get(unsigned x0, unsigned y0,
|
||||
unsigned *w, unsigned *h)
|
||||
{
|
||||
if (x0+X_TILESIZE > BX_GUI_THIS host_xres) {
|
||||
@ -754,8 +728,7 @@ bx_gui_c::graphics_tile_get(unsigned x0, unsigned y0,
|
||||
x0 * ((BX_GUI_THIS host_bpp + 1) >> 3);
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::graphics_tile_update_in_place(unsigned x0, unsigned y0,
|
||||
void bx_gui_c::graphics_tile_update_in_place(unsigned x0, unsigned y0,
|
||||
unsigned w, unsigned h)
|
||||
{
|
||||
Bit8u tile[X_TILESIZE * Y_TILESIZE * 4];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: keymap.cc,v 1.18 2006-02-22 19:18:28 vruppert Exp $
|
||||
// $Id: keymap.cc,v 1.19 2006-04-10 19:02:30 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -70,7 +70,7 @@ char *bx_key_symbol[BX_KEY_NBKEYS] = {
|
||||
"BX_KEY_INT_SEARCH", "BX_KEY_INT_FAV", "BX_KEY_INT_HOME",
|
||||
"BX_KEY_POWER_MYCOMP", "BX_KEY_POWER_CALC", "BX_KEY_POWER_SLEEP",
|
||||
"BX_KEY_POWER_POWER", "BX_KEY_POWER_WAKE",
|
||||
};
|
||||
};
|
||||
|
||||
bx_keymap_c bx_keymap;
|
||||
|
||||
@ -82,7 +82,6 @@ bx_keymap_c::bx_keymap_c(void)
|
||||
|
||||
keymapCount = 0;
|
||||
keymapTable = (BXKeyEntry *)NULL;
|
||||
|
||||
}
|
||||
|
||||
bx_keymap_c::~bx_keymap_c(void)
|
||||
@ -90,21 +89,18 @@ bx_keymap_c::~bx_keymap_c(void)
|
||||
if(keymapTable != NULL) {
|
||||
free(keymapTable);
|
||||
keymapTable = (BXKeyEntry *)NULL;
|
||||
}
|
||||
}
|
||||
keymapCount = 0;
|
||||
}
|
||||
|
||||
void
|
||||
bx_keymap_c::loadKeymap(Bit32u stringToSymbol(const char*))
|
||||
void bx_keymap_c::loadKeymap(Bit32u stringToSymbol(const char*))
|
||||
{
|
||||
if (SIM->get_param_bool(BXPN_KBD_USEMAPPING)->get()) {
|
||||
loadKeymap(stringToSymbol, SIM->get_param_string(BXPN_KBD_KEYMAP)->getptr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bx_bool
|
||||
bx_keymap_c::isKeymapLoaded ()
|
||||
bx_bool bx_keymap_c::isKeymapLoaded ()
|
||||
{
|
||||
return (keymapCount > 0);
|
||||
}
|
||||
@ -115,14 +111,12 @@ bx_keymap_c::isKeymapLoaded ()
|
||||
static unsigned char *lineptr = NULL;
|
||||
static int lineCount;
|
||||
|
||||
static void
|
||||
init_parse ()
|
||||
static void init_parse()
|
||||
{
|
||||
lineCount = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
init_parse_line (char *line_to_parse)
|
||||
static void init_parse_line(char *line_to_parse)
|
||||
{
|
||||
// chop off newline
|
||||
lineptr = (unsigned char *)line_to_parse;
|
||||
@ -132,19 +126,18 @@ init_parse_line (char *line_to_parse)
|
||||
}
|
||||
}
|
||||
|
||||
static Bit32s
|
||||
get_next_word (char *output)
|
||||
static Bit32s get_next_word(char *output)
|
||||
{
|
||||
char *copyp = output;
|
||||
// find first nonspace
|
||||
while (*lineptr && isspace (*lineptr))
|
||||
while (*lineptr && isspace(*lineptr))
|
||||
lineptr++;
|
||||
if (!*lineptr)
|
||||
return -1; // nothing but spaces until end of line
|
||||
if (*lineptr == '#')
|
||||
return -1; // nothing but a comment
|
||||
// copy nonspaces into the output
|
||||
while (*lineptr && !isspace (*lineptr))
|
||||
while (*lineptr && !isspace(*lineptr))
|
||||
*copyp++ = *lineptr++;
|
||||
*copyp=0; // null terminate the copy
|
||||
// there must be at least one nonspace, since that's why we stopped the
|
||||
@ -153,8 +146,7 @@ get_next_word (char *output)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Bit32s
|
||||
get_next_keymap_line (FILE *fp, char *bxsym, char *modsym, Bit32s *ascii, char *hostsym)
|
||||
static Bit32s get_next_keymap_line (FILE *fp, char *bxsym, char *modsym, Bit32s *ascii, char *hostsym)
|
||||
{
|
||||
char line[256];
|
||||
char buf[256];
|
||||
@ -202,129 +194,118 @@ get_next_keymap_line (FILE *fp, char *bxsym, char *modsym, Bit32s *ascii, char *
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_keymap_c::loadKeymap(Bit32u stringToSymbol(const char*), const char* filename)
|
||||
void bx_keymap_c::loadKeymap(Bit32u stringToSymbol(const char*), const char* filename)
|
||||
{
|
||||
FILE *keymapFile;
|
||||
char baseSym[256], modSym[256], hostSym[256];
|
||||
Bit32s ascii;
|
||||
Bit32u baseKey, modKey, hostKey;
|
||||
struct stat status;
|
||||
FILE *keymapFile;
|
||||
char baseSym[256], modSym[256], hostSym[256];
|
||||
Bit32s ascii;
|
||||
Bit32u baseKey, modKey, hostKey;
|
||||
struct stat status;
|
||||
|
||||
if (stat(filename, &status)) {
|
||||
BX_PANIC(("Can not stat keymap file '%s'.",filename));
|
||||
}
|
||||
if (stat(filename, &status)) {
|
||||
BX_PANIC(("Can not stat keymap file '%s'.",filename));
|
||||
}
|
||||
|
||||
if (!(S_ISREG(status.st_mode))) {
|
||||
BX_PANIC(("Keymap file '%s' is not a file",filename));
|
||||
}
|
||||
if (!(S_ISREG(status.st_mode))) {
|
||||
BX_PANIC(("Keymap file '%s' is not a file",filename));
|
||||
}
|
||||
|
||||
if((keymapFile = fopen(filename,"r"))==NULL) {
|
||||
BX_PANIC(("Can not open keymap file '%s'.",filename));
|
||||
}
|
||||
if((keymapFile = fopen(filename,"r"))==NULL) {
|
||||
BX_PANIC(("Can not open keymap file '%s'.",filename));
|
||||
}
|
||||
|
||||
BX_INFO(("Loading keymap from '%s'",filename));
|
||||
init_parse ();
|
||||
BX_INFO(("Loading keymap from '%s'",filename));
|
||||
init_parse();
|
||||
|
||||
// Read keymap file one line at a time
|
||||
while(1) {
|
||||
if (get_next_keymap_line (keymapFile,
|
||||
baseSym, modSym, &ascii, hostSym) < 0) { break; }
|
||||
// Read keymap file one line at a time
|
||||
while(1) {
|
||||
if (get_next_keymap_line (keymapFile,
|
||||
baseSym, modSym, &ascii, hostSym) < 0) { break; }
|
||||
|
||||
// convert X_KEY_* symbols to values
|
||||
baseKey = convertStringToBXKey(baseSym);
|
||||
modKey = convertStringToBXKey(modSym);
|
||||
hostKey = 0;
|
||||
if (stringToSymbol != NULL)
|
||||
hostKey = stringToSymbol(hostSym);
|
||||
|
||||
// convert X_KEY_* symbols to values
|
||||
baseKey = convertStringToBXKey(baseSym);
|
||||
modKey = convertStringToBXKey(modSym);
|
||||
hostKey = 0;
|
||||
if (stringToSymbol != NULL)
|
||||
hostKey = stringToSymbol(hostSym);
|
||||
|
||||
BX_DEBUG (("baseKey='%s' (%d), modSym='%s' (%d), ascii=%d, guisym='%s' (%d)", baseSym, baseKey, modSym, modKey, ascii, hostSym, hostKey));
|
||||
BX_DEBUG(("baseKey='%s' (%d), modSym='%s' (%d), ascii=%d, guisym='%s' (%d)", baseSym, baseKey, modSym, modKey, ascii, hostSym, hostKey));
|
||||
|
||||
// Check if data is valid
|
||||
if( baseKey==BX_KEYMAP_UNKNOWN ) {
|
||||
BX_PANIC (("line %d: unknown BX_KEY constant '%s'",lineCount,baseSym));
|
||||
continue;
|
||||
}
|
||||
// Check if data is valid
|
||||
if (baseKey==BX_KEYMAP_UNKNOWN) {
|
||||
BX_PANIC (("line %d: unknown BX_KEY constant '%s'",lineCount,baseSym));
|
||||
continue;
|
||||
}
|
||||
|
||||
if( hostKey==BX_KEYMAP_UNKNOWN ) {
|
||||
BX_PANIC (("line %d: unknown host key name '%s' (wrong keymap ?)",lineCount,hostSym));
|
||||
continue;
|
||||
}
|
||||
if (hostKey==BX_KEYMAP_UNKNOWN) {
|
||||
BX_PANIC (("line %d: unknown host key name '%s' (wrong keymap ?)",lineCount,hostSym));
|
||||
continue;
|
||||
}
|
||||
|
||||
keymapTable=(BXKeyEntry*)realloc(keymapTable,(keymapCount+1) * sizeof(BXKeyEntry));
|
||||
keymapTable=(BXKeyEntry*)realloc(keymapTable,(keymapCount+1) * sizeof(BXKeyEntry));
|
||||
|
||||
if(keymapTable==NULL)
|
||||
BX_PANIC(("Can not allocate memory for keymap table."));
|
||||
if (keymapTable==NULL)
|
||||
BX_PANIC(("Can not allocate memory for keymap table."));
|
||||
|
||||
keymapTable[keymapCount].baseKey=baseKey;
|
||||
keymapTable[keymapCount].modKey=modKey;
|
||||
keymapTable[keymapCount].ascii=ascii;
|
||||
keymapTable[keymapCount].hostKey=hostKey;
|
||||
|
||||
keymapCount++;
|
||||
}
|
||||
keymapTable[keymapCount].baseKey=baseKey;
|
||||
keymapTable[keymapCount].modKey=modKey;
|
||||
keymapTable[keymapCount].ascii=ascii;
|
||||
keymapTable[keymapCount].hostKey=hostKey;
|
||||
|
||||
keymapCount++;
|
||||
}
|
||||
|
||||
BX_INFO(("Loaded %d symbols",keymapCount));
|
||||
BX_INFO(("Loaded %d symbols",keymapCount));
|
||||
|
||||
fclose(keymapFile);
|
||||
fclose(keymapFile);
|
||||
}
|
||||
|
||||
Bit32u
|
||||
bx_keymap_c::convertStringToBXKey(const char* string)
|
||||
Bit32u bx_keymap_c::convertStringToBXKey(const char* string)
|
||||
{
|
||||
Bit16u i;
|
||||
|
||||
// We look through the bx_key_symbol table to find the searched string
|
||||
for (i=0; i<BX_KEY_NBKEYS; i++) {
|
||||
if (strcmp(string,bx_key_symbol[i])==0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
// We look through the bx_key_symbol table to find the searched string
|
||||
for (Bit16u i=0; i<BX_KEY_NBKEYS; i++) {
|
||||
if (strcmp(string,bx_key_symbol[i])==0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// Key is not known
|
||||
return BX_KEYMAP_UNKNOWN;
|
||||
// Key is not known
|
||||
return BX_KEYMAP_UNKNOWN;
|
||||
}
|
||||
|
||||
BXKeyEntry *
|
||||
bx_keymap_c::findHostKey(Bit32u key)
|
||||
BXKeyEntry *bx_keymap_c::findHostKey(Bit32u key)
|
||||
{
|
||||
Bit16u i;
|
||||
// We look through the keymap table to find the searched key
|
||||
for (Bit16u i=0; i<keymapCount; i++) {
|
||||
if (keymapTable[i].hostKey == key) {
|
||||
BX_DEBUG (("key 0x%02x matches hostKey for entry #%d", key, i));
|
||||
return &keymapTable[i];
|
||||
}
|
||||
}
|
||||
BX_DEBUG(("key %02x matches no entries", key));
|
||||
|
||||
// We look through the keymap table to find the searched key
|
||||
for (i=0; i<keymapCount; i++) {
|
||||
if (keymapTable[i].hostKey == key) {
|
||||
BX_DEBUG (("key 0x%02x matches hostKey for entry #%d", key, i));
|
||||
return &keymapTable[i];
|
||||
}
|
||||
}
|
||||
BX_DEBUG (("key %02x matches no entries", key));
|
||||
|
||||
// Return default
|
||||
return NULL;
|
||||
// Return default
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BXKeyEntry *
|
||||
bx_keymap_c::findAsciiChar(Bit8u ch)
|
||||
BXKeyEntry *bx_keymap_c::findAsciiChar(Bit8u ch)
|
||||
{
|
||||
Bit16u i;
|
||||
BX_DEBUG (("findAsciiChar (0x%02x)", ch));
|
||||
BX_DEBUG (("findAsciiChar (0x%02x)", ch));
|
||||
|
||||
// We look through the keymap table to find the searched key
|
||||
for (i=0; i<keymapCount; i++) {
|
||||
if (keymapTable[i].ascii == ch) {
|
||||
BX_DEBUG (("key %02x matches ascii for entry #%d", ch, i));
|
||||
return &keymapTable[i];
|
||||
}
|
||||
}
|
||||
BX_DEBUG (("key 0x%02x matches no entries", ch));
|
||||
// We look through the keymap table to find the searched key
|
||||
for (Bit16u i=0; i<keymapCount; i++) {
|
||||
if (keymapTable[i].ascii == ch) {
|
||||
BX_DEBUG (("key %02x matches ascii for entry #%d", ch, i));
|
||||
return &keymapTable[i];
|
||||
}
|
||||
}
|
||||
BX_DEBUG (("key 0x%02x matches no entries", ch));
|
||||
|
||||
// Return default
|
||||
return NULL;
|
||||
// Return default
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
bx_keymap_c::getBXKeyName(Bit32u key)
|
||||
char *bx_keymap_c::getBXKeyName(Bit32u key)
|
||||
{
|
||||
return bx_key_symbol[key & 0x7fffffff];
|
||||
return bx_key_symbol[key & 0x7fffffff];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user