Merge pull request #1703 from oddMLan/nrage-nrages-me

Nrage-input cleanup
This commit is contained in:
zilmar 2020-02-10 06:33:16 +10:30 committed by GitHub
commit f7ddabc9c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 10459 additions and 10444 deletions

View File

@ -1,71 +0,0 @@
@ECHO OFF
TITLE MinGW Compiler Suite Invocation
set src=%CD%\..\..\nragev20
set obj=%CD%\N-Rage
if not exist %obj% (
mkdir %obj%
)
set MinGW=C:\MinGW
REM set MinGW=C:\msys64\mingw64\x86_64-w64-mingw32\..
set FLAGS_x86=^
-I%src%\..\3rdParty\directx\include^
-Wno-write-strings^
-S^
-masm=intel^
-march=native^
-Os
set C_FLAGS=%FLAGS_x86%
cd %MinGW%\bin
set CC=%MinGW%\bin\g++.exe
set AS=%MinGW%\bin\as.exe
ECHO Compiling N-Rage plugin sources...
%CC% -o %obj%\NRagePluginV2.asm %src%\NRagePluginV2.cpp %C_FLAGS%
%CC% -o %obj%\Interface.asm %src%\Interface.cpp %C_FLAGS%
%CC% -o %obj%\FileAccess.asm %src%\FileAccess.cpp %C_FLAGS%
%CC% -o %obj%\PakIO.asm %src%\PakIO.cpp %C_FLAGS%
%CC% -o %obj%\GBCart.asm %src%\GBCart.cpp %C_FLAGS%
%CC% -o %obj%\International.asm %src%\International.cpp %C_FLAGS%
%CC% -o %obj%\DirectInput.asm %src%\DirectInput.cpp %C_FLAGS%
%CC% -o %obj%\XInputController.asm %src%\XInputController.cpp %C_FLAGS%
ECHO Assembling N-Rage sources...
%AS% -o %obj%\NRagePluginV2.o %obj%\NRagePluginV2.asm
%AS% -o %obj%\Interface.o %obj%\Interface.asm
%AS% -o %obj%\FileAccess.o %obj%\FileAccess.asm
%AS% -o %obj%\PakIO.o %obj%\PakIO.asm
%AS% -o %obj%\GBCart.o %obj%\GBCart.asm
%AS% -o %obj%\International.o %obj%\International.asm
%AS% -o %obj%\DirectInput.o %obj%\DirectInput.asm
%AS% -o %obj%\XInputController.o %obj%\XInputController.asm
ECHO.
set OBJ_LIST=^
%obj%\XInputController.o^
%obj%\DirectInput.o^
%obj%\International.o^
%obj%\GBCart.o^
%obj%\PakIO.o^
%obj%\FileAccess.o^
%obj%\Interface.o^
%obj%\NRagePluginV2.o^
-ldinput8^
-loleaut32^
-lole32^
-luuid^
-lcomctl32^
-mwindows^
-lcomdlg32^
-lgdi32^
%obj%\NRagePluginV2.res
ECHO Linking N-Rage objects...
%MinGW%\bin\windres.exe -o %obj%\NRagePluginV2.res -i %src%\NRagePluginV2.rc -O coff
%MinGW%\bin\g++.exe -o %obj%\PJ64_NRage.dll %OBJ_LIST% -shared -shared-libgcc
PAUSE

View File

@ -21,8 +21,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "commonIncludes.h"
#include <windows.h>
#include "commonIncludes.h"
#include "FileAccess.h"
bool bDebug = true;

View File

@ -21,16 +21,21 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <algorithm>
#include <math.h>
#include <InitGuid.h>
#include "commonIncludes.h"
#include <CGuid.h>
#include <dinput.h>
#include "commonIncludes.h"
#include "DirectInput.h"
#include "NRagePluginV2.h"
#include "PakIO.h"
#include "DirectInput.h"
#include "XInputController.h"
#include <math.h>
#include <CGuid.h>
using std::min;
using std::max;
// ProtoTypes //
HRESULT AcquireDevice( LPDIRECTINPUTDEVICE8 lpDirectInputDevice );
@ -377,7 +382,7 @@ bool GetNControllerInput ( const int indexController, LPDWORD pdwData )
{
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
l_Value = MAXAXISVALUE;
@ -386,7 +391,7 @@ bool GetNControllerInput ( const int indexController, LPDWORD pdwData )
{
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
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
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 ))
pcController->wAxeBuffer[i] = pcController->wAxeBuffer[i] * MOUSEBUFFERDECAY / 100;
else // "deadpan" mouse
@ -542,14 +547,14 @@ bool GetNControllerInput ( const int indexController, LPDWORD pdwData )
double dRel = MAXAXISVALUE / dRangeDiagonal;
*pdwData = MAKELONG(w_Buttons,
MAKEWORD( (BYTE)(min( max( MINAXISVALUE, (long)(lAxisValueX * d_ModifierX * dRel )), MAXAXISVALUE) / N64DIVIDER ),
(BYTE)(min( max( MINAXISVALUE, (long)(lAxisValueY * d_ModifierY * dRel )), MAXAXISVALUE) / N64DIVIDER )));
MAKEWORD( (BYTE)(min<long>( max<long>( MINAXISVALUE, (long)(lAxisValueX * d_ModifierX * dRel )), MAXAXISVALUE) / N64DIVIDER ),
(BYTE)(min<long>( max<long>( MINAXISVALUE, (long)(lAxisValueY * d_ModifierY * dRel )), MAXAXISVALUE) / N64DIVIDER )));
}
else
{
*pdwData = MAKELONG(w_Buttons,
MAKEWORD( (BYTE)(min( max( MINAXISVALUE, (long)(lAxisValueX * d_ModifierX )), MAXAXISVALUE) / N64DIVIDER ),
(BYTE)(min( max( MINAXISVALUE, (long)(lAxisValueY * d_ModifierY )), MAXAXISVALUE) / N64DIVIDER )));
MAKEWORD( (BYTE)(min<long>( max<long>( MINAXISVALUE, (long)(lAxisValueX * d_ModifierX )), MAXAXISVALUE) / N64DIVIDER ),
(BYTE)(min<long>( max<long>( MINAXISVALUE, (long)(lAxisValueY * d_ModifierY )), MAXAXISVALUE) / N64DIVIDER )));
}
return true;
@ -887,7 +892,7 @@ bool CreateEffectHandle( HWND hWnd, LPDIRECTINPUTDEVICE8 lpDirectInputDevice, LP
if( nAxes == 0 )
return false;
nAxes = min( nAxes, 2 );
nAxes = min<long>( nAxes, 2 );
// Must be unaquired for setting stuff like Co-op Level

View File

@ -26,6 +26,8 @@
#include <dinput.h>
#include "NRagePluginV2.h"
extern LPDIRECTINPUT8 g_pDIHandle;

View File

@ -21,18 +21,21 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "commonIncludes.h"
#include <string>
#include <stdio.h>
#include <windows.h>
#include <CommDlg.h>
#include <tchar.h>
#include <stdio.h>
#include <shlobj.h>
#include <tchar.h>
#include "commonIncludes.h"
#include "DirectInput.h"
#include "FileAccess.h"
#include "Interface.h"
#include "NRagePluginV2.h"
#include "PakIO.h"
#include "Interface.h"
#include "FileAccess.h"
#include "DirectInput.h"
#include <string>
using std::string;
#ifndef IDR_PROFILE_DEFAULT1

View File

@ -24,9 +24,11 @@
#ifndef _FILEACCESS_H_
#define _FILEACCESS_H_
#include <string>
#include "NRagePluginV2.h"
#include "Version.h"
#include <string>
using std::string;
bool GetDirectory( LPTSTR pszDirectory, WORD wDirID );

View File

@ -10,11 +10,12 @@
**
*/
#include "commonIncludes.h"
#include <windows.h>
#include "commonIncludes.h"
#include "GBCart.h"
#include "NRagePluginV2.h"
#include "PakIO.h"
#include "GBCart.h"
void ClearData(BYTE *Data, int Length);

View File

@ -1,9 +1,10 @@
#ifndef _GBCART_H_
#define _GBCART_H_
#include <windows.h>
#include <time.h>
#include <windows.h>
typedef struct _gbCartRTC {
UINT mapperSeconds;
UINT mapperMinutes;

View File

@ -21,18 +21,20 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "commonIncludes.h"
#include <stdio.h>
#include <windows.h>
#include <Commctrl.h>
#include <stdio.h>
#include "NRagePluginV2.h"
#include "commonIncludes.h"
#include "DirectInput.h"
#include "XInputController.h"
#include "FileAccess.h"
#include "PakIO.h"
#include "Interface.h"
#include "International.h"
#include "NRagePluginV2.h"
#include "PakIO.h"
#include "Version.h"
#include "XInputController.h"
// Prototypes //
BOOL CALLBACK ControllerTabProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );

View File

@ -23,12 +23,14 @@
// Internationalization routines go in this file.
#include "International.h"
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include "debug.h"
#include <windows.h>
#include <tchar.h>
#include "International.h"
#include "Debug.h"
LANGID GetNTDLLNativeLangID();
BOOL IsHongKongVersion();

View File

@ -21,9 +21,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "settings.h"
#include <windows.h>
#include "settings.h"
#ifndef _NRINTERNATIONAL_
#define _NRINTERNATIONAL_

66
Source/nragev20/Makefile Normal file
View File

@ -0,0 +1,66 @@
CXX := g++
LD := g++
WINDRES := windres
OBJECTS := \
Debug.o \
DirectInput.o \
FileAccess.o \
GBCart.o \
Interface.o \
International.o \
NRagePluginV2.o \
PakIO.o \
XInputController.o
RESOURCE := NRagePluginV2.res
TARGET := PJ64_NRage.dll
CPPFLAGS := \
-DNOMINMAX
CXXFLAGS := \
-shared \
-fPIC \
-Os \
-Wno-write-strings
LIBS := \
-lcomctl32 \
-lcomdlg32 \
-ldinput8 \
-lgdi32 \
-lole32 \
-loleaut32 \
-luuid \
-static -lwinpthread
LDFLAGS := \
-mwindows \
-static-libgcc \
-static-libstdc++
DEPFILES := $(addprefix .deps/,$(OBJECTS:.o=.d))
.PHONY: all clean
all: .deps $(TARGET)
-include $(DEPFILES)
clean:
rm -f $(TARGET) $(OBJECTS) $(RESOURCE) $(DEPFILES)
rm -rf .deps
.deps:
mkdir -p $@
%.res: %.rc
$(WINDRES) -O coff -o $@ -i $<
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MP -MF .deps/$(@:.o=.d) -o $@ -c $<
$(TARGET): $(OBJECTS) $(RESOURCE)
$(LD) $(CXXFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@

View File

@ -21,11 +21,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "commonIncludes.h"
#include <windows.h>
#include <Commctrl.h>
#include <dinput.h>
#include <Xinput.h>
#include "commonIncludes.h"
#include "NRagePluginV2.h"
#include "Interface.h"
#include "FileAccess.h"

View File

@ -24,6 +24,7 @@
#define _NRAGEPLUGIN_
#include <dinput.h>
#include "XInputController.h"
/////////////////////////////////////////////////////////////////////////////////

View File

@ -21,17 +21,23 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "commonIncludes.h"
#include <algorithm>
#include <stdio.h>
#include <windows.h>
#include <Commctrl.h>
#include <tchar.h>
#include <stdio.h>
#include "NRagePluginV2.h"
#include "commonIncludes.h"
#include "DirectInput.h"
#include "Interface.h"
#include "FileAccess.h"
#include "PakIO.h"
#include "GBCart.h"
#include "Interface.h"
#include "NRagePluginV2.h"
#include "PakIO.h"
using std::min;
using std::max;
// ProtoTypes
BYTE AddressCRC( const unsigned char * Address );

View File

@ -170,16 +170,4 @@ typedef struct _ADAPTOIDPAK
bool fRumblePak;
} 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_

View File

@ -24,11 +24,14 @@
#ifndef _COMMONINCLUDES_H_
#define _COMMONINCLUDES_H_
/*
#undef WIN32_LEAN_AND_MEAN
#pragma warning(disable:4201)
*/
#include <tchar.h>
#include "settings.h"
#include <tchar.h>
#include "resource.h"
#include "Debug.h"