[N-Rage] Add background input option

This commit is contained in:
shygoo 2019-04-19 23:44:04 -05:00
parent 34aeb0ab8f
commit 1b53acad89
7 changed files with 30 additions and 7 deletions

View File

@ -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);

View File

@ -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

View File

@ -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 );

View File

@ -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
{

View File

@ -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

View File

@ -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

View File

@ -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