src/joystick/nds/SDL_sysjoystick.c
author Edward Rudd <urkle@outoforder.cc>
Wed, 26 Sep 2012 14:08:46 -0400
changeset 6462 5e09ac1aba80
parent 6138 4c64952a58fb
child 6698 28ab2ef7bfc9
permissions -rwxr-xr-x
allocate *Hint structures per Xlib docs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
     2
  Simple DirectMedia Layer
6138
4c64952a58fb Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
     7
  arising from the use of this software.
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
    11
  freely, subject to the following restrictions:
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5301
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
*/
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
#include "SDL_config.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    23
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
#ifdef SDL_JOYSTICK_NDS
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
/* This is the system specific header for the SDL joystick API */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    27
#include <nds.h>
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    28
#include <stdio.h>              /* For the definition of NULL */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    29
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    30
#include "SDL_error.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    31
#include "SDL_events.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
#include "SDL_joystick.h"
5301
248c5c7d6e29 Patch to fix includes from Frank Zago
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    33
#include "../SDL_sysjoystick.h"
248c5c7d6e29 Patch to fix includes from Frank Zago
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    34
#include "../SDL_joystick_c.h"
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    35
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    36
#include "../../video/nds/SDL_ndsevents_c.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    38
/* Function to scan the system for joysticks.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    39
 * This function should set SDL_numjoysticks to the number of available
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    40
 * joysticks.  Joystick 0 should be the system default joystick.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    41
 * It should return 0, or -1 on an unrecoverable fatal error.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    42
 */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    43
int
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
SDL_SYS_JoystickInit(void)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
{
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
    46
    SDL_numjoysticks = 1;
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    47
    return (1);
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    48
}
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    49
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    50
/* Function to get the device-dependent name of a joystick */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    51
const char *
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    52
SDL_SYS_JoystickName(int index)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    53
{
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    54
    if (!index)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    55
        return "NDS builtin joypad";
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    56
    SDL_SetError("No joystick available with that index");
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    57
    return (NULL);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    58
}
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    59
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    60
/* Function to open a joystick for use.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    61
   The joystick to open is specified by the index field of the joystick.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    62
   This should fill the nbuttons and naxes fields of the joystick structure.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    63
   It returns 0, or -1 if there is an error.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    64
 */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    65
int
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    66
SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    67
{
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    68
    joystick->nbuttons = 8;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    69
    joystick->nhats = 0;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    70
    joystick->nballs = 0;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    71
    joystick->naxes = 2;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    72
    return 0;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    73
}
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    74
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    75
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    76
/* Function to update the state of a joystick - called as a device poll.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    77
 * This function shouldn't update the joystick structure directly,
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    78
 * but instead should call SDL_PrivateJoystick*() to deliver events
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    79
 * and update joystick device state.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    80
 */
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
    81
    void
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    82
SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    83
{
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    84
    u32 keysd, keysu;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    85
    int magnitude = 16384;
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    86
    
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    87
        /*scanKeys(); - this is done in PumpEvents, because touch uses it too */ 
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
    88
        keysd = keysDown();
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    89
    keysu = keysUp();
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    90
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    91
    if ((keysd & KEY_UP)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    92
        SDL_PrivateJoystickAxis(joystick, 1, -magnitude);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    93
    }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    94
    if ((keysd & KEY_DOWN)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    95
        SDL_PrivateJoystickAxis(joystick, 1, magnitude);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    96
    }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    97
    if ((keysd & KEY_LEFT)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    98
        SDL_PrivateJoystickAxis(joystick, 0, -magnitude);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    99
    }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   100
    if ((keysd & KEY_RIGHT)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   101
        SDL_PrivateJoystickAxis(joystick, 0, magnitude);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   102
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   103
    if ((keysu & (KEY_UP | KEY_DOWN))) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   104
        SDL_PrivateJoystickAxis(joystick, 1, 0);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   105
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   106
    if ((keysu & (KEY_LEFT | KEY_RIGHT))) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   107
        SDL_PrivateJoystickAxis(joystick, 0, 0);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   108
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   109
    if ((keysd & KEY_A)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   110
        SDL_PrivateJoystickButton(joystick, 0, SDL_PRESSED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   111
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   112
    if ((keysd & KEY_B)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   113
        SDL_PrivateJoystickButton(joystick, 1, SDL_PRESSED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   114
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   115
    if ((keysd & KEY_X)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   116
        SDL_PrivateJoystickButton(joystick, 2, SDL_PRESSED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   117
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   118
    if ((keysd & KEY_Y)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   119
        SDL_PrivateJoystickButton(joystick, 3, SDL_PRESSED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   120
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   121
    if ((keysd & KEY_L)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   122
        SDL_PrivateJoystickButton(joystick, 4, SDL_PRESSED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   123
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   124
    if ((keysd & KEY_R)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   125
        SDL_PrivateJoystickButton(joystick, 5, SDL_PRESSED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   126
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   127
    if ((keysd & KEY_SELECT)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   128
        SDL_PrivateJoystickButton(joystick, 6, SDL_PRESSED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   129
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   130
    if ((keysd & KEY_START)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   131
        SDL_PrivateJoystickButton(joystick, 7, SDL_PRESSED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   132
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   133
    if ((keysu & KEY_A)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   134
        SDL_PrivateJoystickButton(joystick, 0, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   135
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   136
    if ((keysu & KEY_B)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   137
        SDL_PrivateJoystickButton(joystick, 1, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   138
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   139
    if ((keysu & KEY_X)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   140
        SDL_PrivateJoystickButton(joystick, 2, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   141
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   142
    if ((keysu & KEY_Y)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   143
        SDL_PrivateJoystickButton(joystick, 3, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   144
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   145
    if ((keysu & KEY_L)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   146
        SDL_PrivateJoystickButton(joystick, 4, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   147
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   148
    if ((keysu & KEY_R)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   149
        SDL_PrivateJoystickButton(joystick, 5, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   150
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   151
    if ((keysu & KEY_SELECT)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   152
        SDL_PrivateJoystickButton(joystick, 6, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   153
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   154
    if ((keysu & KEY_START)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   155
        SDL_PrivateJoystickButton(joystick, 7, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   156
    }
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   157
}
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   158
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   159
/* Function to close a joystick after use */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   160
void
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   161
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   162
{
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   163
}
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   164
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   165
/* Function to perform any system-specific joystick related cleanup */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   166
void
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   167
SDL_SYS_JoystickQuit(void)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   168
{
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   169
}
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   170
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   171
#endif /* SDL_JOYSTICK_NDS */