255 lines
7.6 KiB
C
255 lines
7.6 KiB
C
/******************************************************************************/
|
|
/* JoyWin.h : Private definitions and functions for the Window version */
|
|
/* */
|
|
/* Author : JENTEY F. */
|
|
/* Last update : 06/03/97 */
|
|
/******************************************************************************/
|
|
|
|
|
|
#ifndef _JOYSTICK_WIN_H
|
|
#define _JOYSTICK_WIN_H
|
|
|
|
|
|
#include <windows.h>
|
|
#include <mmsystem.h>
|
|
#include <regstr.h>
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
/* Platform dependant structures */
|
|
/******************************************************************************/
|
|
|
|
/*
|
|
tdstJoystickAxisCaps
|
|
Defines the min, max, up and down threshold values
|
|
*/
|
|
typedef struct _tdstJoystickAxisCaps
|
|
{
|
|
u_short m_uwXmin;
|
|
u_short m_uwXmax;
|
|
u_short m_uwXup;
|
|
u_short m_uwXdown;
|
|
u_short m_uwYmin;
|
|
u_short m_uwYmax;
|
|
u_short m_uwYup;
|
|
u_short m_uwYdown;
|
|
u_short m_uwZmin;
|
|
u_short m_uwZmax;
|
|
u_short m_uwZup;
|
|
u_short m_uwZdown;
|
|
u_short m_uwRmin;
|
|
u_short m_uwRmax;
|
|
|
|
/* CHRISTOPHE PAD NT MODIFICATIONS 4 RAYMAN II */
|
|
#ifdef _PAD_NT
|
|
u_short m_uwRup;
|
|
u_short m_uwRdown;
|
|
#endif _PAD_NT
|
|
/* END CHRISTOPHE PAD NT MODIFICATIONS 4 RAYMAN II */
|
|
|
|
u_short m_uwUmin;
|
|
u_short m_uwUmax;
|
|
u_short m_uwVmin;
|
|
u_short m_uwVmax;
|
|
|
|
} tdstJoystickAxisCaps;
|
|
|
|
|
|
/*
|
|
tdstJoystickAxisValues
|
|
Structure use to store axis position
|
|
*/
|
|
typedef struct _tdstJoystickAxisValues
|
|
{
|
|
u_short m_uwXValue;
|
|
u_short m_uwYValue;
|
|
u_short m_uwZValue;
|
|
u_short m_uwRValue;
|
|
u_short m_uwUValue;
|
|
u_short m_uwVValue;
|
|
|
|
} tdstJoystickAxisValues;
|
|
|
|
#define M_JoyCopyAxisValues( p_stA, p_stB ) \
|
|
{ (p_stA)->m_uwXValue = (p_stB)->m_uwXValue; \
|
|
(p_stA)->m_uwYValue = (p_stB)->m_uwYValue; \
|
|
(p_stA)->m_uwZValue = (p_stB)->m_uwZValue; \
|
|
(p_stA)->m_uwRValue = (p_stB)->m_uwRValue; \
|
|
(p_stA)->m_uwUValue = (p_stB)->m_uwUValue; \
|
|
(p_stA)->m_uwVValue = (p_stB)->m_uwVValue; }
|
|
|
|
|
|
/******************************************************************************/
|
|
/* Common structures */
|
|
/******************************************************************************/
|
|
|
|
/*
|
|
tdsGamePortCaps : Game Port features
|
|
*/
|
|
typedef struct _tdstGamePort
|
|
{
|
|
/* This flag indicates if the game port if initialized */
|
|
short m_wGameportOk;
|
|
|
|
/* Number of joystick supported by the driver */
|
|
short m_wNbMaxiJoystick;
|
|
|
|
/* Number of Allocated joystick */
|
|
short m_wNbJoystick;
|
|
|
|
/* Define whose joystick features the game will try to use */
|
|
u_long m_ulGameFeatures;
|
|
|
|
/* Define whose joystick are active */
|
|
u_short m_uwActiveFlag;
|
|
|
|
/* A counter that is incremented each time the fnReadGamePort function is called */
|
|
u_long m_ulTimeCount;
|
|
|
|
/* Define the number of joystick previous states stored in the history */
|
|
short m_wHistorySize;
|
|
|
|
} tdstGamePort;
|
|
|
|
|
|
/*
|
|
tdstJoystickCaps : joystick features
|
|
*/
|
|
typedef struct _tdstJoystickCaps
|
|
{
|
|
u_short m_uwPid;
|
|
u_short m_uwMid;
|
|
u_short m_uwNbAxe;
|
|
u_short m_uwNbButton;
|
|
u_long m_ulCapsFlag;
|
|
u_short m_uwType;
|
|
tdstJoystickAxisCaps m_stAxisCaps;
|
|
|
|
} tdstJoystickCaps;
|
|
|
|
/* Macros to get private members with a tdstJoystickCaps pointer */
|
|
#define M_JoyXMax(A) (A)->m_stAxisCaps.m_uwXmax
|
|
#define M_JoyXMin(A) (A)->m_stAxisCaps.m_uwXmin
|
|
#define M_JoyXUp(A) (A)->m_stAxisCaps.m_uwXup
|
|
#define M_JoyXDown(A) (A)->m_stAxisCaps.m_uwXDown
|
|
#define M_JoyYMax(A) (A)->m_stAxisCaps.m_uwYmax
|
|
#define M_JoyYMin(A) (A)->m_stAxisCaps.m_uwYmin
|
|
#define M_JoyYUp(A) (A)->m_stAxisCaps.m_uwYup
|
|
#define M_JoyYDown(A) (A)->m_stAxisCaps.m_uwYDown
|
|
#define M_JoyZMax(A) (A)->m_stAxisCaps.m_uwZmax
|
|
#define M_JoyZMin(A) (A)->m_stAxisCaps.m_uwZmin
|
|
#define M_JoyZUp(A) (A)->m_stAxisCaps.m_uwZup
|
|
#define M_JoyZDown(A) (A)->m_stAxisCaps.m_uwZDown
|
|
#define M_JoyRMax(A) (A)->m_stAxisCaps.m_uwRmax
|
|
#define M_JoyRMin(A) (A)->m_stAxisCaps.m_uwRmin
|
|
#define M_JoyUMax(A) (A)->m_stAxisCaps.m_uwUmax
|
|
#define M_JoyUMin(A) (A)->m_stAxisCaps.m_uwUmin
|
|
#define M_JoyVMax(A) (A)->m_stAxisCaps.m_uwVmax
|
|
#define M_JoyVMin(A) (A)->m_stAxisCaps.m_uwVmin
|
|
|
|
|
|
/*
|
|
tdstJoystickStatus : joystick status informations
|
|
*/
|
|
typedef struct _stJoystickStatus
|
|
{
|
|
u_long m_ulDirection;
|
|
u_long m_ulButton;
|
|
u_long m_ulLastTimeCount;
|
|
u_short m_uwHistoryHead;
|
|
u_short m_uwValidRecordNumber;
|
|
u_long m_ulExitRecordingModeButton;
|
|
tdstJoystickAxisValues m_stAxisValues;
|
|
|
|
} tdstJoystickStatus;
|
|
|
|
/* Macros to get private members with a tdstJoystickStatus pointer */
|
|
#define M_JoyX(A) (A)->m_stAxisValues.m_uwXValue
|
|
#define M_JoyY(A) (A)->m_stAxisValues.m_uwYValue
|
|
#define M_JoyZ(A) (A)->m_stAxisValues.m_uwZValue
|
|
#define M_JoyR(A) (A)->m_stAxisValues.m_uwRValue
|
|
#define M_JoyU(A) (A)->m_stAxisValues.m_uwUValue
|
|
#define M_JoyV(A) (A)->m_stAxisValues.m_uwVValue
|
|
|
|
|
|
|
|
/*
|
|
tdsJoystickRecord : data structure for joystick historic and demo record
|
|
*/
|
|
typedef struct _tdstJoystickRecord
|
|
{
|
|
u_long m_ulDirection;
|
|
u_long m_ulButton;
|
|
tdstJoystickAxisValues m_stAxisValues;
|
|
/* u_long m_ulTimeCount;*/
|
|
|
|
} tdstJoystickRecord;
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************/
|
|
/* Private function for the Window version */
|
|
/*******************************************************************************/
|
|
|
|
|
|
/*
|
|
fn_wJoyGetMaxJoystickCount: return the number of joystick gameport can support
|
|
return 0 if there is no gameport.
|
|
*/
|
|
extern short fn_wJoyGetMaxJoystickCount();
|
|
|
|
|
|
/*
|
|
Fill the p_stJoyCaps with the capabilities of the specified joystick
|
|
Return an error if unable to get these information.
|
|
It usually happens when the joystick isn't configurated in the control panel,
|
|
but could also appear with some joystcik if the joystick isn't connected.
|
|
*/
|
|
extern short fn_wJoyGetJoystickCaps( short wJoystickNum, tdstJoystickCaps* p_stJoyCaps );
|
|
|
|
|
|
/*
|
|
Fill the p_stJoyState with the state of the specified joystick
|
|
Return an error if unable to get these information.
|
|
It usually happens when the joystick isn't configurated in the control panel,
|
|
but could also appear with some joystick if the joystick isn't connected.
|
|
*/
|
|
extern short fn_wJoyGetJoystickState(
|
|
short wJoystickNum,
|
|
tdstJoystickStatus* p_stJoyState,
|
|
tdstJoystickCaps* p_stJoyCaps
|
|
);
|
|
|
|
|
|
|
|
/*
|
|
This function must be called after fn_wJoyGetJoystickState()
|
|
It updates the directions values in the p_stJoyState structure
|
|
*/
|
|
|
|
extern void fn_vJoyUpdateDirection(
|
|
short wJoystickNum,
|
|
tdstJoystickStatus* p_stJoyState,
|
|
tdstJoystickCaps* p_stJoyCaps
|
|
);
|
|
|
|
|
|
/*
|
|
Return C_wJoyTrue if the specified joystick is conected else C_wJoyFalse
|
|
Return C_wJoyError if an error occured
|
|
*/
|
|
extern short fn_wJoyCheckConnection( short wJoystickNum );
|
|
|
|
|
|
/*
|
|
Return the productName in pszName
|
|
*/
|
|
extern short fn_wJoyGetOEMProductName( short wJoystickNum, char *pszName );
|
|
|
|
|
|
#endif
|