[nrage] some code clean up

This commit is contained in:
zilmar 2015-11-06 22:55:44 +11:00
parent 7c3f24b20d
commit 43f175ce70
2 changed files with 273 additions and 278 deletions

View File

@ -1,5 +1,5 @@
/********************************************************************************** /**********************************************************************************
Common Controller plugin spec, version #1.1 maintained by Common Controller plugin spec, version #1.1 maintained by
zilmar (zilmar@emulation64.com) zilmar (zilmar@emulation64.com)
All questions or suggestions should go through the emutalk plugin forum. All questions or suggestions should go through the emutalk plugin forum.
@ -12,11 +12,11 @@ http://www.emutalk.net/cgi-bin/ikonboard/ikonboard.cgi?s=3bd272222f66ffff;act=SF
extern "C" { extern "C" {
#endif #endif
/* Note: BOOL, BYTE, WORD, DWORD, TRUE, FALSE are defined in windows.h */ /* Note: BOOL, BYTE, WORD, DWORD, TRUE, FALSE are defined in windows.h */
#define PLUGIN_TYPE_CONTROLLER 4 #define PLUGIN_TYPE_CONTROLLER 4
/*** Conteroller plugin's ****/ /*** Conteroller plugin's ****/
#define PLUGIN_NONE 1 #define PLUGIN_NONE 1
#define PLUGIN_MEMPAK 2 #define PLUGIN_MEMPAK 2
// not implemeted for non raw data // not implemeted for non raw data
@ -26,208 +26,212 @@ extern "C" {
// the controller plugin is passed in raw data // the controller plugin is passed in raw data
#define PLUGIN_RAW 5 #define PLUGIN_RAW 5
/********************************************************************************* /*********************************************************************************
Note about Conteroller plugin's: Note about Conteroller plugin's:
the rumble pak needs a function for the force feed back joystick and tranfer pak the rumble pak needs a function for the force feed back joystick and tranfer pak
probaly needs a function for the plugin to be able to select the GB rom and probaly needs a function for the plugin to be able to select the GB rom and
eeprom... maybe this should be done by the emu instead of the plugin, but I think eeprom... maybe this should be done by the emu instead of the plugin, but I think
it probaly should be done by the plugin. I will see about adding these functions it probaly should be done by the plugin. I will see about adding these functions
in the next spec in the next spec
**********************************************************************************/ **********************************************************************************/
#define EXPORT __declspec(dllexport) #define EXPORT __declspec(dllexport)
#define CALL _cdecl #define CALL _cdecl
/***** Structures *****/ /***** Structures *****/
typedef struct { typedef struct
WORD Version; /* Should be set to 0x0101 */ {
WORD Type; /* Set to PLUGIN_TYPE_CONTROLLER */ WORD Version; /* Should be set to 0x0101 */
char Name[100]; /* Name of the DLL */ WORD Type; /* Set to PLUGIN_TYPE_CONTROLLER */
BOOL Reserved1; char Name[100]; /* Name of the DLL */
BOOL Reserved2; BOOL Reserved1;
} PLUGIN_INFO; BOOL Reserved2;
} PLUGIN_INFO;
typedef struct { typedef struct
BOOL Present; {
BOOL RawData; BOOL Present;
int Plugin; BOOL RawData;
} CONTROL; int Plugin;
} CONTROL;
typedef union { typedef union
DWORD Value; {
struct { DWORD Value;
unsigned R_DPAD : 1; struct
unsigned L_DPAD : 1; {
unsigned D_DPAD : 1; unsigned R_DPAD : 1;
unsigned U_DPAD : 1; unsigned L_DPAD : 1;
unsigned START_BUTTON : 1; unsigned D_DPAD : 1;
unsigned Z_TRIG : 1; unsigned U_DPAD : 1;
unsigned B_BUTTON : 1; unsigned START_BUTTON : 1;
unsigned A_BUTTON : 1; unsigned Z_TRIG : 1;
unsigned B_BUTTON : 1;
unsigned A_BUTTON : 1;
unsigned R_CBUTTON : 1; unsigned R_CBUTTON : 1;
unsigned L_CBUTTON : 1; unsigned L_CBUTTON : 1;
unsigned D_CBUTTON : 1; unsigned D_CBUTTON : 1;
unsigned U_CBUTTON : 1; unsigned U_CBUTTON : 1;
unsigned R_TRIG : 1; unsigned R_TRIG : 1;
unsigned L_TRIG : 1; unsigned L_TRIG : 1;
unsigned Reserved1 : 1; unsigned Reserved1 : 1;
unsigned Reserved2 : 1; unsigned Reserved2 : 1;
signed Y_AXIS : 8; signed Y_AXIS : 8;
signed X_AXIS : 8; signed X_AXIS : 8;
}; };
} BUTTONS; } BUTTONS;
typedef struct { typedef struct
HWND hMainWindow; {
HINSTANCE hinst; HWND hMainWindow;
HINSTANCE hinst;
BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry, only effects header. // bswap on a dword (32 bits) boundry, only effects header.
// eg. the first 8 bytes are stored like this: // eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5 // 4 3 2 1 8 7 6 5
BYTE * HEADER; // This is the rom header (first 40h bytes of the rom) BYTE * HEADER; // This is the rom header (first 40h bytes of the rom)
CONTROL *Controls; // A pointer to an array of 4 controllers .. eg: CONTROL *Controls; // A pointer to an array of 4 controllers .. eg:
// CONTROL Controls[4]; // CONTROL Controls[4];
} CONTROL_INFO; } CONTROL_INFO;
/****************************************************************** /******************************************************************
Function: CloseDLL Function: CloseDLL
Purpose: This function is called when the emulator is closing Purpose: This function is called when the emulator is closing
down allowing the dll to de-initialise. down allowing the dll to de-initialise.
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL CloseDLL (void); EXPORT void CALL CloseDLL(void);
/****************************************************************** /******************************************************************
Function: ControllerCommand Function: ControllerCommand
Purpose: To process the raw data that has just been sent to a Purpose: To process the raw data that has just been sent to a
specific controller. specific controller.
input: - Controller Number (0 to 3) and -1 signalling end of input: - Controller Number (0 to 3) and -1 signalling end of
processing the pif ram. processing the pif ram.
- Pointer of data to be processed. - Pointer of data to be processed.
output: none output: none
note: This function is only needed if the DLL is allowing raw
data, or the plugin is set to raw
the data that is being processed looks like this: note: This function is only needed if the DLL is allowing raw
initilize controller: 01 03 00 FF FF FF data, or the plugin is set to raw
read controller: 01 04 01 FF FF FF FF
*******************************************************************/
EXPORT void CALL ControllerCommand ( int Control, BYTE * Command);
/****************************************************************** the data that is being processed looks like this:
Function: DllAbout initilize controller: 01 03 00 FF FF FF
Purpose: This function is optional function that is provided read controller: 01 04 01 FF FF FF FF
to give further information about the DLL. *******************************************************************/
input: a handle to the window that calls this function EXPORT void CALL ControllerCommand(int Control, BYTE * Command);
output: none
*******************************************************************/
EXPORT void CALL DllAbout ( HWND hParent );
/****************************************************************** /******************************************************************
Function: DllConfig Function: DllAbout
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to allow the user to configure the dll to give further information about the DLL.
input: a handle to the window that calls this function input: a handle to the window that calls this function
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL DllConfig ( HWND hParent ); EXPORT void CALL DllAbout(HWND hParent);
/****************************************************************** /******************************************************************
Function: DllTest Function: DllConfig
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to allow the user to test the dll to allow the user to configure the dll
input: a handle to the window that calls this function input: a handle to the window that calls this function
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL DllTest ( HWND hParent ); EXPORT void CALL DllConfig(HWND hParent);
/****************************************************************** /******************************************************************
Function: GetDllInfo Function: DllTest
Purpose: This function allows the emulator to gather information Purpose: This function is optional function that is provided
about the dll by filling in the PluginInfo structure. to allow the user to test the dll
input: a pointer to a PLUGIN_INFO stucture that needs to be input: a handle to the window that calls this function
filled by the function. (see def above) output: none
output: none *******************************************************************/
*******************************************************************/ EXPORT void CALL DllTest(HWND hParent);
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo );
/****************************************************************** /******************************************************************
Function: GetKeys Function: GetDllInfo
Purpose: To get the current state of the controllers buttons. Purpose: This function allows the emulator to gather information
input: - Controller Number (0 to 3) about the dll by filling in the PluginInfo structure.
- A pointer to a BUTTONS structure to be filled with input: a pointer to a PLUGIN_INFO stucture that needs to be
the controller state. filled by the function. (see def above)
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL GetKeys(int Control, BUTTONS * Keys ); EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo);
/****************************************************************** /******************************************************************
Function: InitiateControllers Function: GetKeys
Purpose: This function initialises how each of the controllers Purpose: To get the current state of the controllers buttons.
should be handled. input: - Controller Number (0 to 3)
input: - The handle to the main window. - A pointer to a BUTTONS structure to be filled with
- A controller structure that needs to be filled for the controller state.
the emulator to know how to handle each controller. output: none
output: none *******************************************************************/
*******************************************************************/ EXPORT void CALL GetKeys(int Control, BUTTONS * Keys);
EXPORT void CALL InitiateControllers (CONTROL_INFO * ControlInfo);
/****************************************************************** /******************************************************************
Function: ReadController Function: InitiateControllers
Purpose: To process the raw data in the pif ram that is about to Purpose: This function initialises how each of the controllers
be read. should be handled.
input: - Controller Number (0 to 3) and -1 signalling end of input: - The handle to the main window.
processing the pif ram. - A controller structure that needs to be filled for
- Pointer of data to be processed. the emulator to know how to handle each controller.
output: none output: none
note: This function is only needed if the DLL is allowing raw *******************************************************************/
data. EXPORT void CALL InitiateControllers(CONTROL_INFO * ControlInfo);
*******************************************************************/
EXPORT void CALL ReadController ( int Control, BYTE * Command );
/****************************************************************** /******************************************************************
Function: RomClosed Function: ReadController
Purpose: This function is called when a rom is closed. Purpose: To process the raw data in the pif ram that is about to
input: none be read.
output: none input: - Controller Number (0 to 3) and -1 signalling end of
*******************************************************************/ processing the pif ram.
EXPORT void CALL RomClosed (void); - Pointer of data to be processed.
output: none
note: This function is only needed if the DLL is allowing raw
data.
*******************************************************************/
EXPORT void CALL ReadController(int Control, BYTE * Command);
/****************************************************************** /******************************************************************
Function: RomOpen Function: RomClosed
Purpose: This function is called when a rom is open. (from the Purpose: This function is called when a rom is closed.
emulation thread) input: none
input: none output: none
output: none *******************************************************************/
*******************************************************************/ EXPORT void CALL RomClosed(void);
EXPORT void CALL RomOpen (void);
/****************************************************************** /******************************************************************
Function: WM_KeyDown Function: RomOpen
Purpose: To pass the WM_KeyDown message from the emulator to the Purpose: This function is called when a rom is open. (from the
plugin. emulation thread)
input: wParam and lParam of the WM_KEYDOWN message. input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL WM_KeyDown( WPARAM wParam, LPARAM lParam ); EXPORT void CALL RomOpen(void);
/****************************************************************** /******************************************************************
Function: WM_KeyUp Function: WM_KeyDown
Purpose: To pass the WM_KEYUP message from the emulator to the Purpose: To pass the WM_KeyDown message from the emulator to the
plugin. plugin.
input: wParam and lParam of the WM_KEYDOWN message. input: wParam and lParam of the WM_KEYDOWN message.
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL WM_KeyUp( WPARAM wParam, LPARAM lParam ); EXPORT void CALL WM_KeyDown(WPARAM wParam, LPARAM lParam);
/******************************************************************
Function: WM_KeyUp
Purpose: To pass the WM_KEYUP message from the emulator to the
plugin.
input: wParam and lParam of the WM_KEYDOWN message.
output: none
*******************************************************************/
EXPORT void CALL WM_KeyUp(WPARAM wParam, LPARAM lParam);
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
#endif #endif

View File

@ -1,25 +1,24 @@
/* /*
N-Rage`s Dinput8 Plugin N-Rage`s Dinput8 Plugin
(C) 2002, 2006 Norbert Wladyka (C) 2002, 2006 Norbert Wladyka
Author`s Email: norbert.wladyka@chello.at Author`s Email: norbert.wladyka@chello.at
Website: http://go.to/nrage Website: http://go.to/nrage
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify This program is distributed in the hope that it will be useful,
it under the terms of the GNU General Public License as published by but WITHOUT ANY WARRANTY; without even the implied warranty of
the free Software Foundation; either version 2 of the License, or MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(at your option) any later version. GNU General Public License for more details.
This program is distributed in the hope that it will be useful, You should have received a copy of the GNU General Public License
but WITHOUT ANY WARRANTY; without even the implied warranty of along with this program; if not, write to the free Software
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
GNU General Public License for more details. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _NRAGEPLUGIN_ #ifndef _NRAGEPLUGIN_
#define _NRAGEPLUGIN_ #define _NRAGEPLUGIN_
@ -32,9 +31,9 @@
#define TIMER_MESSAGEWINDOW 123 #define TIMER_MESSAGEWINDOW 123
// maximum number of devices other than SysMouse // maximum number of devices other than SysMouse
#define MAX_DEVICES 32 #define MAX_DEVICES 32
// maximum number of modifiers // maximum number of modifiers
#define MAX_MODIFIERS 256 #define MAX_MODIFIERS 256
#define DEFAULT_STICKRANGE 66 #define DEFAULT_STICKRANGE 66
@ -52,11 +51,9 @@
#define PAK_VOICE 4 #define PAK_VOICE 4
#define PAK_ADAPTOID 7 #define PAK_ADAPTOID 7
// just used to display text in GUI // just used to display text in GUI
#define PAK_NONRAW 16 #define PAK_NONRAW 16
typedef struct _EMULATOR_INFO typedef struct _EMULATOR_INFO
{ {
bool fInitialisedPlugin; bool fInitialisedPlugin;
@ -65,11 +62,11 @@ typedef struct _EMULATOR_INFO
LANGID Language; LANGID Language;
bool fDisplayShortPop; // do we display shortcut message popups? bool fDisplayShortPop; // do we display shortcut message popups?
// BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre // BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry, only effects header. // bswap on a dword (32 bits) boundry, only effects header.
// eg. the first 8 bytes are stored like this: // eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5 // 4 3 2 1 8 7 6 5
// BYTE * HEADER; // This is the rom header (first 40h bytes of the rom) // BYTE * HEADER; // This is the rom header (first 40h bytes of the rom)
} EMULATOR_INFO, *LPEMULATOR_INFO; } EMULATOR_INFO, *LPEMULATOR_INFO;
typedef struct _DEVICE typedef struct _DEVICE
@ -79,8 +76,9 @@ typedef struct _DEVICE
BYTE bProductCounter; BYTE bProductCounter;
GUID guidInstance; GUID guidInstance;
DWORD dwDevType; // can be DI8DEVTYPE_KEYBOARD, DI8DEVTYPE_MOUSE, etc DWORD dwDevType; // can be DI8DEVTYPE_KEYBOARD, DI8DEVTYPE_MOUSE, etc
BYTE bEffType; // What rumble effects does this device support? BYTE bEffType; // What rumble effects does this device support?
union INPUTSTATE { // the last polled data from this device union INPUTSTATE // the last polled data from this device
{
DIJOYSTATE joyState; DIJOYSTATE joyState;
DIMOUSESTATE2 mouseState; DIMOUSESTATE2 mouseState;
BYTE rgbButtons[256]; // keyboard state BYTE rgbButtons[256]; // keyboard state
@ -99,7 +97,7 @@ typedef struct _BUTTON
// Modifiers are a feature built into NRage. Emulator turbo buttons, macros, stuff like that. // Modifiers are a feature built into NRage. Emulator turbo buttons, macros, stuff like that.
typedef struct _MODIFIER typedef struct _MODIFIER
{ {
BUTTON btnButton; // button to associate with BUTTON btnButton; // button to associate with
BYTE bModType; // Type of modifier (None, Movement, Macro, Config) BYTE bModType; // Type of modifier (None, Movement, Macro, Config)
BOOL fToggle; // false if you have to hold the button down to activate, true if the modifier toggles on button press BOOL fToggle; // false if you have to hold the button down to activate, true if the modifier toggles on button press
BOOL fStatus; // if true, control defaults to ACTIVE, and deactivates on button press BOOL fStatus; // if true, control defaults to ACTIVE, and deactivates on button press
@ -112,14 +110,14 @@ typedef struct _MODIFIER
#define MDT_MACRO 2 #define MDT_MACRO 2
#define MDT_CONFIG 3 #define MDT_CONFIG 3
// buffered // buffered
#define MM_BUFF 0 #define MM_BUFF 0
// absolute // absolute
#define MM_ABS 1 #define MM_ABS 1
// deadpan // deadpan
#define MM_DEAD 2 #define MM_DEAD 2
// Number of analog axes. Standard N64 controller has just 2: X and Y joystick. // Number of analog axes. Standard N64 controller has just 2: X and Y joystick.
#define PF_AXESETS 2 #define PF_AXESETS 2
typedef struct _CONTROLLER // AN N64 CONTROLLER typedef struct _CONTROLLER // AN N64 CONTROLLER
@ -153,7 +151,7 @@ typedef struct _CONTROLLER // AN N64 CONTROLLER
BYTE bStickRange; // our "range modifier". BYTE bStickRange; // our "range modifier".
long wAxeBuffer[4]; // makes pseudo-relative Movement possible through keyboard or buttons long wAxeBuffer[4]; // makes pseudo-relative Movement possible through keyboard or buttons
// also acts as a mouse buffer // also acts as a mouse buffer
WORD wMouseSensitivityX; // set per N64 controller, that's OK WORD wMouseSensitivityX; // set per N64 controller, that's OK
WORD wMouseSensitivityY; WORD wMouseSensitivityY;
@ -165,22 +163,22 @@ typedef struct _CONTROLLER // AN N64 CONTROLLER
BYTE bRapidFireRate; BYTE bRapidFireRate;
BYTE bRapidFireCounter; BYTE bRapidFireCounter;
TCHAR szMempakFile[MAX_PATH+1]; // MemPak-FileName TCHAR szMempakFile[MAX_PATH + 1]; // MemPak-FileName
TCHAR szTransferRom[MAX_PATH+1]; // GameBoyRom-Filename TCHAR szTransferRom[MAX_PATH + 1]; // GameBoyRom-Filename
TCHAR szTransferSave[MAX_PATH+1]; // GameBoyEEPRom-Filename TCHAR szTransferSave[MAX_PATH + 1]; // GameBoyEEPRom-Filename
BUTTON aButton[14+PF_AXESETS*4]; // Ten buttons, 4 d-pad directions times two (for Config 1 and Config 2) BUTTON aButton[14 + PF_AXESETS * 4]; // Ten buttons, 4 d-pad directions times two (for Config 1 and Config 2)
MODIFIER *pModifiers; // Array of Modifiers MODIFIER *pModifiers; // Array of Modifiers
void *pPakData; // Pointer to Pak Data (specific): see PakIO.h void *pPakData; // Pointer to Pak Data (specific): see PakIO.h
// pPakData->bPakType will always be a BYTE indicating what the current pak type is // pPakData->bPakType will always be a BYTE indicating what the current pak type is
XCONTROLLER xiController; // To handle an XInput enabled controller --tecnicors XCONTROLLER xiController; // To handle an XInput enabled controller --tecnicors
} CONTROLLER, *LPCONTROLLER; } CONTROLLER, *LPCONTROLLER;
// This is the Index of WORD PROFILE.Button[X] // This is the Index of WORD PROFILE.Button[X]
// Buttons: // Buttons:
#define PF_DPADR 0 #define PF_DPADR 0
#define PF_DPADL 1 #define PF_DPADL 1
#define PF_DPADD 2 #define PF_DPADD 2
@ -188,7 +186,7 @@ typedef struct _CONTROLLER // AN N64 CONTROLLER
#define PF_START 4 #define PF_START 4
#define PF_TRIGGERZ 5 #define PF_TRIGGERZ 5
#define PF_BBUTTON 6 #define PF_BBUTTON 6
#define PF_ABUTTON 7 #define PF_ABUTTON 7
#define PF_CBUTTONR 8 #define PF_CBUTTONR 8
#define PF_CBUTTONL 9 #define PF_CBUTTONL 9
#define PF_CBUTTOND 10 #define PF_CBUTTOND 10
@ -196,52 +194,49 @@ typedef struct _CONTROLLER // AN N64 CONTROLLER
#define PF_TRIGGERR 12 #define PF_TRIGGERR 12
#define PF_TRIGGERL 13 #define PF_TRIGGERL 13
// Analog Stick // Analog Stick
// cause you can assign Buttons to it, I need 4 of 'em // cause you can assign Buttons to it, I need 4 of 'em
#define PF_APADR 14 #define PF_APADR 14
#define PF_APADL 15 #define PF_APADL 15
#define PF_APADD 16 #define PF_APADD 16
#define PF_APADU 17 #define PF_APADU 17
// second Set // second Set
// #define PF_APADR 18 // #define PF_APADR 18
// #define PF_APADL 19 // #define PF_APADL 19
// #define PF_APADD 20 // #define PF_APADD 20
// #define PF_APADU 21 // #define PF_APADU 21
// Data Format of DWORD Controller.Button: // Data Format of DWORD Controller.Button:
// //
// BYTE bBtnType : Determines the Device and general Type of Control // BYTE bBtnType : Determines the Device and general Type of Control
// BYTE bAxisID : AxeIndentifier, Tells which range of the Axe/POV is important // BYTE bAxisID : AxeIndentifier, Tells which range of the Axe/POV is important
// BYTE bOffset : Offset in the DirectInput data structure // BYTE bOffset : Offset in the DirectInput data structure
// BYTE bBtnType : Determines the Device and general Type of Control // BYTE bBtnType : Determines the Device and general Type of Control
#define DT_UNASSIGNED 0 #define DT_UNASSIGNED 0
// Joystick // Joystick
#define DT_JOYBUTTON 1 #define DT_JOYBUTTON 1
#define DT_JOYAXE 2 #define DT_JOYAXE 2
#define DT_JOYPOV 3 #define DT_JOYPOV 3
#define DT_JOYSLIDER 4 #define DT_JOYSLIDER 4
// Keyboard // Keyboard
#define DT_KEYBUTTON 5 #define DT_KEYBUTTON 5
// Mouse // Mouse
#define DT_MOUSEBUTTON 6 #define DT_MOUSEBUTTON 6
#define DT_MOUSEAXE 7 #define DT_MOUSEAXE 7
// BYTE bAxisID : AxeIndentifier, Tells which range of the Axe/POV is important // BYTE bAxisID : AxeIndentifier, Tells which range of the Axe/POV is important
// Positive Range of an Axe // Positive Range of an Axe
#define AI_AXE_P 0 #define AI_AXE_P 0
// Negative Range // Negative Range
#define AI_AXE_N 1 #define AI_AXE_N 1
// Applies to POVs obviously // Applies to POVs obviously
#define AI_POV_UP 0 #define AI_POV_UP 0
#define AI_POV_RIGHT 1 #define AI_POV_RIGHT 1
#define AI_POV_DOWN 2 #define AI_POV_DOWN 2
@ -249,12 +244,11 @@ typedef struct _CONTROLLER // AN N64 CONTROLLER
// BYTE bOffset : Offset in the DirectInput data structure // BYTE bOffset : Offset in the DirectInput data structure
typedef union _MODSPEC_MOVE typedef union _MODSPEC_MOVE
{ {
DWORD dwValue; DWORD dwValue;
struct struct
{ {
short XModification; short XModification;
short YModification; short YModification;
}; };
@ -264,36 +258,36 @@ typedef union _MODSPEC_MACRO
{ {
DWORD dwValue; DWORD dwValue;
struct struct
{ {
unsigned short aButtons; unsigned short aButtons;
unsigned short aFlags; unsigned short aFlags;
}; };
struct struct
{ {
unsigned fDigitalRight :1; unsigned fDigitalRight : 1;
unsigned fDigitalLeft :1; unsigned fDigitalLeft : 1;
unsigned fDigitalDown :1; unsigned fDigitalDown : 1;
unsigned fDigitalUp :1; unsigned fDigitalUp : 1;
unsigned fStart :1; unsigned fStart : 1;
unsigned fTriggerZ :1; unsigned fTriggerZ : 1;
unsigned fBButton :1; unsigned fBButton : 1;
unsigned fAButton :1; unsigned fAButton : 1;
unsigned fCRight :1; unsigned fCRight : 1;
unsigned fCLeft :1; unsigned fCLeft : 1;
unsigned fCDown :1; unsigned fCDown : 1;
unsigned fCUp :1; unsigned fCUp : 1;
unsigned fTriggerR :1; unsigned fTriggerR : 1;
unsigned fTriggerL :1; unsigned fTriggerL : 1;
unsigned :2; unsigned : 2;
unsigned fAnalogRight :1; unsigned fAnalogRight : 1;
unsigned fAnalogLeft :1; unsigned fAnalogLeft : 1;
unsigned fAnalogDown :1; unsigned fAnalogDown : 1;
unsigned fAnalogUp :1; unsigned fAnalogUp : 1;
unsigned fRapidFire :1; unsigned fRapidFire : 1;
unsigned fRapidFireRate :1; unsigned fRapidFireRate : 1;
unsigned fPrevFireState :1; unsigned fPrevFireState : 1;
unsigned fPrevFireState2 :1; unsigned fPrevFireState2 : 1;
}; };
} MODSPEC_MACRO, *LPMODSPEC_MACRO; } MODSPEC_MACRO, *LPMODSPEC_MACRO;
@ -301,22 +295,21 @@ typedef union _MODSPEC_CONFIG
{ {
DWORD dwValue; DWORD dwValue;
struct struct
{ {
BYTE bAnalogStick; BYTE bAnalogStick;
BYTE bMouse; BYTE bMouse;
BYTE bKeyboard; BYTE bKeyboard;
}; };
struct struct
{ {
unsigned fChangeAnalogConfig :1; unsigned fChangeAnalogConfig : 1;
unsigned fAnalogStickMode :7; unsigned fAnalogStickMode : 7;
unsigned fChangeMouseXAxis :1; unsigned fChangeMouseXAxis : 1;
unsigned fChangeMouseYAxis :1; unsigned fChangeMouseYAxis : 1;
unsigned :6; unsigned : 6;
unsigned fChangeKeyboardXAxis :1; unsigned fChangeKeyboardXAxis : 1;
unsigned fChangeKeyboardYAxis :1; unsigned fChangeKeyboardYAxis : 1;
unsigned :6; unsigned : 6;
}; };
} MODSPEC_CONFIG, *LPMODSPEC_CONFIG; } MODSPEC_CONFIG, *LPMODSPEC_CONFIG;
@ -329,8 +322,8 @@ typedef union _MODSPEC_CONFIG
#define SC_SWMEMRUMB 6 #define SC_SWMEMRUMB 6
#define SC_SWMEMADAPT 7 #define SC_SWMEMADAPT 7
// total arraysize of aButtons in SHORTCUTSPL; // total arraysize of aButtons in SHORTCUTSPL;
// make sure you update this if you change the list above // make sure you update this if you change the list above
#define SC_TOTAL 8 #define SC_TOTAL 8
typedef struct _SHORTCUTSPL typedef struct _SHORTCUTSPL
@ -357,9 +350,7 @@ typedef struct _MSHORTCUT {
int iShortcut; int iShortcut;
} MSHORTCUT, *LPMSHORTCUT; // shortcut message } MSHORTCUT, *LPMSHORTCUT; // shortcut message
#define CHECK_WHITESPACES( str ) ( str == '\r' || str == '\n' || str == '\t' ) #define CHECK_WHITESPACES( str ) ( str == '\r' || str == '\n' || str == '\t' )
extern HANDLE g_hHeap; extern HANDLE g_hHeap;
extern HMODULE g_hDirectInputDLL; extern HMODULE g_hDirectInputDLL;
@ -383,12 +374,12 @@ extern bool g_bExclusiveMouse;
extern int g_iFirstController; extern int g_iFirstController;
int WarningMessage( UINT uTextID, UINT uType ); int WarningMessage(UINT uTextID, UINT uType);
int FindDeviceinList( const TCHAR *pszProductName, BYTE bProductCounter, bool fFindSimilar ); int FindDeviceinList(const TCHAR *pszProductName, BYTE bProductCounter, bool fFindSimilar);
int FindDeviceinList( REFGUID rGUID ); int FindDeviceinList(REFGUID rGUID);
void freePakData( CONTROLLER *pcController ); void freePakData(CONTROLLER *pcController);
void freeModifiers( CONTROLLER *pcController ); void freeModifiers(CONTROLLER *pcController);
void CheckShortcuts(); void CheckShortcuts();
bool ErrorMessage( UINT uID, DWORD dwError, bool fUserChoose ); bool ErrorMessage(UINT uID, DWORD dwError, bool fUserChoose);
#endif #endif