Index: Build.bat
===================================================================
--- Build.bat (revision 0)
+++ Build.bat (revision 0)
@@ -0,0 +1,3 @@
+@echo off
+windres -o res.o NRageP~1.rc
+gcc -shared -w -o NRageBeta.dll res.o NRagePluginV2.cpp International.cpp PakIO.cpp FileAccess.cpp Interface.cpp GBCart.cpp DirectInput.cpp Debug.cpp -lstdc++ -ldinput8 -lcomctl32 -lcomdlg32 -ldxguid 2>err.log
\ No newline at end of file
Index: Debug.cpp
===================================================================
--- Debug.cpp (revision 33)
+++ Debug.cpp (working copy)
@@ -154,4 +154,4 @@
{
FlushFileBuffers(hDebug);
}
-}
\ No newline at end of file
+}
Index: Debug.h
===================================================================
--- Debug.h (revision 33)
+++ Debug.h (working copy)
@@ -62,4 +62,4 @@
#define DebugWrite DebugWriteA
#endif
-#endif // #ifndef _DEBUG_H_
\ No newline at end of file
+#endif // #ifndef _DEBUG_H_
Index: DirectInput.cpp
===================================================================
--- DirectInput.cpp (revision 33)
+++ DirectInput.cpp (working copy)
@@ -561,7 +561,15 @@
{
HRESULT (WINAPI *lpGetDIHandle)( HINSTANCE, DWORD, REFIID, LPVOID*, LPUNKNOWN ) = NULL;
lpGetDIHandle = (HRESULT (WINAPI *)( HINSTANCE, DWORD, REFIID, LPVOID*, LPUNKNOWN ))GetProcAddress( g_hDirectInputDLL, "DirectInput8Create" );
-
+ if(g_strEmuInfo.hinst==NULL)
+ {
+ DllMain(GetModuleHandle("NRageBeta.dll"),DLL_PROCESS_ATTACH,0);
+ }
+ if(g_strEmuInfo.hinst/*still*/==NULL)
+ {
+ DllMain(GetModuleHandle(NULL),DLL_PROCESS_DETACH,0);
+ DllMain(GetModuleHandle(NULL),DLL_PROCESS_ATTACH,0);
+ }
if( lpGetDIHandle != NULL )
{
HRESULT hr;
@@ -1038,7 +1046,7 @@
}
ReleaseEffect( g_apdiEffect[i] );
- if( g_pcControllers[i].guidFFDevice != GUID_NULL && GetInputDevice( g_strEmuInfo.hMainWindow, g_apFFDevice[i], g_pcControllers[i].guidFFDevice, DI8DEVTYPE_JOYSTICK, DIB_FF )) // not necessarily a joystick type device, but we don't use the data anyway
+ if( g_pcControllers[i].guidFFDevice != guidnull && GetInputDevice( g_strEmuInfo.hMainWindow, g_apFFDevice[i], g_pcControllers[i].guidFFDevice, DI8DEVTYPE_JOYSTICK, DIB_FF )) // not necessarily a joystick type device, but we don't use the data anyway
{
DIDEVICEINSTANCE diDev;
diDev.dwSize = sizeof( DIDEVICEINSTANCE );
@@ -1283,4 +1291,4 @@
default:
return false;
}
-}
\ No newline at end of file
+}
Index: DirectInput.h
===================================================================
--- DirectInput.h (revision 33)
+++ DirectInput.h (working copy)
@@ -153,4 +153,4 @@
}
-#endif // #ifndef _DIRECTINPUT_H_
\ No newline at end of file
+#endif // #ifndef _DIRECTINPUT_H_
Index: FileAccess.cpp
===================================================================
--- FileAccess.cpp (revision 33)
+++ FileAccess.cpp (working copy)
@@ -1,4 +1,4 @@
- /*
+/*
N-Rage`s Dinput8 Plugin
(C) 2002, 2006 Norbert Wladyka
@@ -192,7 +192,7 @@
{
case PL_RESET:
ZeroMemory( pszDeviceName, sizeof(pszDeviceName) );
- gGUID = GUID_NULL;
+ gGUID = guidnull;
bDeviceNr = 0;
break;
@@ -314,6 +314,10 @@
if (pController)
pController->fVisualRumble = atoi(pszLine);
break;
+ case CHK_GLOVEPIERUMBLE:
+ if (pController)
+ pController->fGPieRumble = atoi(pszLine);
+ break;
case CHK_FFDEVICEGUID:
if (pController)
{
@@ -330,7 +334,7 @@
}
else
{
- pController->guidFFDevice = GUID_NULL;
+ pController->guidFFDevice = guidnull;
return false;
}
}
@@ -373,12 +377,12 @@
break;
case CHK_DINPUTNAME:
- gGUID = GUID_NULL; // invalidate current GUID
+ gGUID = guidnull; // invalidate current GUID
CHAR_TO_TCHAR( pszDeviceName, pszLine, MAX_PATH );
break;
case CHK_DINPUTNR:
- gGUID = GUID_NULL; // invalidate current GUID
+ gGUID = guidnull; // invalidate current GUID
if( iLength >= sizeof(BYTE) )
{
TexttoHexA( pszLine, &bDeviceNr, sizeof(BYTE) );
@@ -389,7 +393,7 @@
return true;
else
{
- gGUID = GUID_NULL; // invalidate current GUID
+ gGUID = guidnull; // invalidate current GUID
return false;
}
break;
@@ -453,7 +457,7 @@
else
{
DebugWrite(_T("ProcessKey: couldn't find a device in g_devList for %s %d\n"), pszDeviceName, bDeviceNr);
- gGUID = GUID_NULL;
+ gGUID = guidnull;
btnWorking.parentDevice = NULL;
}
}
@@ -464,7 +468,7 @@
// bounds check on controlnum and buttonID
if ( (controlnum == -1 && buttonID != 0) && ((controlnum < 0) || (controlnum > 3) || (buttonID < 0) || (buttonID >= SC_TOTAL)) )
{
- gGUID = GUID_NULL; // since we may have cached an invalid GUID, invalidate it
+ gGUID = guidnull; // since we may have cached an invalid GUID, invalidate it
return false;
}
@@ -485,7 +489,7 @@
// bounds check on controlnum and buttonID
if ( (controlnum < 0) || (controlnum > 3) || (buttonID < 0) || (buttonID >= ARRAYSIZE(g_pcControllers[0].aButton)) )
{
- gGUID = GUID_NULL; // since we may have cached an invalid GUID, invalidate it
+ gGUID = guidnull; // since we may have cached an invalid GUID, invalidate it
return false;
}
@@ -555,7 +559,7 @@
}
else
{
- gGUID = GUID_NULL;
+ gGUID = guidnull;
modWorking.btnButton.parentDevice = NULL;
}
}
@@ -564,7 +568,7 @@
// bounds check on controlnum and buttonID
if ( (controlnum < 0) || (controlnum > 3) )
{
- gGUID = GUID_NULL; // since we may have cached an invalid GUID, invalidate it
+ gGUID = guidnull; // since we may have cached an invalid GUID, invalidate it
return false;
}
@@ -598,7 +602,6 @@
}
break;
-
}
return bReturn;
@@ -1487,6 +1490,7 @@
fprintf(fFile, STRING_INI_RUMBLETYPE "=%u\n", g_ivConfig->Controllers[i].bRumbleTyp);
fprintf(fFile, STRING_INI_RUMBLESTRENGTH "=%u\n", g_ivConfig->Controllers[i].bRumbleStrength);
fprintf(fFile, STRING_INI_VISUALRUMBLE "=%u\n", g_ivConfig->Controllers[i].fVisualRumble);
+ fprintf(fFile, STRING_INI_GLOVEPIERUMBLE "=%u\n", g_ivConfig->Controllers[i].fGPieRumble);
if (bIsINI)
{
@@ -1548,7 +1552,7 @@
if (bIsINI)
{
char szGUID[DEFAULT_BUFFER];
- GUIDtoStringA(szGUID, GUID_NULL);
+ GUIDtoStringA(szGUID, guidnull);
fprintf(fFile, STRING_INI_DINPUTGUID "=%s\n", szGUID);
}
else
@@ -1671,4 +1675,4 @@
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
-}
\ No newline at end of file
+}
Index: FileAccess.h
===================================================================
--- FileAccess.h (revision 33)
+++ FileAccess.h (working copy)
@@ -101,6 +101,7 @@
#define STRING_INI_RUMBLETYPE "RumbleType"
#define STRING_INI_RUMBLESTRENGTH "RumbleStrength"
#define STRING_INI_VISUALRUMBLE "VisualRumble"
+#define STRING_INI_GLOVEPIERUMBLE "GlovePieRumble"
#define STRING_INI_FFDEVICEGUID "FFDeviceGUID"
#define STRING_INI_MEMPAKFILE "MemPakFile"
#define STRING_INI_GBROMFILE "GBRomFile"
@@ -168,6 +169,7 @@
#define CHK_RUMBLETYPE 3440038446
#define CHK_RUMBLESTRENGTH 3038086267
#define CHK_VISUALRUMBLE 1795686016
+#define CHK_GLOVEPIERUMBLE 0x55148147
#define CHK_FFDEVICEGUID 2645316746
#define CHK_MEMPAKFILE 2373591360
#define CHK_GBROMFILE 2409678172
@@ -222,4 +224,4 @@
// 32 hex characters, 4 hyphens, 2 end braces
#define GUID_STRINGLENGTH 32+4+2
-#endif // #ifndef _FILEACCESS_H_
\ No newline at end of file
+#endif // #ifndef _FILEACCESS_H_
Index: Interface.cpp
===================================================================
--- Interface.cpp (revision 33)
+++ Interface.cpp (working copy)
@@ -1715,7 +1715,7 @@
case WM_INITDIALOG:
hPakWindow = NULL;
bAdaptoidInList = false;
- bCurrentPak = -1;
+ bCurrentPak = (BYTE)-1;
// DropDown-List;
hDlgItem = GetDlgItem( hDlg, IDC_PAKTYPE );
@@ -2165,7 +2165,7 @@
j = -1;
if( !( pszMemPakFile[1] == ':' || ( pszMemPakFile[1] == '\\' && pszMemPakFile[0] == '\\' )) )
{
- i = SendMessage( hDlgItem, LB_FINDSTRINGEXACT, -1, (LPARAM)pszMemPakFile );
+ i = SendMessage( hDlgItem, LB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)pszMemPakFile );
if( i != LB_ERR )
j = i;
}
@@ -2381,6 +2381,10 @@
case IDC_VISUALRUMBLE:
pcController->fVisualRumble = ( IsDlgButtonChecked( hDlg, LOWORD(wParam) ) == BST_CHECKED );
return TRUE;
+
+ case IDC_GLOVEPIERUMBLE:
+ pcController->fGPieRumble = ( IsDlgButtonChecked( hDlg, LOWORD(wParam) ) == BST_CHECKED );
+ return TRUE;
case IDC_RUMBLETEST:
if ( !g_pConfigEffect || bNewRumbleTyp )
@@ -2506,11 +2510,11 @@
// DropDownList
if( g_devList[j].bProductCounter == 0 )
- i = SendMessage( hDlgItem, CB_FINDSTRINGEXACT, -1, (LPARAM)g_devList[j].szProductName );
+ i = SendMessage( hDlgItem, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)g_devList[j].szProductName );
else
{
wsprintf( szBuffer, _T("%s %i"), g_devList[j].szProductName, g_devList[j].bProductCounter );
- i = SendMessage( hDlgItem, CB_FINDSTRINGEXACT, -1, (LPARAM)szBuffer ); // search index of Device-String
+ i = SendMessage( hDlgItem, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)szBuffer ); // search index of Device-String
}
SendMessage( hDlgItem, CB_SETCURSEL, i, 0 ); // select the right string
@@ -2569,6 +2573,7 @@
CheckDlgButton( hDlg, IDC_RUMBLE3, BST_UNCHECKED );
CheckDlgButton( hDlg, IDC_VISUALRUMBLE, pcController->fVisualRumble ? BST_CHECKED : BST_UNCHECKED );
+ CheckDlgButton( hDlg, IDC_GLOVEPIERUMBLE, pcController->fGPieRumble ? BST_CHECKED : BST_UNCHECKED );
// TrackBars
SendMessage( GetDlgItem( hDlg, IDC_RUMBLESTRENGTH ), TBM_SETPOS, TRUE, pcController->bRumbleStrength );
@@ -2888,7 +2893,7 @@
}
DWORD aIDs[3];
- aIDs[2] = -1;
+ aIDs[2] = (DWORD)-1;
if( GetButtonID( aIDs, 2, BSET_SHORTCUTS ) )
{
GetButtonText( g_ivConfig->Shortcuts.bMouseLock, szBuffer );
@@ -3863,7 +3868,7 @@
}
else
{
- g_pcControllers[i].guidFFDevice = GUID_NULL;
+ g_pcControllers[i].guidFFDevice = guidnull;
}
@@ -3949,4 +3954,4 @@
// Show the window (necessary to block input)
ShowWindow(hwnd, SW_SHOWNOACTIVATE);
return hwnd;
-}
\ No newline at end of file
+}
Index: Interface.h
===================================================================
--- Interface.h (revision 33)
+++ Interface.h (working copy)
@@ -90,4 +90,4 @@
extern INTERFACEVALUES *g_ivConfig;
-#endif // _NRINTERFACE_
\ No newline at end of file
+#endif // _NRINTERFACE_
Index: International.cpp
===================================================================
--- International.cpp (revision 33)
+++ International.cpp (working copy)
@@ -114,7 +114,7 @@
if (hMod) {
pImmReleaseContext = (IMMRELEASECONTEXT)GetProcAddress(hMod,"ImmReleaseContext");
if (pImmReleaseContext) {
- bRet = pImmReleaseContext(NULL,NULL);
+ bRet = pImmReleaseContext(NULL,0);
}
FreeLibrary(hMod);
}
Index: NRagePluginV2.cpp
===================================================================
--- NRagePluginV2.cpp (revision 33)
+++ NRagePluginV2.cpp (working copy)
@@ -64,6 +64,7 @@
SHORTCUTS g_scShortcuts;
LPDIRECTINPUTDEVICE8 g_apFFDevice[4] = { NULL, NULL, NULL, NULL }; // added by rabid
LPDIRECTINPUTEFFECT g_apdiEffect[4] = { NULL, NULL, NULL, NULL }; // array of handles for FF-Effects, one for each controller
+GUID guidnull={0,0,0,{0,0,0,0,0,0,0,0}};
BOOL APIENTRY DllMain( HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
@@ -384,7 +385,7 @@
}
else // we couldn't find the device specified in the INI file, or it was already null
{
- g_pcControllers[i].guidFFDevice = GUID_NULL;
+ g_pcControllers[i].guidFFDevice = guidnull;
DebugWriteA("no rumble device/effect type set, ");
}
@@ -822,7 +823,7 @@
// After enumerating DirectInput devices into g_devList, find a device by GUID. Finding similar devices is impossible.
int FindDeviceinList( REFGUID rGUID )
{
- if (rGUID == GUID_NULL )
+ if (rGUID == guidnull )
return -1;
int i = 0;
while( i < ARRAYSIZE(g_devList) )
@@ -1172,4 +1173,4 @@
LoadString( g_hResourceDLL, IDS_DLG_WARN_TITLE, tszTitle, DEFAULT_BUFFER );
return MessageBox( g_strEmuInfo.hMainWindow, tszText, tszTitle, uType );
-}
\ No newline at end of file
+}
Index: NRagePluginV2.h
===================================================================
--- NRagePluginV2.h (revision 33)
+++ NRagePluginV2.h (working copy)
@@ -144,6 +144,7 @@
unsigned fPakCRCError; // The ROM sends CRC data when it tries to write to a mempak. Is the CRC incorrect? Usually indicates a bad ROM.
unsigned PakType; // what type of controller pak? mempak? rumble? transfer? etc
unsigned fVisualRumble; // is visual rumble enabled for this controller?
+ unsigned fGPieRumble; //Is GlovePie rumble enabled? (moves mouse to (1,0) and (0,0), use with mouse.cursorposX==1 and mouse.cursorposy==0)
BYTE bRumbleTyp; // what type of rumble effect? none, constant, ramp, or direct?
@@ -366,11 +367,13 @@
extern LPDIRECTINPUTDEVICE8 g_apFFDevice[4];
extern LPDIRECTINPUTEFFECT g_apdiEffect[4];
extern CRITICAL_SECTION g_critical;
+extern GUID guidnull;
extern bool g_bRunning;
extern bool g_bConfiguring;
extern bool g_bExclusiveMouse;
+extern BOOL APIENTRY DllMain( HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved );
extern int g_iFirstController;
@@ -382,4 +385,4 @@
void CheckShortcuts();
bool ErrorMessage( UINT uID, DWORD dwError, bool fUserChoose );
-#endif
\ No newline at end of file
+#endif
Index: NRagePluginV2.rc
===================================================================
--- NRagePluginV2.rc (revision 33)
+++ NRagePluginV2.rc (working copy)
@@ -623,6 +623,8 @@
29,82,61,10
CONTROL "Visual Rumble",IDC_VISUALRUMBLE,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,99,58,61,10
+ CONTROL "GlovePie-compatible Rumble",IDC_GLOVEPIERUMBLE,"Button",
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,99,70,120,10
CTEXT "Rumble Strength PLACEHOLDER",IDT_RUMBLESTRENGTH,29,100,
127,8,NOT WS_GROUP
CONTROL "",IDC_RUMBLESTRENGTH,"msctls_trackbar32",TBS_AUTOTICKS |
Index: PakIO.cpp
===================================================================
--- PakIO.cpp (revision 33)
+++ PakIO.cpp (working copy)
@@ -38,6 +38,8 @@
BYTE DataCRC( LPCBYTE Data, const int iLength );
VOID CALLBACK WritebackProc( HWND hWnd, UINT msg, UINT_PTR idEvent, DWORD dwTime );
+#define min(x,y) ((x<y)?x:y)
+
bool InitControllerPak( const int iControl )
// Prepares the Pak
{
@@ -495,6 +497,8 @@
{
if( g_pcControllers[iControl].fVisualRumble )
FlashWindow( g_strEmuInfo.hMainWindow, ( *Data != 0 ) ? TRUE : FALSE );
+ if( g_pcControllers[iControl].fGPieRumble ) //Oh, the haxx0redness
+ SetCursorPos(*Data!=0,0);
if( g_pcControllers[iControl].bRumbleTyp == RUMBLE_DIRECT )
{ // Adaptoid Direct Rumble
if( g_pcControllers[iControl].fIsAdaptoid )
@@ -1480,4 +1484,4 @@
}
return;
}
-}
\ No newline at end of file
+}
Index: PakIO.h
===================================================================
--- PakIO.h (revision 33)
+++ PakIO.h (working copy)
@@ -170,4 +170,4 @@
bool fRumblePak;
} ADAPTOIDPAK, *LPADAPTOIDPAK;
-#endif // #ifndef _PAKIO_H_
\ No newline at end of file
+#endif // #ifndef _PAKIO_H_
Index: resource.h
===================================================================
--- resource.h (revision 33)
+++ resource.h (working copy)
@@ -299,6 +299,7 @@
#define IDC_FORMATMEMPAK 1128
#define IDC_SAVENOTE 1129
#define IDC_VISUALRUMBLE 1129
+#define IDC_GLOVEPIERUMBLE 2229
#define IDC_SETMEMPAK_P3 1130
#define IDC_INSERTNOTE 1130
#define IDC_STATE 1130
Index: settings.h
===================================================================
--- settings.h (revision 33)
+++ settings.h (working copy)
@@ -136,4 +136,4 @@
#define VERSIONINFO _T(VERSIONNUMBER)
#endif // #ifdef _DEBUG
-#endif // #ifndef _SETTINGS_H_
\ No newline at end of file
+#endif // #ifndef _SETTINGS_H_