Merge pull request #452 from LuigiBlood/64dd

Added N64 Mouse support in NRage
This commit is contained in:
zilmar 2015-05-12 08:58:14 +10:00
commit 8fe90211a8
7 changed files with 24 additions and 4 deletions

View File

@ -253,6 +253,10 @@ bool ProcessKey( DWORD dwKey, DWORD dwSection, LPCSTR pszLine, LPTSTR pszFFDevic
if (pController) if (pController)
pController->fXInput = atoi(pszLine); pController->fXInput = atoi(pszLine);
break; break;
case CHK_N64MOUSE:
if (pController)
pController->fN64Mouse = atoi(pszLine);
break;
case CHK_PAKTYPE: case CHK_PAKTYPE:
if (pController) if (pController)
pController->PakType = atoi(pszLine); pController->PakType = atoi(pszLine);
@ -1485,6 +1489,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_PLUGGED "=%u\n", g_ivConfig->Controllers[i].fPlugged);
fprintf(fFile, STRING_INI_XINPUT "=%u\n", g_ivConfig->Controllers[i].fXInput); 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_RAWDATA "=%u\n", g_ivConfig->Controllers[i].fRawData); 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_PAKTYPE "=%u\n", g_ivConfig->Controllers[i].PakType);
fprintf(fFile, STRING_INI_REALN64RANGE "=%u\n", g_ivConfig->Controllers[i].fRealN64Range); fprintf(fFile, STRING_INI_REALN64RANGE "=%u\n", g_ivConfig->Controllers[i].fRealN64Range);

View File

@ -86,6 +86,7 @@ unsigned long djbHash(const char *str);
#define STRING_INI_PLUGGED "Plugged" #define STRING_INI_PLUGGED "Plugged"
#define STRING_INI_XINPUT "xInput" #define STRING_INI_XINPUT "xInput"
#define STRING_INI_N64MOUSE "N64Mouse"
#define STRING_INI_RAWDATA "RawData" #define STRING_INI_RAWDATA "RawData"
#define STRING_INI_PAKTYPE "PakType" #define STRING_INI_PAKTYPE "PakType"
#define STRING_INI_REALN64RANGE "RealN64Range" #define STRING_INI_REALN64RANGE "RealN64Range"
@ -154,6 +155,7 @@ unsigned long djbHash(const char *str);
#define CHK_PLUGGED 3378836077 #define CHK_PLUGGED 3378836077
#define CHK_XINPUT 3665436173 #define CHK_XINPUT 3665436173
#define CHK_N64MOUSE 863329606
#define CHK_RAWDATA 1238573385 #define CHK_RAWDATA 1238573385
#define CHK_PAKTYPE 2936974691 #define CHK_PAKTYPE 2936974691
#define CHK_REALN64RANGE 1279831790 #define CHK_REALN64RANGE 1279831790

View File

@ -548,6 +548,10 @@ BOOL CALLBACK ControllerTabProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
} }
return TRUE; // END IDC_XINPUT_ENABLER return TRUE; // END IDC_XINPUT_ENABLER
case IDC_N64MOUSE:
pcController->fN64Mouse = (IsDlgButtonChecked(hDlg, LOWORD(wParam)) == BST_CHECKED);
return TRUE;
default: default:
return FALSE; return FALSE;
} }
@ -556,6 +560,7 @@ BOOL CALLBACK ControllerTabProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// for this dialog // for this dialog
CheckDlgButton( hDlg, IDC_PLUGGED, pcController->fPlugged ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton( hDlg, IDC_PLUGGED, pcController->fPlugged ? BST_CHECKED : BST_UNCHECKED );
CheckDlgButton( hDlg, IDC_XINPUT_ENABLER, pcController->fXInput ? 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);
if( hTabControl ) if( hTabControl )
DestroyWindow( hTabControl ); DestroyWindow( hTabControl );

View File

@ -602,9 +602,14 @@ EXPORT void CALL ReadController( int Control, BYTE * Command )
#ifdef ENABLE_RAWPAK_DEBUG #ifdef ENABLE_RAWPAK_DEBUG
WriteDatasA( "GetStatus-PreProcessing", Control, Command, 0); WriteDatasA( "GetStatus-PreProcessing", Control, Command, 0);
#endif #endif
Command[3] = RD_GAMEPAD | RD_ABSOLUTE; Command[3] = RD_GAMEPAD;
Command[4] = RD_NOEEPROM; Command[4] = RD_NOEEPROM;
if (g_pcControllers[Control].fN64Mouse) // Is Controller a mouse?
Command[3] |= RD_RELATIVE;
else
Command[3] |= RD_ABSOLUTE;
if( g_pcControllers[Control].fPakInitialized && g_pcControllers[Control].pPakData ) if( g_pcControllers[Control].fPakInitialized && g_pcControllers[Control].pPakData )
{ {
if( *(BYTE*)g_pcControllers[Control].pPakData == PAK_ADAPTOID ) if( *(BYTE*)g_pcControllers[Control].pPakData == PAK_ADAPTOID )

View File

@ -126,6 +126,7 @@ typedef struct _CONTROLLER // AN N64 CONTROLLER
{ {
unsigned fPlugged; // is the controller "plugged" (i.e. does the emulator see a controller on this port?) unsigned fPlugged; // is the controller "plugged" (i.e. does the emulator see a controller on this port?)
unsigned fXInput; // is the controller an xInput device? unsigned fXInput; // is the controller an xInput device?
unsigned fN64Mouse; // is the controller a N64 Mouse (Relative)?
unsigned fRawData; // are we using RAW mode for this controller? unsigned fRawData; // are we using RAW mode for this controller?
unsigned fIsAdaptoid; // is it an adaptoid? unsigned fIsAdaptoid; // is it an adaptoid?

View File

@ -179,12 +179,13 @@ EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x0 FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN BEGIN
CONTROL "Plugged",IDC_PLUGGED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,45,13 CONTROL "Plugged",IDC_PLUGGED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,45,13
PUSHBUTTON "Clear Controller",IDC_CLEARCONTROLLER,63,7,67,13 PUSHBUTTON "Clear Controller",IDC_CLEARCONTROLLER,104,7,67,13
PUSHBUTTON "Default Config",IDC_SETDEFAULT,63,21,67,13 PUSHBUTTON "Default Config",IDC_SETDEFAULT,104,21,67,13
PUSHBUTTON "Load Profile",IDC_LOADPROFILE,191,7,67,13 PUSHBUTTON "Load Profile",IDC_LOADPROFILE,191,7,67,13
PUSHBUTTON "Save Profile",IDC_SAVEPROFILE,272,7,67,13 PUSHBUTTON "Save Profile",IDC_SAVEPROFILE,272,7,67,13
CONTROL "PLACEHOLDER",IDC_CONTROLLERTAB,"SysTabControl32",WS_GROUP | WS_TABSTOP,0,38,375,196 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 "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
END END
IDD_SHORTCUT DIALOGEX 0, 0, 376, 235 IDD_SHORTCUT DIALOGEX 0, 0, 376, 235

View File

@ -361,6 +361,7 @@
#define IDC_XC_DPAD 1193 #define IDC_XC_DPAD 1193
#define IDC_XC_LTS 1194 #define IDC_XC_LTS 1194
#define IDC_XC_RTS 1195 #define IDC_XC_RTS 1195
#define IDC_N64MOUSE 1196
// Next default values for new objects // Next default values for new objects
// //
@ -368,7 +369,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 147 #define _APS_NEXT_RESOURCE_VALUE 147
#define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1196 #define _APS_NEXT_CONTROL_VALUE 1197
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif