- mouse type option prepared (TODO: device code for wheel and serial mouse)
This commit is contained in:
parent
2da42331ff
commit
6cc4cd8c4b
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: bochs.h,v 1.146 2004-11-22 13:14:54 akrisak Exp $
|
||||
// $Id: bochs.h,v 1.147 2004-11-30 21:02:55 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -637,6 +637,7 @@ typedef struct BOCHSAPI {
|
||||
bx_param_bool_c *Orealtime_pit;
|
||||
bx_param_bool_c *Otext_snapshot_check;
|
||||
bx_param_bool_c *Omouse_enabled;
|
||||
bx_param_enum_c *Omouse_type;
|
||||
bx_param_bool_c *Oprivate_colormap;
|
||||
#if BX_WITH_AMIGAOS
|
||||
bx_param_bool_c *Ofullscreen;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: config.cc,v 1.18 2004-11-27 10:09:26 vruppert Exp $
|
||||
// $Id: config.cc,v 1.19 2004-11-30 21:02:56 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -880,7 +880,7 @@ void bx_init_options ()
|
||||
strdup(descr),
|
||||
(i==0)?1 : 0); // only enable the first by default
|
||||
sprintf (name, "I/O mode of the serial device for COM%d", i+1);
|
||||
sprintf (descr, "The mode can be one these: 'null', 'file', 'term', 'raw'");
|
||||
sprintf (descr, "The mode can be one these: 'null', 'file', 'term', 'raw', 'mouse'");
|
||||
bx_options.com[i].Omode = new bx_param_enum_c (
|
||||
BXP_COMx_MODE(i+1),
|
||||
strdup(name),
|
||||
@ -1137,6 +1137,21 @@ void bx_init_options ()
|
||||
0);
|
||||
bx_options.Omouse_enabled->set_handler (bx_param_handler);
|
||||
bx_options.Omouse_enabled->set_runtime_param (1);
|
||||
|
||||
static char *mouse_type_list[] = {
|
||||
"ps2",
|
||||
"imps2",
|
||||
"serial",
|
||||
NULL
|
||||
};
|
||||
bx_options.Omouse_type = new bx_param_enum_c (BXP_MOUSE_TYPE,
|
||||
"Mouse type",
|
||||
"The mouse type can be one of these: 'ps2', 'imps2'",
|
||||
mouse_type_list,
|
||||
0,
|
||||
0);
|
||||
bx_options.com[i].Omode->set_ask_format ("Choose the type of mouse [%s] ");
|
||||
|
||||
bx_options.Oips = new bx_param_num_c (BXP_IPS,
|
||||
"Emulated instructions per second (IPS)",
|
||||
"Emulated instructions per second, used to calibrate bochs emulated time with wall clock time.",
|
||||
@ -1241,6 +1256,7 @@ void bx_init_options ()
|
||||
bx_options.Odisplaylib_options,
|
||||
bx_options.Ovga_update_interval,
|
||||
bx_options.Omouse_enabled,
|
||||
bx_options.Omouse_type,
|
||||
bx_options.Oprivate_colormap,
|
||||
#if BX_WITH_AMIGAOS
|
||||
bx_options.Ofullscreen,
|
||||
@ -1665,6 +1681,7 @@ void bx_init_options ()
|
||||
bx_options.Ovga_update_interval,
|
||||
bx_options.log.Oprefix,
|
||||
bx_options.Omouse_enabled,
|
||||
bx_options.Omouse_type,
|
||||
bx_options.Ofloppy_command_delay,
|
||||
bx_options.Oprivate_colormap,
|
||||
#if BX_WITH_AMIGAOS
|
||||
@ -1761,6 +1778,7 @@ void bx_reset_options ()
|
||||
bx_options.Odisplaylib_options->reset();
|
||||
bx_options.Ovga_update_interval->reset();
|
||||
bx_options.Omouse_enabled->reset();
|
||||
bx_options.Omouse_type->reset();
|
||||
bx_options.Oips->reset();
|
||||
bx_options.Oprivate_colormap->reset();
|
||||
#if BX_WITH_AMIGAOS
|
||||
@ -2987,16 +3005,23 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
else bx_options.Otext_snapshot_check->set (!!(atol(params[1])));
|
||||
}
|
||||
else if (!strcmp(params[0], "mouse")) {
|
||||
if (num_params != 2) {
|
||||
if (num_params < 2) {
|
||||
PARSE_ERR(("%s: mouse directive malformed.", context));
|
||||
}
|
||||
if (strncmp(params[1], "enabled=", 8)) {
|
||||
PARSE_ERR(("%s: mouse directive malformed.", context));
|
||||
for (i=1; i<num_params; i++) {
|
||||
if (!strncmp(params[i], "enabled=", 8)) {
|
||||
if (params[i][8] == '0' || params[i][8] == '1')
|
||||
bx_options.Omouse_enabled->set (params[i][8] - '0');
|
||||
else
|
||||
PARSE_ERR(("%s: mouse directive malformed.", context));
|
||||
} else if (!strncmp(params[i], "type=", 5)) {
|
||||
if (!bx_options.Omouse_type->set_by_name (strdup(¶ms[i][5])))
|
||||
PARSE_ERR(("%s: mouse type '%s' not available", context, strdup(¶ms[i][5])));
|
||||
}
|
||||
else {
|
||||
PARSE_ERR(("%s: mouse directive malformed.", context));
|
||||
}
|
||||
}
|
||||
if (params[1][8] == '0' || params[1][8] == '1')
|
||||
bx_options.Omouse_enabled->set (params[1][8] - '0');
|
||||
else
|
||||
PARSE_ERR(("%s: mouse directive malformed.", context));
|
||||
}
|
||||
else if (!strcmp(params[0], "private_colormap")) {
|
||||
if (num_params != 2) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.127 2004-10-24 20:04:51 vruppert Exp $
|
||||
// $Id: siminterface.h,v 1.128 2004-11-30 21:02:56 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Before I can describe what this file is for, I have to make the
|
||||
@ -124,6 +124,7 @@ typedef enum {
|
||||
BXP_TEXT_SNAPSHOT_CHECK,
|
||||
BXP_VGA_UPDATE_INTERVAL,
|
||||
BXP_MOUSE_ENABLED,
|
||||
BXP_MOUSE_TYPE,
|
||||
BXP_MEM_SIZE,
|
||||
BXP_ROM_PATH,
|
||||
BXP_ROM_ADDRESS,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: keyboard.cc,v 1.90 2004-11-27 14:38:12 vruppert Exp $
|
||||
// $Id: keyboard.cc,v 1.91 2004-11-30 21:02:56 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -125,7 +125,7 @@ bx_keyb_c::resetinternals(bx_bool powerup)
|
||||
void
|
||||
bx_keyb_c::init(void)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.90 2004-11-27 14:38:12 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.91 2004-11-30 21:02:56 vruppert Exp $"));
|
||||
Bit32u i;
|
||||
|
||||
DEV_register_irq(1, "8042 Keyboard controller");
|
||||
@ -177,6 +177,7 @@ bx_keyb_c::init(void)
|
||||
BX_KEY_THIS s.kbd_controller.timer_pending = 0;
|
||||
|
||||
// Mouse initialization stuff
|
||||
BX_KEY_THIS s.mouse.type = bx_options.Omouse_type->get();
|
||||
BX_KEY_THIS s.mouse.sample_rate = 100; // reports per second
|
||||
BX_KEY_THIS s.mouse.resolution_cpmm = 4; // 4 counts per millimeter
|
||||
BX_KEY_THIS s.mouse.scaling = 1; /* 1:1 (default) */
|
||||
@ -899,7 +900,7 @@ bx_keyb_c::kbd_enQ(Bit8u scancode)
|
||||
}
|
||||
|
||||
bx_bool BX_CPP_AttrRegparmN(3)
|
||||
bx_keyb_c::mouse_enQ_packet(Bit8u b1, Bit8u b2, Bit8u b3)
|
||||
bx_keyb_c::mouse_enQ_packet(Bit8u b1, Bit8u b2, Bit8u b3)
|
||||
{
|
||||
if ((BX_KEY_THIS s.mouse_internal_buffer.num_elements + 3) >= BX_MOUSE_BUFF_SIZE) {
|
||||
return(0); /* buffer doesn't have the space */
|
||||
@ -1236,7 +1237,11 @@ bx_keyb_c::kbd_ctrl_to_mouse(Bit8u value)
|
||||
} else if ((value == 100) && (BX_KEY_THIS s.mouse.im_request == 1)) {
|
||||
BX_KEY_THIS s.mouse.im_request = 2;
|
||||
} else if ((value == 80) && (BX_KEY_THIS s.mouse.im_request == 2)) {
|
||||
BX_INFO(("wheel mouse mode requested (not implemented)"));
|
||||
if (BX_KEY_THIS s.mouse.type == MOUSE_TYPE_IMPS2) {
|
||||
BX_INFO(("wheel mouse mode request (not implemented)"));
|
||||
} else {
|
||||
BX_INFO(("wheel mouse mode request rejected"));
|
||||
}
|
||||
BX_KEY_THIS s.mouse.im_request = 0;
|
||||
} else {
|
||||
BX_KEY_THIS s.mouse.im_request = 0;
|
||||
@ -1343,7 +1348,7 @@ bx_keyb_c::kbd_ctrl_to_mouse(Bit8u value)
|
||||
|
||||
case 0xf2: // Read Device Type
|
||||
controller_enQ(0xFA, 1); // ACK
|
||||
controller_enQ(0x00, 1); // Device ID
|
||||
controller_enQ(0x00, 1); // Device ID (standard)
|
||||
BX_DEBUG(("[mouse] Read mouse ID"));
|
||||
break;
|
||||
|
||||
@ -1477,7 +1482,7 @@ bx_keyb_c::create_mouse_packet(bool force_enq) {
|
||||
|
||||
void
|
||||
bx_keyb_c::mouse_enabled_changed(bool enabled) {
|
||||
if(s.mouse.delayed_dx || BX_KEY_THIS s.mouse.delayed_dy) {
|
||||
if (s.mouse.delayed_dx || BX_KEY_THIS s.mouse.delayed_dy) {
|
||||
create_mouse_packet(1);
|
||||
}
|
||||
s.mouse.delayed_dx=0;
|
||||
@ -1496,6 +1501,11 @@ bx_keyb_c::mouse_motion(int delta_x, int delta_y, unsigned button_state)
|
||||
return;
|
||||
|
||||
|
||||
if (BX_KEY_THIS s.mouse.type == MOUSE_TYPE_SERIAL) {
|
||||
// TODO: forward mouse motion to the serial device
|
||||
return;
|
||||
}
|
||||
|
||||
// don't generate interrupts if we are in remote mode.
|
||||
if ( BX_KEY_THIS s.mouse.mode == MOUSE_MODE_REMOTE)
|
||||
// is there any point in doing any work if we don't act on the result
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: keyboard.h,v 1.24 2004-11-27 14:38:13 vruppert Exp $
|
||||
// $Id: keyboard.h,v 1.25 2004-11-30 21:03:16 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -46,6 +46,10 @@
|
||||
#define MOUSE_MODE_REMOTE 12
|
||||
#define MOUSE_MODE_WRAP 13
|
||||
|
||||
#define MOUSE_TYPE_PS2 0
|
||||
#define MOUSE_TYPE_IMPS2 1
|
||||
#define MOUSE_TYPE_SERIAL 2
|
||||
|
||||
class bx_keyb_c : public bx_keyb_stub_c {
|
||||
public:
|
||||
bx_keyb_c(void);
|
||||
@ -113,6 +117,7 @@ private:
|
||||
} kbd_controller;
|
||||
|
||||
struct mouseStruct {
|
||||
Bit8u type;
|
||||
Bit8u sample_rate;
|
||||
Bit8u resolution_cpmm; // resolution in counts per mm
|
||||
Bit8u scaling;
|
||||
@ -215,16 +220,16 @@ private:
|
||||
bx_bool stop_paste; // stop the current paste operation on hardware reset
|
||||
|
||||
BX_KEY_SMF void resetinternals(bx_bool powerup);
|
||||
BX_KEY_SMF void set_kbd_clock_enable(Bit8u value) BX_CPP_AttrRegparmN(1);
|
||||
BX_KEY_SMF void set_aux_clock_enable(Bit8u value);
|
||||
BX_KEY_SMF void kbd_ctrl_to_kbd(Bit8u value);
|
||||
BX_KEY_SMF void kbd_ctrl_to_mouse(Bit8u value);
|
||||
BX_KEY_SMF void kbd_enQ(Bit8u scancode);
|
||||
BX_KEY_SMF void kbd_enQ_imm(Bit8u val);
|
||||
BX_KEY_SMF void set_kbd_clock_enable(Bit8u value) BX_CPP_AttrRegparmN(1);
|
||||
BX_KEY_SMF void set_aux_clock_enable(Bit8u value);
|
||||
BX_KEY_SMF void kbd_ctrl_to_kbd(Bit8u value);
|
||||
BX_KEY_SMF void kbd_ctrl_to_mouse(Bit8u value);
|
||||
BX_KEY_SMF void kbd_enQ(Bit8u scancode);
|
||||
BX_KEY_SMF void kbd_enQ_imm(Bit8u val);
|
||||
BX_KEY_SMF void activate_timer(void);
|
||||
BX_KEY_SMF void controller_enQ(Bit8u data, unsigned source);
|
||||
BX_KEY_SMF bx_bool mouse_enQ_packet(Bit8u b1, Bit8u b2, Bit8u b3) BX_CPP_AttrRegparmN(3);
|
||||
BX_KEY_SMF void mouse_enQ(Bit8u mouse_data);
|
||||
BX_KEY_SMF void controller_enQ(Bit8u data, unsigned source);
|
||||
BX_KEY_SMF bx_bool mouse_enQ_packet(Bit8u b1, Bit8u b2, Bit8u b3) BX_CPP_AttrRegparmN(3);
|
||||
BX_KEY_SMF void mouse_enQ(Bit8u mouse_data);
|
||||
|
||||
static void timer_handler(void *);
|
||||
void timer(void);
|
||||
|
Loading…
Reference in New Issue
Block a user