--- uae/src/od-win32/joystick.c 2018/04/24 16:40:31 1.1 +++ uae/src/od-win32/joystick.c 2018/04/24 16:43:00 1.1.1.2 @@ -6,21 +6,15 @@ * Copyright 1997 Mathias Ortmann */ -#ifdef __GNUC__ -#define __int64 long long -#include "machdep/winstuff.h" -#else #include #include #include #include -#include -#include +#include #include #include #include #include -#endif #include "config.h" #include "sysconfig.h" @@ -28,13 +22,12 @@ #include "options.h" #include "osdep/win32gui.h" #include "include/memory.h" -#include "resource.h" -#include "osdep/win32.h" +#include "osdep/resource.h" /* Joystick emulation, Win32 interface */ -#define MAXJOYSTICKS 2 +int nr_joysticks; -static int joystickpresent[MAXJOYSTICKS]; +int joystickspresent[MAXJOYSTICKS]; static int unplugged[MAXJOYSTICKS]; static int warned[MAXJOYSTICKS]; static JOYCAPS jc[MAXJOYSTICKS]; @@ -47,7 +40,7 @@ void read_joystick (int nr, short *dir, int joyerr; *dir = *button = 0; - if (!joystickpresent[nr]) + if (!joystickspresent[nr]) return; if (unplugged[nr]) { @@ -60,13 +53,13 @@ void read_joystick (int nr, short *dir, break; case JOYERR_UNPLUGGED: if (!warned[nr]) { - fprintf (stderr, "Joystick %d seems to be unplugged.\n", nr); + write_log( "Joystick %d seems to be unplugged.\n", nr ); warned[nr] = 1; } unplugged[nr] = 200; return; default: - fprintf (stderr, "Error reading joystick %d: %d.\n", nr, joyerr); + write_log( "Error reading joystick %d: %d.\n", nr, joyerr ); unplugged[nr] = 100; return; } @@ -96,13 +89,13 @@ void init_joystick (void) for (nr = 0; nr < MAXJOYSTICKS; nr++) { if (joyGetDevCaps (JOYSTICKID1 + nr, jc + nr, sizeof (jc)) == JOYERR_NOERROR) { - printf ("Joystick %d: %s with %d buttons\n", nr, jc[nr].szPname, jc[nr].wNumButtons); - joystickpresent[nr] = 1; + write_log( "Joystick %d: %s with %d buttons\n", nr, jc[nr].szPname, jc[nr].wNumButtons ); + joystickspresent[nr] = 1; found++; } } - - fprintf (stdout, "%d joystick(s) found.\n", found); + nr_joysticks = found; + write_log( "%d joystick(s) found.\n", found ); } void close_joystick (void)