2016-06-26 00:34:39 +02:00
|
|
|
#include "ibm.h"
|
2017-06-16 16:00:44 -04:00
|
|
|
#include "cpu/cpu.h"
|
|
|
|
|
#include "device.h"
|
2016-06-26 00:34:39 +02:00
|
|
|
#include "mouse.h"
|
2016-12-23 03:16:24 +01:00
|
|
|
#include "mouse_serial.h"
|
2017-05-05 01:49:42 +02:00
|
|
|
#include "mouse_ps2.h"
|
|
|
|
|
#include "mouse_bus.h"
|
2017-06-16 16:00:44 -04:00
|
|
|
#include "model.h"
|
|
|
|
|
//#include "keyboard_olim24.h"
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-05-05 01:49:42 +02:00
|
|
|
|
|
|
|
|
static mouse_t *mouse_list[] = {
|
|
|
|
|
&mouse_serial_microsoft, /* 0 Microsoft Serial Mouse */
|
2017-05-06 17:48:33 +02:00
|
|
|
&mouse_ps2_2_button, /* 1 PS/2 Mouse 2-button */
|
|
|
|
|
&mouse_intellimouse, /* 2 PS/2 Intellimouse 3-button */
|
2017-05-05 01:49:42 +02:00
|
|
|
&mouse_bus, /* 3 Logitech Bus Mouse 2-button */
|
2017-05-06 17:48:33 +02:00
|
|
|
&mouse_amstrad, /* 4 Amstrad PC System Mouse */
|
|
|
|
|
&mouse_olim24, /* 5 Olivetti M24 System Mouse */
|
|
|
|
|
&mouse_msystems, /* 6 Mouse Systems */
|
2017-05-29 01:18:32 +02:00
|
|
|
#if 0
|
2017-05-06 17:48:33 +02:00
|
|
|
&mouse_genius, /* 7 Genius Bus Mouse */
|
2017-05-05 01:49:42 +02:00
|
|
|
#endif
|
|
|
|
|
NULL
|
2016-12-23 03:16:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static mouse_t *cur_mouse;
|
|
|
|
|
static void *mouse_p;
|
|
|
|
|
int mouse_type = 0;
|
|
|
|
|
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2017-05-06 17:48:33 +02:00
|
|
|
void
|
|
|
|
|
mouse_emu_init(void)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2017-05-05 01:49:42 +02:00
|
|
|
cur_mouse = mouse_list[mouse_type];
|
|
|
|
|
mouse_p = cur_mouse->init();
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2017-05-06 17:48:33 +02:00
|
|
|
void
|
|
|
|
|
mouse_emu_close(void)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2017-05-05 01:49:42 +02:00
|
|
|
if (cur_mouse)
|
|
|
|
|
cur_mouse->close(mouse_p);
|
|
|
|
|
cur_mouse = NULL;
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2017-05-06 17:48:33 +02:00
|
|
|
void
|
|
|
|
|
mouse_poll(int x, int y, int z, int b)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2017-05-05 01:49:42 +02:00
|
|
|
if (cur_mouse)
|
|
|
|
|
cur_mouse->poll(x, y, z, b, mouse_p);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2017-05-06 17:48:33 +02:00
|
|
|
char *
|
|
|
|
|
mouse_get_name(int mouse)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2017-05-05 01:49:42 +02:00
|
|
|
if (!mouse_list[mouse])
|
|
|
|
|
return(NULL);
|
|
|
|
|
return(mouse_list[mouse]->name);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
2017-05-05 01:49:42 +02:00
|
|
|
|
|
|
|
|
|
2017-05-06 17:48:33 +02:00
|
|
|
char *
|
|
|
|
|
mouse_get_internal_name(int mouse)
|
2017-05-05 01:49:42 +02:00
|
|
|
{
|
|
|
|
|
return(mouse_list[mouse]->internal_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-05-06 17:48:33 +02:00
|
|
|
int
|
|
|
|
|
mouse_get_from_internal_name(char *s)
|
2017-05-05 01:49:42 +02:00
|
|
|
{
|
|
|
|
|
int c = 0;
|
|
|
|
|
|
2017-05-06 17:48:33 +02:00
|
|
|
while (mouse_list[c] != NULL) {
|
2017-05-05 01:49:42 +02:00
|
|
|
if (!strcmp(mouse_list[c]->internal_name, s))
|
|
|
|
|
return(c);
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-05-06 17:48:33 +02:00
|
|
|
int
|
|
|
|
|
mouse_get_type(int mouse)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2017-05-05 01:49:42 +02:00
|
|
|
return(mouse_list[mouse]->type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Return number of MOUSE types we know about. */
|
2017-05-06 17:48:33 +02:00
|
|
|
int
|
|
|
|
|
mouse_get_ndev(void)
|
2017-05-05 01:49:42 +02:00
|
|
|
{
|
|
|
|
|
return(sizeof(mouse_list)/sizeof(mouse_t *) - 1);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|