[Nrage-input] Code cleanup
- Defined NOMINMAX macro to disable windef.h's min/max macros; they were clashing with the C++ standard library's std::min/std::max. - All uses of min/max that had ambiguous type deduction were explicitly instantiated as min<long> and max<long>. - Header includes were sorted Many thanks to DKO for the patch.
This commit is contained in:
parent
088dc17556
commit
891e43878b
|
@ -21,8 +21,9 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "commonIncludes.h"
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include "commonIncludes.h"
|
||||||
#include "FileAccess.h"
|
#include "FileAccess.h"
|
||||||
|
|
||||||
bool bDebug = true;
|
bool bDebug = true;
|
||||||
|
|
|
@ -21,16 +21,21 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <InitGuid.h>
|
#include <InitGuid.h>
|
||||||
#include "commonIncludes.h"
|
#include <CGuid.h>
|
||||||
#include <dinput.h>
|
#include <dinput.h>
|
||||||
|
|
||||||
|
#include "commonIncludes.h"
|
||||||
|
#include "DirectInput.h"
|
||||||
#include "NRagePluginV2.h"
|
#include "NRagePluginV2.h"
|
||||||
#include "PakIO.h"
|
#include "PakIO.h"
|
||||||
#include "DirectInput.h"
|
|
||||||
#include "XInputController.h"
|
#include "XInputController.h"
|
||||||
#include <math.h>
|
|
||||||
#include <CGuid.h>
|
using std::min;
|
||||||
|
using std::max;
|
||||||
|
|
||||||
// ProtoTypes //
|
// ProtoTypes //
|
||||||
HRESULT AcquireDevice( LPDIRECTINPUTDEVICE8 lpDirectInputDevice );
|
HRESULT AcquireDevice( LPDIRECTINPUTDEVICE8 lpDirectInputDevice );
|
||||||
|
@ -377,7 +382,7 @@ bool GetNControllerInput ( const int indexController, LPDWORD pdwData )
|
||||||
{
|
{
|
||||||
if( pcController->wAxeBuffer[i] < MAXAXISVALUE )
|
if( pcController->wAxeBuffer[i] < MAXAXISVALUE )
|
||||||
{
|
{
|
||||||
l_Value = pcController->wAxeBuffer[i] = min(( pcController->wAxeBuffer[i] + N64DIVIDER*3), MAXAXISVALUE );
|
l_Value = pcController->wAxeBuffer[i] = min<long>(( pcController->wAxeBuffer[i] + N64DIVIDER*3), MAXAXISVALUE );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
l_Value = MAXAXISVALUE;
|
l_Value = MAXAXISVALUE;
|
||||||
|
@ -386,7 +391,7 @@ bool GetNControllerInput ( const int indexController, LPDWORD pdwData )
|
||||||
{
|
{
|
||||||
if( pcController->wAxeBuffer[i] < MAXAXISVALUE )
|
if( pcController->wAxeBuffer[i] < MAXAXISVALUE )
|
||||||
{
|
{
|
||||||
l_Value = pcController->wAxeBuffer[i] = min(( pcController->wAxeBuffer[i] * 2 + N64DIVIDER*5 ), MAXAXISVALUE );
|
l_Value = pcController->wAxeBuffer[i] = min<long>(( pcController->wAxeBuffer[i] * 2 + N64DIVIDER*5 ), MAXAXISVALUE );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
l_Value = MAXAXISVALUE;
|
l_Value = MAXAXISVALUE;
|
||||||
|
@ -430,7 +435,7 @@ bool GetNControllerInput ( const int indexController, LPDWORD pdwData )
|
||||||
// wAxeBuffer is negative for axes 1 and 2 if buffer remains, else zero
|
// wAxeBuffer is negative for axes 1 and 2 if buffer remains, else zero
|
||||||
|
|
||||||
if(( pcController->bMouseMoveX == MM_ABS && i < 2 ) || ( pcController->bMouseMoveY == MM_ABS && i > 1 ))
|
if(( pcController->bMouseMoveX == MM_ABS && i < 2 ) || ( pcController->bMouseMoveY == MM_ABS && i > 1 ))
|
||||||
pcController->wAxeBuffer[i] = min( max( MINAXISVALUE, pcController->wAxeBuffer[i]) , MAXAXISVALUE);
|
pcController->wAxeBuffer[i] = min<long>( max<long>( MINAXISVALUE, pcController->wAxeBuffer[i]) , MAXAXISVALUE);
|
||||||
else if (( pcController->bMouseMoveX == MM_BUFF && i < 2 ) || ( pcController->bMouseMoveY == MM_BUFF && i > 1 ))
|
else if (( pcController->bMouseMoveX == MM_BUFF && i < 2 ) || ( pcController->bMouseMoveY == MM_BUFF && i > 1 ))
|
||||||
pcController->wAxeBuffer[i] = pcController->wAxeBuffer[i] * MOUSEBUFFERDECAY / 100;
|
pcController->wAxeBuffer[i] = pcController->wAxeBuffer[i] * MOUSEBUFFERDECAY / 100;
|
||||||
else // "deadpan" mouse
|
else // "deadpan" mouse
|
||||||
|
@ -542,14 +547,14 @@ bool GetNControllerInput ( const int indexController, LPDWORD pdwData )
|
||||||
double dRel = MAXAXISVALUE / dRangeDiagonal;
|
double dRel = MAXAXISVALUE / dRangeDiagonal;
|
||||||
|
|
||||||
*pdwData = MAKELONG(w_Buttons,
|
*pdwData = MAKELONG(w_Buttons,
|
||||||
MAKEWORD( (BYTE)(min( max( MINAXISVALUE, (long)(lAxisValueX * d_ModifierX * dRel )), MAXAXISVALUE) / N64DIVIDER ),
|
MAKEWORD( (BYTE)(min<long>( max<long>( MINAXISVALUE, (long)(lAxisValueX * d_ModifierX * dRel )), MAXAXISVALUE) / N64DIVIDER ),
|
||||||
(BYTE)(min( max( MINAXISVALUE, (long)(lAxisValueY * d_ModifierY * dRel )), MAXAXISVALUE) / N64DIVIDER )));
|
(BYTE)(min<long>( max<long>( MINAXISVALUE, (long)(lAxisValueY * d_ModifierY * dRel )), MAXAXISVALUE) / N64DIVIDER )));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pdwData = MAKELONG(w_Buttons,
|
*pdwData = MAKELONG(w_Buttons,
|
||||||
MAKEWORD( (BYTE)(min( max( MINAXISVALUE, (long)(lAxisValueX * d_ModifierX )), MAXAXISVALUE) / N64DIVIDER ),
|
MAKEWORD( (BYTE)(min<long>( max<long>( MINAXISVALUE, (long)(lAxisValueX * d_ModifierX )), MAXAXISVALUE) / N64DIVIDER ),
|
||||||
(BYTE)(min( max( MINAXISVALUE, (long)(lAxisValueY * d_ModifierY )), MAXAXISVALUE) / N64DIVIDER )));
|
(BYTE)(min<long>( max<long>( MINAXISVALUE, (long)(lAxisValueY * d_ModifierY )), MAXAXISVALUE) / N64DIVIDER )));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -887,7 +892,7 @@ bool CreateEffectHandle( HWND hWnd, LPDIRECTINPUTDEVICE8 lpDirectInputDevice, LP
|
||||||
|
|
||||||
if( nAxes == 0 )
|
if( nAxes == 0 )
|
||||||
return false;
|
return false;
|
||||||
nAxes = min( nAxes, 2 );
|
nAxes = min<long>( nAxes, 2 );
|
||||||
|
|
||||||
|
|
||||||
// Must be unaquired for setting stuff like Co-op Level
|
// Must be unaquired for setting stuff like Co-op Level
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <dinput.h>
|
#include <dinput.h>
|
||||||
|
|
||||||
|
#include "NRagePluginV2.h"
|
||||||
|
|
||||||
extern LPDIRECTINPUT8 g_pDIHandle;
|
extern LPDIRECTINPUT8 g_pDIHandle;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,18 +21,21 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "commonIncludes.h"
|
#include <string>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <CommDlg.h>
|
#include <CommDlg.h>
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include "commonIncludes.h"
|
||||||
|
#include "DirectInput.h"
|
||||||
|
#include "FileAccess.h"
|
||||||
|
#include "Interface.h"
|
||||||
#include "NRagePluginV2.h"
|
#include "NRagePluginV2.h"
|
||||||
#include "PakIO.h"
|
#include "PakIO.h"
|
||||||
#include "Interface.h"
|
|
||||||
#include "FileAccess.h"
|
|
||||||
#include "DirectInput.h"
|
|
||||||
#include <string>
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
#ifndef IDR_PROFILE_DEFAULT1
|
#ifndef IDR_PROFILE_DEFAULT1
|
||||||
|
|
|
@ -24,9 +24,11 @@
|
||||||
#ifndef _FILEACCESS_H_
|
#ifndef _FILEACCESS_H_
|
||||||
#define _FILEACCESS_H_
|
#define _FILEACCESS_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "NRagePluginV2.h"
|
#include "NRagePluginV2.h"
|
||||||
#include "Version.h"
|
#include "Version.h"
|
||||||
#include <string>
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
bool GetDirectory( LPTSTR pszDirectory, WORD wDirID );
|
bool GetDirectory( LPTSTR pszDirectory, WORD wDirID );
|
||||||
|
|
|
@ -10,11 +10,12 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "commonIncludes.h"
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include "commonIncludes.h"
|
||||||
|
#include "GBCart.h"
|
||||||
#include "NRagePluginV2.h"
|
#include "NRagePluginV2.h"
|
||||||
#include "PakIO.h"
|
#include "PakIO.h"
|
||||||
#include "GBCart.h"
|
|
||||||
|
|
||||||
void ClearData(BYTE *Data, int Length);
|
void ClearData(BYTE *Data, int Length);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#ifndef _GBCART_H_
|
#ifndef _GBCART_H_
|
||||||
#define _GBCART_H_
|
#define _GBCART_H_
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
typedef struct _gbCartRTC {
|
typedef struct _gbCartRTC {
|
||||||
UINT mapperSeconds;
|
UINT mapperSeconds;
|
||||||
UINT mapperMinutes;
|
UINT mapperMinutes;
|
||||||
|
|
|
@ -21,18 +21,20 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "commonIncludes.h"
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <Commctrl.h>
|
#include <Commctrl.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include "NRagePluginV2.h"
|
#include "commonIncludes.h"
|
||||||
#include "DirectInput.h"
|
#include "DirectInput.h"
|
||||||
#include "XInputController.h"
|
|
||||||
#include "FileAccess.h"
|
#include "FileAccess.h"
|
||||||
#include "PakIO.h"
|
|
||||||
#include "Interface.h"
|
#include "Interface.h"
|
||||||
#include "International.h"
|
#include "International.h"
|
||||||
|
#include "NRagePluginV2.h"
|
||||||
|
#include "PakIO.h"
|
||||||
#include "Version.h"
|
#include "Version.h"
|
||||||
|
#include "XInputController.h"
|
||||||
|
|
||||||
// Prototypes //
|
// Prototypes //
|
||||||
BOOL CALLBACK ControllerTabProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
BOOL CALLBACK ControllerTabProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||||
|
|
|
@ -23,12 +23,14 @@
|
||||||
|
|
||||||
// Internationalization routines go in this file.
|
// Internationalization routines go in this file.
|
||||||
|
|
||||||
#include "International.h"
|
|
||||||
#include <windows.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "debug.h"
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include "International.h"
|
||||||
|
#include "Debug.h"
|
||||||
|
|
||||||
LANGID GetNTDLLNativeLangID();
|
LANGID GetNTDLLNativeLangID();
|
||||||
BOOL IsHongKongVersion();
|
BOOL IsHongKongVersion();
|
||||||
|
|
|
@ -21,9 +21,10 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "settings.h"
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#ifndef _NRINTERNATIONAL_
|
#ifndef _NRINTERNATIONAL_
|
||||||
#define _NRINTERNATIONAL_
|
#define _NRINTERNATIONAL_
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,13 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "commonIncludes.h"
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <Commctrl.h>
|
#include <Commctrl.h>
|
||||||
#include <dinput.h>
|
#include <dinput.h>
|
||||||
#include <Xinput.h>
|
#include <Xinput.h>
|
||||||
|
|
||||||
|
#include "commonIncludes.h"
|
||||||
|
|
||||||
#include "NRagePluginV2.h"
|
#include "NRagePluginV2.h"
|
||||||
#include "Interface.h"
|
#include "Interface.h"
|
||||||
#include "FileAccess.h"
|
#include "FileAccess.h"
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#define _NRAGEPLUGIN_
|
#define _NRAGEPLUGIN_
|
||||||
|
|
||||||
#include <dinput.h>
|
#include <dinput.h>
|
||||||
|
|
||||||
#include "XInputController.h"
|
#include "XInputController.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -21,17 +21,23 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "commonIncludes.h"
|
#include <algorithm>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <Commctrl.h>
|
#include <Commctrl.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include "NRagePluginV2.h"
|
#include "commonIncludes.h"
|
||||||
#include "DirectInput.h"
|
#include "DirectInput.h"
|
||||||
#include "Interface.h"
|
|
||||||
#include "FileAccess.h"
|
#include "FileAccess.h"
|
||||||
#include "PakIO.h"
|
|
||||||
#include "GBCart.h"
|
#include "GBCart.h"
|
||||||
|
#include "Interface.h"
|
||||||
|
#include "NRagePluginV2.h"
|
||||||
|
#include "PakIO.h"
|
||||||
|
|
||||||
|
using std::min;
|
||||||
|
using std::max;
|
||||||
|
|
||||||
// ProtoTypes
|
// ProtoTypes
|
||||||
BYTE AddressCRC( const unsigned char * Address );
|
BYTE AddressCRC( const unsigned char * Address );
|
||||||
|
|
|
@ -170,16 +170,4 @@ typedef struct _ADAPTOIDPAK
|
||||||
bool fRumblePak;
|
bool fRumblePak;
|
||||||
} ADAPTOIDPAK, *LPADAPTOIDPAK;
|
} ADAPTOIDPAK, *LPADAPTOIDPAK;
|
||||||
|
|
||||||
/*
|
|
||||||
* <windef.h> from under <windows.h> with MSVC defines these macros.
|
|
||||||
* For some reason, they are unavailable with MinGW's copy of <windows.h>.
|
|
||||||
*/
|
|
||||||
#ifndef max
|
|
||||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef min
|
|
||||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // #ifndef _PAKIO_H_
|
#endif // #ifndef _PAKIO_H_
|
||||||
|
|
|
@ -24,11 +24,14 @@
|
||||||
#ifndef _COMMONINCLUDES_H_
|
#ifndef _COMMONINCLUDES_H_
|
||||||
#define _COMMONINCLUDES_H_
|
#define _COMMONINCLUDES_H_
|
||||||
|
|
||||||
|
/*
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#pragma warning(disable:4201)
|
#pragma warning(disable:4201)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include <tchar.h>
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue