<commit_before>/*
    SDL - Simple DirectMedia Layer
    Copyright (C) 1997-2004 <NAME>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    <NAME>
    <EMAIL>
*/

#ifdef SAVE_RCSID
static char rcsid =
 "@(#) $Id$";
#endif

/* This is the system specific header for the SDL joystick API */

#include <stdio.h>		/* For the definition of NULL */
#include <stdlib.h>		/* For getenv() prototype */
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <limits.h>		/* For the definition of PATH_MAX */
#ifdef __arm__
#include <linux/limits.h> /* Arm cross-compiler needs this */
#endif
#include <linux/joystick.h>
#ifdef USE_INPUT_EVENTS
#include <linux/input.h>
#endif

#include "SDL_error.h"
#include "SDL_joystick.h"
#include "SDL_sysjoystick.h"
#include "SDL_joystick_c.h"

/* Special joystick configurations */
static struct {
	const char *name;
	int naxes;
	int nhats;
	int nballs;
} special_joysticks[] = {
	{ "MadCatz Panther XL", 3, 2, 1 }, /* We don't handle rudder (axis 8) */
	{ "SideWinder Precision Pro", 4, 1, 0 },
	{ "SideWinder 3D Pro", 4, 1, 0 },
	{ "Microsoft SideWinder 3D Pro", 4, 1, 0 },
	{ "Microsoft SideWinder Dual Strike USB version 1.0", 2, 1, 0 },
	{ "WingMan Interceptor", 3, 3, 0 },
	{ "WingMan Extreme Digital 3D", 4, 1, 0 },
	{ "Microsoft SideWinder Precision 2 Joystick", 4, 1, 0 },
	{ "Logitech Inc. WingMan Extreme Digital 3D", 4, 1, 0 },
	{ "Saitek Saitek X45", 6, 1, 0 }
};

#ifndef NO_LOGICAL_JOYSTICKS

static struct joystick_logical_values {
        int njoy;
        int nthing;
} joystick_logical_values[] = {

/* +0 */
   /* MP-8800 axes map - map to {logical joystick #, logical axis #} */
   {0,0},{0,1},{0,2},{1,0},{1,1},{0,3},{1,2},{1,3},{2,0},{2,1},{2,2},{2,3},
   {3,0},{3,1},{3,2},{3,3},{0,4},{1,4},{2,4},

/* +19 */
   /* MP-8800 hat map - map to {logical joystick #, logical hat #} */
   {0,0},{1,0},{2,0},{3,0},

/* +23 */
   /* MP-8800 button map - map to {logical joystick #, logical button #} */
   {0,0},{0,1},{0,2},{0,3},{0,4},{0,5},{0,6},{0,7},{0,8},{0,9},{0,10},{0,11},
   {1,0},{1,1},{1,2},{1,3},{1,4},{1,5},{1,6},{1,7},{1,8},{1,9},{1,10},{1,11},
   {2,0},{2,1},{2,2},{2,3},{2,4},{2,5},{2,6},{2,7},{2,8},{2,9},{2,10},{2,11},
   {3,0},{3,1},{3,2},{3,3},{3,4},{3,5},{3,6},{3,7},{3,8},{3,9},{3,10},{3,11}
};

static struct joystick_logical_layout {
        int naxes;
        int nhats;
        int nballs;
        int nbuttons;
} joystick_logical_layout[] = {
        /* MP-8800 logical layout */
        {5, 1, 0, 12},
        {5, 1, 0, 12},
        {5, 1, 0, 12},
        {4, 1, 0, 12}
};

/*
   Some USB HIDs show up as a single joystick even though they actually
   control 2 or more joysticks.  This array sets up a means of mapping
   a single physical joystick to multiple logical joysticks. (djm)
                                                                                
   njoys
        the number of logical joysticks
                                                                                
   layouts
        an array of layout structures, one to describe each logical joystick
                                                                                
   axes, hats, balls, buttons
        arrays that map a physical thingy to a logical thingy
 */
static struct joystick_logicalmap {
        const char *name;
        int njoys;
        struct joystick_logical_layout *layouts;
        struct joystick_logical_values *axes;
        struct joystick_logical_values *hats;
        struct joystick_logical_values *balls;
        struct joystick_logical_values *buttons;

} joystick_logicalmap[] = {
        {"WiseGroup.,Ltd MP-8800 Quad USB Joypad", 4, joystick_logical_layout,
         joystick_logical_values, joystick_logical_values+19, NULL,
         joystick_logical_values+23}
};
<commit_msg>Date: Sat, 14 Jan 2006 15:16:01 -0500 From: <NAME> Subject: [SDL] [PATCH] ML-8866 PS2->USB converter<commit_after>/*
    SDL - Simple DirectMedia Layer
    Copyright (C) 1997-2004 <NAME>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    <NAME>
    <EMAIL>
*/

#ifdef SAVE_RCSID
static char rcsid =
 "@(#) $Id$";
#endif

/* This is the system specific header for the SDL joystick API */

#include <stdio.h>		/* For the definition of NULL */
#include <stdlib.h>		/* For getenv() prototype */
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <limits.h>		/* For the definition of PATH_MAX */
#ifdef __arm__
#include <linux/limits.h> /* Arm cross-compiler needs this */
#endif
#include <linux/joystick.h>
#ifdef USE_INPUT_EVENTS
#include <linux/input.h>
#endif

#include "SDL_error.h"
#include "SDL_joystick.h"
#include "SDL_sysjoystick.h"
#include "SDL_joystick_c.h"

/* Special joystick configurations */
static struct {
	const char *name;
	int naxes;
	int nhats;
	int nballs;
} special_joysticks[] = {
	{ "MadCatz Panther XL", 3, 2, 1 }, /* We don't handle rudder (axis 8) */
	{ "SideWinder Precision Pro", 4, 1, 0 },
	{ "SideWinder 3D Pro", 4, 1, 0 },
	{ "Microsoft SideWinder 3D Pro", 4, 1, 0 },
	{ "Microsoft SideWinder Dual Strike USB version 1.0", 2, 1, 0 },
	{ "WingMan Interceptor", 3, 3, 0 },
	{ "WingMan Extreme Digital 3D", 4, 1, 0 },
	{ "Microsoft SideWinder Precision 2 Joystick", 4, 1, 0 },
	{ "Logitech Inc. WingMan Extreme Digital 3D", 4, 1, 0 },
	{ "Saitek Saitek X45", 6, 1, 0 }
};

#ifndef NO_LOGICAL_JOYSTICKS

static struct joystick_logical_values {
        int njoy;
        int nthing;
} joystick_logical_values[] = {

/* +0 */
   /* MP-8800 axes map - map to {logical joystick #, logical axis #} */
   {0,0},{0,1},{0,2},{1,0},{1,1},{0,3},{1,2},{1,3},{2,0},{2,1},{2,2},{2,3},
   {3,0},{3,1},{3,2},{3,3},{0,4},{1,4},{2,4},

/* +19 */
   /* MP-8800 hat map - map to {logical joystick #, logical hat #} */
   {0,0},{1,0},{2,0},{3,0},

/* +23 */
   /* MP-8800 button map - map to {logical joystick #, logical button #} */
   {0,0},{0,1},{0,2},{0,3},{0,4},{0,5},{0,6},{0,7},{0,8},{0,9},{0,10},{0,11},
   {1,0},{1,1},{1,2},{1,3},{1,4},{1,5},{1,6},{1,7},{1,8},{1,9},{1,10},{1,11},
   {2,0},{2,1},{2,2},{2,3},{2,4},{2,5},{2,6},{2,7},{2,8},{2,9},{2,10},{2,11},
   {3,0},{3,1},{3,2},{3,3},{3,4},{3,5},{3,6},{3,7},{3,8},{3,9},{3,10},{3,11},

/* +71 */
   /* MP-8866 axes map - map to {logical joystick #, logical axis#} */
   {0,0},{0,1},{0,2},{0,3},
   {1,0},{1,1},{1,2},{1,3},

/* +79 */
   /* MP-8866 hat map - map to {logical joystick #, logical hat #} */
   {0,0},{1,0},

/* +81 */
   /* MP-8866 button map - map to {logical joystick #, logical button #} */
   {0,0},{0,1},{0,2},{0,3},{0,4},{0,5},{0,6},{0,7},{0,8},{0,9},{0,10},{0,11},
   {1,0},{1,1},{1,2},{1,3},{1,4},{1,5},{1,6},{1,7},{1,8},{1,9},{1,10},{1,11}
};

static struct joystick_logical_layout {
        int naxes;
        int nhats;
        int nballs;
        int nbuttons;
} joystick_logical_layout[] = {
/* +0 */
        /* MP-8800 logical layout */
        {5, 1, 0, 12},
        {5, 1, 0, 12},
        {5, 1, 0, 12},
        {4, 1, 0, 12},
/* +4 */
	/* MP-8866 logical layout */
	{4, 1, 0, 12},
	{4, 1, 0, 12}
};


/*
   Some USB HIDs show up as a single joystick even though they actually
   control 2 or more joysticks.  This array sets up a means of mapping
   a single physical joystick to multiple logical joysticks. (djm)
                                                                                
   njoys
        the number of logical joysticks
                                                                                
   layouts
        an array of layout structures, one to describe each logical joystick
                                                                                
   axes, hats, balls, buttons
        arrays that map a physical thingy to a logical thingy
 */
static struct joystick_logicalmap {
        const char *name;
        int njoys;
        struct joystick_logical_layout *layouts;
        struct joystick_logical_values *axes;
        struct joystick_logical_values *hats;
        struct joystick_logical_values *balls;
        struct joystick_logical_values *buttons;

} joystick_logicalmap[] = {
        {"WiseGroup.,Ltd MP-8800 Quad USB Joypad", 4, joystick_logical_layout,
         joystick_logical_values, joystick_logical_values+19, NULL,
         joystick_logical_values+23},
	/* WiseGroup MP-8866 Dual USB Joypad */
	{"0925:8866", 2, joystick_logical_layout+4,
	 joystick_logical_values+71, joystick_logical_values+79, NULL,
	 joystick_logical_values+81}

};

{'fraction_non_alphanumeric': 0.16187778227438285, 'fraction_numerical': 0.06829218939700527, 'mean_word_length': 2.8136574074074074, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4722642', 'n_tokens_mistral': 3859, 'n_tokens_neox': 3482, 'n_words': 1010}