|
|
| version 1.2, 2004/07/26 15:53:26 | version 1.8, 2012/01/23 04:43:14 |
|---|---|
| Line 1 | Line 1 |
| /* $Id$ */ | |
| /*- | /*- |
| * Copyright (c) 2004 NONAKA Kimihiro <aw9k-nnk@asahi-net.or.jp>, | * Copyright (C) 2004 NONAKA Kimihiro <nonakap@gmail.com> |
| * All rights reserved. | * All rights reserved. |
| * | * |
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without |
| Line 13 | Line 11 |
| * notice, this list of conditions and the following disclaimer in the | * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. | * documentation and/or other materials provided with the distribution. |
| * | * |
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| * SUCH DAMAGE. | |
| */ | */ |
| #ifndef NP2_X11_JOYMNG_H__ | #ifndef NP2_X11_JOYMNG_H__ |
| Line 33 | Line 30 |
| * joystick manager | * joystick manager |
| */ | */ |
| #ifdef __cplusplus | G_BEGIN_DECLS |
| extern "C" { | |
| #endif | |
| #define JOY_NAXIS 2 | #define JOY_NAXIS 2 |
| #define JOY_NBUTTON 4 | #define JOY_NBUTTON 4 |
| Line 44 extern "C" { | Line 39 extern "C" { |
| #define JOY_NAXIS_MAX (JOY_AXIS_INVALID-1) | #define JOY_NAXIS_MAX (JOY_AXIS_INVALID-1) |
| #define JOY_NBUTTON_MAX (JOY_BUTTON_INVALID-1) | #define JOY_NBUTTON_MAX (JOY_BUTTON_INVALID-1) |
| enum JOYINFO_JOYFLAG { | enum { |
| JOY_UP_BIT = (1 << 0), | JOY_UP_BIT = (1 << 0), |
| JOY_DOWN_BIT = (1 << 1), | JOY_DOWN_BIT = (1 << 1), |
| JOY_LEFT_BIT = (1 << 2), | JOY_LEFT_BIT = (1 << 2), |
| Line 56 enum JOYINFO_JOYFLAG { | Line 51 enum JOYINFO_JOYFLAG { |
| }; | }; |
| typedef struct { | typedef struct { |
| int axis[JOY_NAXIS]; | |
| int button[JOY_NBUTTON]; | |
| int naxis; | |
| int nbutton; | |
| int devindex; | int devindex; |
| char *devname; | char *devname; |
| } joydrv_handle_common, *joydrv_handle_t; | |
| int naxis; | |
| int axis[JOY_NAXIS]; | |
| int nbutton; | |
| int button[JOY_NBUTTON]; | |
| } joymng_devinfo_t; | |
| #if defined(SUPPORT_JOYSTICK) | #if defined(SUPPORT_JOYSTICK) |
| REG8 joymng_getstat(void); | |
| // -- X11 | |
| void joymng_initialize(void); | void joymng_initialize(void); |
| void joymng_deinitialize(void); | void joymng_deinitialize(void); |
| const joydrv_handle_t *joymng_get_devinfo_list(void); | joymng_devinfo_t **joymng_get_devinfo_list(void); |
| void joymng_sync(void); | void joymng_sync(void); |
| REG8 joymng_getstat(void); | |
| void joymng_update(void); | |
| REG8 joymng_getstat_with_map(UINT8 *axismap, UINT8 *btnmap); | |
| int joymng_update_task(void *p); | |
| #else /* !SUPPORT_JOYSTICK */ | #else /* !SUPPORT_JOYSTICK */ |
| #define joymng_getstat() (REG8)0xff | |
| // -- X11 | |
| #define joymng_initialize() (np2oscfg.JOYPAD1 |= 2) | #define joymng_initialize() (np2oscfg.JOYPAD1 |= 2) |
| #define joymng_deinitialize() (np2oscfg.JOYPAD1 &= 1) | #define joymng_deinitialize() (np2oscfg.JOYPAD1 &= 1) |
| #define joymng_get_devinfo_list() NULL | #define joymng_get_devinfo_list() NULL |
| #define joymng_sync() | #define joymng_sync() |
| #define joymng_getstat() (REG8)0xff | |
| #define joymng_update() | |
| #endif /* SUPPORT_JOYSTICK */ | #endif /* SUPPORT_JOYSTICK */ |
| #ifdef __cplusplus | G_END_DECLS |
| } | |
| #endif | |
| #endif /* NP2_X11_JOYMNG_H__ */ | #endif /* NP2_X11_JOYMNG_H__ */ |