diff --git a/Source/nragev20/FileAccess.cpp b/Source/nragev20/FileAccess.cpp index 4a3665744..ef9dbdd2c 100644 --- a/Source/nragev20/FileAccess.cpp +++ b/Source/nragev20/FileAccess.cpp @@ -257,6 +257,10 @@ bool ProcessKey( DWORD dwKey, DWORD dwSection, LPCSTR pszLine, LPTSTR pszFFDevic if (pController) pController->fN64Mouse = atoi(pszLine); break; + case CHK_BACKGROUNDINPUT: + if (pController) + pController->bBackgroundInput = atoi(pszLine); + break; case CHK_PAKTYPE: if (pController) pController->PakType = atoi(pszLine); @@ -1490,6 +1494,7 @@ void DumpControllerSettings(FILE * fFile, int i, bool bIsINI) fprintf(fFile, STRING_INI_PLUGGED "=%u\n", g_ivConfig->Controllers[i].fPlugged); fprintf(fFile, STRING_INI_XINPUT "=%u\n", g_ivConfig->Controllers[i].fXInput); fprintf(fFile, STRING_INI_N64MOUSE "=%u\n", g_ivConfig->Controllers[i].fN64Mouse); + fprintf(fFile, STRING_INI_BACKGROUNDINPUT "=%u\n", g_ivConfig->Controllers[i].bBackgroundInput); fprintf(fFile, STRING_INI_RAWDATA "=%u\n", g_ivConfig->Controllers[i].fRawData); fprintf(fFile, STRING_INI_PAKTYPE "=%u\n", g_ivConfig->Controllers[i].PakType); fprintf(fFile, STRING_INI_REALN64RANGE "=%u\n", g_ivConfig->Controllers[i].fRealN64Range); diff --git a/Source/nragev20/FileAccess.h b/Source/nragev20/FileAccess.h index c9a2f4df6..e9159ebc9 100644 --- a/Source/nragev20/FileAccess.h +++ b/Source/nragev20/FileAccess.h @@ -87,6 +87,7 @@ unsigned long djbHash(const char *str); #define STRING_INI_PLUGGED "Plugged" #define STRING_INI_XINPUT "xInput" #define STRING_INI_N64MOUSE "N64Mouse" +#define STRING_INI_BACKGROUNDINPUT "BackgroundInput" #define STRING_INI_RAWDATA "RawData" #define STRING_INI_PAKTYPE "PakType" #define STRING_INI_REALN64RANGE "RealN64Range" @@ -156,6 +157,7 @@ unsigned long djbHash(const char *str); #define CHK_PLUGGED 3378836077UL #define CHK_XINPUT 3665436173UL #define CHK_N64MOUSE 863329606UL +#define CHK_BACKGROUNDINPUT 2660742997UL #define CHK_RAWDATA 1238573385UL #define CHK_PAKTYPE 2936974691UL #define CHK_REALN64RANGE 1279831790UL diff --git a/Source/nragev20/Interface.cpp b/Source/nragev20/Interface.cpp index 407516fb9..2ac93f68e 100644 --- a/Source/nragev20/Interface.cpp +++ b/Source/nragev20/Interface.cpp @@ -552,6 +552,10 @@ BOOL CALLBACK ControllerTabProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa pcController->fN64Mouse = (IsDlgButtonChecked(hDlg, LOWORD(wParam)) == BST_CHECKED); return TRUE; + case IDC_BACKGROUNDINPUT: + pcController->bBackgroundInput = (IsDlgButtonChecked(hDlg, LOWORD(wParam)) == BST_CHECKED); + return TRUE; + default: return FALSE; } @@ -561,6 +565,7 @@ BOOL CALLBACK ControllerTabProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa CheckDlgButton( hDlg, IDC_PLUGGED, pcController->fPlugged ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton( hDlg, IDC_XINPUT_ENABLER, pcController->fXInput ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton( hDlg, IDC_N64MOUSE, pcController->fN64Mouse ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton( hDlg, IDC_BACKGROUNDINPUT, pcController->bBackgroundInput ? BST_CHECKED : BST_UNCHECKED); if( hTabControl ) DestroyWindow( hTabControl ); diff --git a/Source/nragev20/NRagePluginV2.cpp b/Source/nragev20/NRagePluginV2.cpp index eb002796b..b01de8fd7 100644 --- a/Source/nragev20/NRagePluginV2.cpp +++ b/Source/nragev20/NRagePluginV2.cpp @@ -539,7 +539,14 @@ EXPORT void CALL GetKeys(int Control, BUTTONS * Keys ) #ifdef ENABLE_RAWPAK_DEBUG DebugWriteA("CALLED: GetKeys\n"); #endif - if( g_bConfiguring || GetForegroundWindow() != g_strEmuInfo.hMainWindow) + + if( !g_pcControllers[Control].bBackgroundInput && GetForegroundWindow() != g_strEmuInfo.hMainWindow ) + { + // cancel if main window isn't focused and background input is disabled + return; + } + + if( g_bConfiguring ) Keys->Value = 0; else { diff --git a/Source/nragev20/NRagePluginV2.h b/Source/nragev20/NRagePluginV2.h index da8907911..77695aed3 100644 --- a/Source/nragev20/NRagePluginV2.h +++ b/Source/nragev20/NRagePluginV2.h @@ -152,6 +152,8 @@ typedef struct _CONTROLLER // AN N64 CONTROLLER unsigned PakType; // what type of controller pak? mempak? rumble? transfer? etc unsigned fVisualRumble; // is visual rumble enabled for this controller? + unsigned bBackgroundInput; // allow input while main window isn't focused? + BYTE bRumbleTyp; // what type of rumble effect? none, constant, ramp, or direct? GUID guidFFDevice; // GUID of the device that rumble gets sent to diff --git a/Source/nragev20/NRagePluginV2.rc b/Source/nragev20/NRagePluginV2.rc index e3d1eea62..acace5071 100644 --- a/Source/nragev20/NRagePluginV2.rc +++ b/Source/nragev20/NRagePluginV2.rc @@ -179,13 +179,14 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN CONTROL "Plugged",IDC_PLUGGED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,45,13 - PUSHBUTTON "Clear Controller",IDC_CLEARCONTROLLER,104,7,67,13 - PUSHBUTTON "Default Config",IDC_SETDEFAULT,104,21,67,13 - PUSHBUTTON "Load Profile",IDC_LOADPROFILE,191,7,67,13 - PUSHBUTTON "Save Profile",IDC_SAVEPROFILE,272,7,67,13 + PUSHBUTTON "Clear Controller",IDC_CLEARCONTROLLER,126,7,67,13 + PUSHBUTTON "Default Config",IDC_SETDEFAULT,126,21,67,13 + PUSHBUTTON "Load Profile",IDC_LOADPROFILE,208,7,67,13 + PUSHBUTTON "Save Profile",IDC_SAVEPROFILE,288,7,67,13 CONTROL "PLACEHOLDER",IDC_CONTROLLERTAB,"SysTabControl32",WS_GROUP | WS_TABSTOP,0,38,375,196 CONTROL "XInput",IDC_XINPUT_ENABLER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,22,37,10 CONTROL "N64 Mouse",IDC_N64MOUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,52,22,51,10 + CONTROL "Background Input",IDC_BACKGROUNDINPUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,52,7,69,13 END IDD_SHORTCUT DIALOGEX 0, 0, 376, 235 diff --git a/Source/nragev20/resource.h b/Source/nragev20/resource.h index c507d277a..17b102157 100644 --- a/Source/nragev20/resource.h +++ b/Source/nragev20/resource.h @@ -362,14 +362,15 @@ #define IDC_XC_LTS 1194 #define IDC_XC_RTS 1195 #define IDC_N64MOUSE 1196 +#define IDC_BACKGROUNDINPUT 1197 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 147 +#define _APS_NEXT_RESOURCE_VALUE 149 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1197 +#define _APS_NEXT_CONTROL_VALUE 1198 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif