2.2.0 beta2

parent 94d9cd84
......@@ -2684,7 +2684,6 @@ int parse_cmdline_option (struct uae_prefs *p, char c, char *arg)
case 'W': parse_hardfile_spec (arg); break;
case 'S': parse_sound_spec (p, arg); break;
case 'R': p->gfx_framerate = atoi (arg); break;
case 'x': p->no_xhair = 1; break;
case 'i': p->illegal_mem = 1; break;
case 'J': parse_joy_spec (p, arg); break;
......@@ -3182,7 +3181,6 @@ void default_prefs (struct uae_prefs *p, int type)
* to behave identically on all platforms if possible.
* (TW says: maybe it is time to update default config..) */
p->illegal_mem = 0;
p->no_xhair = 0;
p->use_serial = 0;
p->serial_demand = 0;
p->serial_hwctsrts = 1;
......
......@@ -128,7 +128,6 @@ extern int getjoystickstate (int mouse);
void setmousestate (int mouse, int axis, int data, int isabs);
extern int getmousestate (int mouse);
extern void inputdevice_updateconfig (struct uae_prefs *prefs);
extern void inputdevice_mergeconfig (struct uae_prefs *prefs);
extern void inputdevice_devicechange (struct uae_prefs *prefs);
extern int inputdevice_translatekeycode (int keyboard, int scancode, int state);
......@@ -142,6 +141,7 @@ extern int inputdevice_get_compatibility_input (struct uae_prefs*, int, int*, in
extern struct inputevent *inputdevice_get_eventinfo (int evt);
extern void inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out);
extern void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index);
extern void inputdevice_compa_clear (struct uae_prefs *prefs, int index);
extern int intputdevice_compa_get_eventtype (int evt, int **axistable);
......
......@@ -27,6 +27,7 @@ struct strlist {
#define MAX_INPUT_SUB_EVENT 4
#define MAX_INPUT_SIMULTANEOUS_KEYS 4
// this better be here than in sound.h
#define FILTER_SOUND_OFF 0
#define FILTER_SOUND_EMUL 1
#define FILTER_SOUND_ON 2
......@@ -55,6 +56,8 @@ struct jport {
};
#define JPORT_NONE -1
#define JPORT_CUSTOM -2
#define JPORT_AF_NORMAL 1
#define JPORT_AF_TOGGLE 2
#define MAX_SPARE_DRIVES 20
#define MAX_CUSTOM_MEMORY_ADDRS 2
......@@ -108,7 +111,6 @@ struct uae_prefs {
TCHAR config_host_path[MAX_DPATH];
bool illegal_mem;
int no_xhair;
bool use_serial;
bool serial_demand;
bool serial_hwctsrts;
......
......@@ -3,7 +3,7 @@
*
* joystick/mouse emulation
*
* Copyright 2001-2008 Toni Wilen
* Copyright 2001-2010 Toni Wilen
*
* new fetures:
* - very configurable (and very complex to configure :)
......@@ -227,6 +227,7 @@ static void copyjport (const struct uae_prefs *src, struct uae_prefs *dst, int n
_tcscpy (dst->jports[num].name, src->jports[num].name);
dst->jports[num].id = src->jports[num].id;
dst->jports[num].mode = src->jports[num].mode;
dst->jports[num].autofire = src->jports[num].autofire;
}
static void out_config (FILE *f, int id, int num, const char *s1, const char *s2)
......@@ -702,7 +703,6 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value)
if (joystick < 0) {
num = getnum (&p);
for (keynum = 0; keynum < MAX_INPUT_DEVICE_EVENTS; keynum++) {
if (id->extra[keynum][0] == num)
break;
......@@ -1654,8 +1654,10 @@ uae_u8 handle_parport_joystick (int port, uae_u8 pra, uae_u8 dra)
case 1:
v = ((pra & dra) | (dra ^ 0xff)) & 0x7;
if (parport_joystick_enabled) {
if (getbuttonstate (2, 0)) v &= ~4;
if (getbuttonstate (3, 0)) v &= ~1;
if (getbuttonstate (2, 0))
v &= ~4;
if (getbuttonstate (3, 0))
v &= ~1;
}
return v;
default:
......@@ -1664,6 +1666,15 @@ uae_u8 handle_parport_joystick (int port, uae_u8 pra, uae_u8 dra)
}
}
/* p5 is 1 or floating = cd32 2-button mode */
static bool cd32padmode (uae_u16 p5dir, uae_u16 p5dat)
{
if (!(potgo_value & p5dir) || ((potgo_value & p5dat) && (potgo_value & p5dir)))
return false;
return true;
}
static void charge_cap (int joy, int idx, int charge)
{
if (charge < -1 || charge > 1)
......@@ -1684,10 +1695,19 @@ static void cap_check (void)
int charge = 0, dong, joypot;
uae_u16 pdir = 0x0200 << (joy * 4 + i * 2); /* output enable */
uae_u16 pdat = 0x0100 << (joy * 4 + i * 2); /* data */
uae_u16 p5dir = 0x0200 << (joy * 4);
uae_u16 p5dat = 0x0100 << (joy * 4);
int isbutton = getbuttonstate (joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2);
if (cd32_pad_enabled[joy])
if (cd32_pad_enabled[joy]) {
if (i != 0) // 3rd button?
continue;
if (cd32padmode (p5dir, p5dat))
continue;
// only red and blue can be read if CD32 pad and only if it is in normal pad mode
isbutton |= getbuttonstate (joy, JOYBUTTON_CD32_BLUE);
}
dong = dongle_analogjoy (joy, i);
if (dong >= 0) {
isbutton = 0;
......@@ -1767,8 +1787,7 @@ uae_u8 handle_joystick_buttons (uae_u8 dra)
uae_u16 p5dir = 0x0200 << (i * 4);
uae_u16 p5dat = 0x0100 << (i * 4);
but |= 0x40 << i;
/* Red button is connected to fire when p5 is 1 or floating */
if (!(potgo_value & p5dir) || ((potgo_value & p5dat) && (potgo_value & p5dir))) {
if (!cd32padmode (p5dir, p5dat)) {
if (getbuttonstate (i, JOYBUTTON_CD32_RED))
but &= ~(0x40 << i);
}
......@@ -1817,7 +1836,7 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor)
uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */
uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */
if (cd32_pad_enabled[i]) {
if (cd32_pad_enabled[i] && cd32padmode (p5dir, p5dat)) {
/* p5 is floating in input-mode */
potgor &= ~p5dat;
......@@ -1839,9 +1858,12 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor)
if (pot_cap[i][0] > 100)
potgor |= p5dat;
if (!cd32_pad_enabled[i]) {
potgor &= ~p9dat;
if (pot_cap[i][1] > 100)
potgor |= p9dat;
}
}
}
......@@ -3356,12 +3378,20 @@ void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index)
freejport (prefs, index);
resetjport (prefs, index);
if (mode == 0)
mode = index == 0 ? JSEM_MODE_MOUSE : JSEM_MODE_JOYSTICK;
mode = index == 0 ? JSEM_MODE_MOUSE : (prefs->cs_cd32cd ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK);
prefs->jports[index].mode = mode;
prefs->jports[index].id = -2;
remove_compa_config (prefs, index);
}
// clear device before switching to new one
void inputdevice_compa_clear (struct uae_prefs *prefs, int index)
{
freejport (prefs, index);
resetjport (prefs, index);
remove_compa_config (prefs, index);
}
static void cleardev (struct uae_input_device *uid, int num)
{
......@@ -3369,38 +3399,13 @@ static void cleardev (struct uae_input_device *uid, int num)
for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
uid[num].eventid[i][j] = 0;
uid[num].flags[i][j] = 0;
xfree (uid[num].custom[i][j]);
uid[num].custom[i][j] = NULL;
}
}
}
static void setjoyinputs (struct uae_prefs *prefs, int port)
{
joyinputs[port] = NULL;
switch (joymodes[port])
{
case JSEM_MODE_JOYSTICK:
if (port >= 2)
joyinputs[port] = port == 3 ? ip_parjoy2 : ip_parjoy1;
else
joyinputs[port] = port == 1 ? ip_joy2 : ip_joy1;
break;
case JSEM_MODE_JOYSTICK_CD32:
joyinputs[port] = port ? ip_joycd322 : ip_joycd321;
break;
case JSEM_MODE_JOYSTICK_ANALOG:
joyinputs[port] = port ? ip_analog2 : ip_analog1;
break;
case JSEM_MODE_MOUSE:
joyinputs[port] = port ? ip_mouse2 : ip_mouse1;
break;
case JSEM_MODE_LIGHTPEN:
joyinputs[port] = port ? ip_lightpen2 : ip_lightpen1;
break;
case JSEM_MODE_MOUSE_CDTV:
joyinputs[port] = ip_mousecdtv;
break;
}
}
static void enablejoydevice (struct uae_input_device *uid, int evtnum)
{
......@@ -3416,18 +3421,18 @@ static void enablejoydevice (struct uae_input_device *uid, int evtnum)
static void setjoydevices (struct uae_prefs *prefs, int port)
{
unsigned int ii, i, l, j;
for (ii = 0; joyinputs[port] && joyinputs[port][ii] >= 0; ii++) {
int evtnum = joyinputs[port][ii];
unsigned int i, l, k, j;
for (i = 0; joyinputs[port] && joyinputs[port][i] >= 0; i++) {
int evtnum = joyinputs[port][i];
for (l = 0; l < MAX_INPUT_DEVICES; l++) {
enablejoydevice (&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum);
enablejoydevice (&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum);
enablejoydevice (&prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum);
}
for (i = 0; axistable[i] >= 0; i += 3) {
if (evtnum == axistable[i] || evtnum == axistable[i + 1] || evtnum == axistable[i + 2]) {
for (k = 0; axistable[k] >= 0; k += 3) {
if (evtnum == axistable[k] || evtnum == axistable[k + 1] || evtnum == axistable[k + 2]) {
for (j = 0; j < 3; j++) {
int evtnum2 = axistable[i + j];
int evtnum2 = axistable[k + j];
for (l = 0; l < MAX_INPUT_DEVICES; l++) {
enablejoydevice (&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2);
enablejoydevice (&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2);
......@@ -3441,6 +3446,35 @@ static void setjoydevices (struct uae_prefs *prefs, int port)
}
}
static void setjoyinputs (struct uae_prefs *prefs, int port)
{
joyinputs[port] = NULL;
switch (joymodes[port])
{
case JSEM_MODE_JOYSTICK:
if (port >= 2)
joyinputs[port] = port == 3 ? ip_parjoy2 : ip_parjoy1;
else
joyinputs[port] = port == 1 ? ip_joy2 : ip_joy1;
break;
case JSEM_MODE_JOYSTICK_CD32:
joyinputs[port] = port ? ip_joycd322 : ip_joycd321;
break;
case JSEM_MODE_JOYSTICK_ANALOG:
joyinputs[port] = port ? ip_analog2 : ip_analog1;
break;
case JSEM_MODE_MOUSE:
joyinputs[port] = port ? ip_mouse2 : ip_mouse1;
break;
case JSEM_MODE_LIGHTPEN:
joyinputs[port] = port ? ip_lightpen2 : ip_lightpen1;
break;
case JSEM_MODE_MOUSE_CDTV:
joyinputs[port] = ip_mousecdtv;
break;
}
}
static void setautofire (struct uae_input_device *uid, int port, int af)
{
unsigned int k, i ,j;
......@@ -3449,7 +3483,11 @@ static void setautofire (struct uae_input_device *uid, int port, int af)
for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
if (uid->eventid[i][j] == afp[k]) {
uid->flags[i][j] &= ~(ID_FLAG_AUTOFIRE | ID_FLAG_TOGGLE);
if (af >= JPORT_AF_NORMAL)
uid->flags[i][j] |= ID_FLAG_AUTOFIRE;
if (af == JPORT_AF_TOGGLE)
uid->flags[i][j] |= ID_FLAG_TOGGLE;
}
}
}
......@@ -3510,8 +3548,8 @@ static void compatibility_copy (struct uae_prefs *prefs)
case JSEM_MODE_JOYSTICK_CD32:
default:
{
int iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
joymodes[i] = mode == JSEM_MODE_JOYSTICK_CD32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK;
bool iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
joymodes[i] = iscd32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK;
if (!iscd32)
joyinputs[i] = i ? ip_joy2 : ip_joy1;
else
......@@ -3536,7 +3574,7 @@ static void compatibility_copy (struct uae_prefs *prefs)
break;
}
} else if (prefs->jports[i].id >= 0) {
prefs->jports[i].mode = joymodes[i] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_MOUSE;
joymodes[i] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_MOUSE;
joyinputs[i] = i ? ip_joy2 : ip_mouse1;
}
}
......@@ -3597,9 +3635,9 @@ static void compatibility_copy (struct uae_prefs *prefs)
case JSEM_MODE_JOYSTICK_CD32:
default:
{
int iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
bool iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
input_get_default_joystick (joysticks, joy, i, iscd32 ? JSEM_MODE_JOYSTICK_CD32 : 0);
joymodes[i] = mode == JSEM_MODE_JOYSTICK_CD32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK;
joymodes[i] = iscd32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK;
break;
}
case JSEM_MODE_JOYSTICK_ANALOG:
......@@ -3645,7 +3683,7 @@ static void compatibility_copy (struct uae_prefs *prefs)
int mode = prefs->jports[i].mode;
for (joy = 0; used[joy]; joy++);
if (JSEM_ISANYKBD (i, prefs)) {
int cd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
bool cd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
if (JSEM_ISNUMPAD (i, prefs)) {
if (cd32)
kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_CD32_NP];
......@@ -3735,10 +3773,8 @@ static void compatibility_copy (struct uae_prefs *prefs)
}
}
}
for (i = 0; i < MAX_JPORTS; i++) {
if (prefs->jports[i].autofire)
for (i = 0; i < MAX_JPORTS; i++)
setautofires (prefs, i, prefs->jports[i].autofire);
}
for (i = 0; i < MAX_JPORTS; i++) {
setjoyinputs (prefs, i);
......@@ -3821,7 +3857,7 @@ static void matchdevices_all (struct uae_prefs *prefs)
}
}
static void inputdevice_updateconfig2 (struct uae_prefs *prefs)
void inputdevice_updateconfig (struct uae_prefs *prefs)
{
int i;
......@@ -3892,16 +3928,6 @@ static void inputdevice_updateconfig2 (struct uae_prefs *prefs)
config_changed = 1;
}
void inputdevice_mergeconfig (struct uae_prefs *prefs)
{
inputdevice_updateconfig2 (prefs);
}
void inputdevice_updateconfig (struct uae_prefs *prefs)
{
inputdevice_updateconfig2 (prefs);
}
/* called when devices get inserted or removed
* store old devices temporarily, enumerate all devices
* restore old devices back (order may have changed)
......@@ -4537,7 +4563,6 @@ static void swapjoydevice (struct uae_input_device *uid, int **swaps)
uid->eventid[i][j] = swaps[1 - k][kk];
found = true;
} else {
#if 1
for (jj = 0; axistable[jj] >= 0; jj += 3) {
if (evtnum == axistable[jj] || evtnum == axistable[jj + 1] || evtnum == axistable[jj + 2]) {
for (ii = 0; ii < 3; ii++) {
......@@ -4553,7 +4578,6 @@ static void swapjoydevice (struct uae_input_device *uid, int **swaps)
}
}
}
#endif
}
}
}
......@@ -4768,6 +4792,8 @@ void setjoybuttonstate (int joy, int button, int state)
{
if (testmode) {
inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_BUTTON, button, state);
if (state < 0)
inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_BUTTON, button, 0);
return;
}
#if 0
......
......@@ -445,7 +445,7 @@ configure:4344: $? = 0
configure:4344: result: yes
configure:4350: checking for _doprnt
configure:4350: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccduySMn.o: In function `main':
/tmp/cc9SecbZ.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:67: undefined reference to `_doprnt'
collect2: ld returned 1 exit status
configure:4350: $? = 1
......@@ -533,7 +533,7 @@ configure:4364: $? = 0
configure:4364: result: yes
configure:4364: checking for strcmpi
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccgpaTxE.o: In function `main':
/tmp/ccXI8Zie.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `strcmpi'
collect2: ld returned 1 exit status
configure:4364: $? = 1
......@@ -613,7 +613,7 @@ configure: failed program was:
configure:4364: result: no
configure:4364: checking for stricmp
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccAjejvH.o: In function `main':
/tmp/ccaQV0Wi.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `stricmp'
collect2: ld returned 1 exit status
configure:4364: $? = 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment