comparison src/joystick/os2/SDL_sysjoystick.c @ 1338:604d73db6802

Removed uses of stdlib.h and string.h
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 09:29:18 +0000
parents 3692456e7b0f
children c71e05b4dc2e
comparison
equal deleted inserted replaced
1337:c687f06c7473 1338:604d73db6802
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22 22
23 /* OS/2 Joystick driver, contributed by Daniel Caetano */ 23 /* OS/2 Joystick driver, contributed by Daniel Caetano */
24 24
25 #include <stdlib.h>
26 #include <stdio.h>
27 #include <mem.h> 25 #include <mem.h>
28 26
29 #define INCL_DOSDEVICES 27 #define INCL_DOSDEVICES
30 #define INCL_DOSDEVIOCTL 28 #define INCL_DOSDEVIOCTL
31 #define INCL_DOSMEMMGR 29 #define INCL_DOSMEMMGR
32 #include <os2.h> 30 #include <os2.h>
33 #include "joyos2.h" 31 #include "joyos2.h"
34 32
33 #include "SDL_stdlib.h"
34 #include "SDL_string.h"
35 #include "SDL_error.h" 35 #include "SDL_error.h"
36 #include "SDL_joystick.h" 36 #include "SDL_joystick.h"
37 #include "SDL_sysjoystick.h" 37 #include "SDL_sysjoystick.h"
38 #include "SDL_joystick_c.h" 38 #include "SDL_joystick_c.h"
39 39
215 if (joycfg.buttons>=5) SYS_JoyData[0].buttoncalc[0]=((axis[2]->lower+axis[3]->centre)>>1); 215 if (joycfg.buttons>=5) SYS_JoyData[0].buttoncalc[0]=((axis[2]->lower+axis[3]->centre)>>1);
216 if (joycfg.buttons>=6) SYS_JoyData[0].buttoncalc[1]=((axis[3]->lower+axis[3]->centre)>>1); 216 if (joycfg.buttons>=6) SYS_JoyData[0].buttoncalc[1]=((axis[3]->lower+axis[3]->centre)>>1);
217 if (joycfg.buttons>=7) SYS_JoyData[0].buttoncalc[2]=((axis[2]->upper+axis[3]->centre)>>1); 217 if (joycfg.buttons>=7) SYS_JoyData[0].buttoncalc[2]=((axis[2]->upper+axis[3]->centre)>>1);
218 if (joycfg.buttons>=8) SYS_JoyData[0].buttoncalc[3]=((axis[3]->upper+axis[3]->centre)>>1); 218 if (joycfg.buttons>=8) SYS_JoyData[0].buttoncalc[3]=((axis[3]->upper+axis[3]->centre)>>1);
219 /* Intialize Joystick Name */ 219 /* Intialize Joystick Name */
220 strcpy (SYS_JoyData[0].szDeviceName,joycfg.name); 220 SDL_strcpy (SYS_JoyData[0].szDeviceName,joycfg.name);
221 } 221 }
222 /* Default Init ... autoconfig */ 222 /* Default Init ... autoconfig */
223 else 223 else
224 { 224 {
225 /* if two devices were detected... configure as Joy1 4 axis and Joy2 2 axis */ 225 /* if two devices were detected... configure as Joy1 4 axis and Joy2 2 axis */
292 SYS_JoyData[0].axes_max[1] = stGameCalib.By.upper; 292 SYS_JoyData[0].axes_max[1] = stGameCalib.By.upper;
293 } 293 }
294 } 294 }
295 /* Hack to define Joystick Port Names */ 295 /* Hack to define Joystick Port Names */
296 if ( numdevs > maxdevs ) numdevs = maxdevs; 296 if ( numdevs > maxdevs ) numdevs = maxdevs;
297 for (i=0; i<numdevs; i++) sprintf (SYS_JoyData[i].szDeviceName,"Default Joystick %c",'A'+SYS_JoyData[i].id); 297 for (i=0; i<numdevs; i++) {
298 SDL_sprintf (SYS_JoyData[i].szDeviceName, SDL_arraysize(szDeviceName), "Default Joystick %c", 'A'+SYS_JoyData[i].id);
298 } 299 }
299 } 300 }
300 /* Return the number of devices found */ 301 /* Return the number of devices found */
301 return(numdevs); 302 return(numdevs);
302 } 303 }