Merge remote-tracking branch 'refs/remotes/Cxbx-Reloaded/master'
This commit is contained in:
commit
5c3d37d11c
|
@ -76,7 +76,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\src\Common;..\..\src;..\..\src\Common\Win32;..\..\import\stb;%(AdditionalIncludeDirectories);..\..\import\OpenXDK\include;..\..\import\distorm\include;..\..\import\glew-2.0.0\include;..\..\src;..\..\src\Common;..\..\src\Common\Win32</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
|
@ -92,7 +92,7 @@
|
|||
<AdditionalIncludeDirectories>Include\Win32\Cxbx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>legacy_stdio_definitions.lib;d3d8.lib;dinput8.lib;dxguid.lib;odbc32.lib;odbccp32.lib;Shlwapi.lib;dxerr8.lib;xinput.lib;ws2_32.lib;dsound.lib;winmm.lib;ddraw.lib;d3dx8.lib;dbghelp.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>legacy_stdio_definitions.lib;d3d8.lib;dinput8.lib;dxguid.lib;odbc32.lib;odbccp32.lib;Shlwapi.lib;dxerr8.lib;ws2_32.lib;dsound.lib;winmm.lib;ddraw.lib;d3dx8.lib;dbghelp.lib;comctl32.lib;XINPUT9_1_0.LIB;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>$(Configuration)\;..\..\import\distorm\lib\Win32\;..\..\import\glew-2.0.0\lib\Release\Win32\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>msvcrt;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
|
@ -138,7 +138,7 @@ $(SOLUTIONDIR)Export.bat</Command>
|
|||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\src;..\..\src\Common;..\..\src\Common\Win32\;..\..\import\stb;%(AdditionalIncludeDirectories);..\..\import\OpenXDK\include;..\..\import\distorm\include;..\..\import\glew-2.0.0\include;..\..\src;..\..\src\Common;..\..\src\Common\Win32</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
|
@ -155,7 +155,7 @@ $(SOLUTIONDIR)Export.bat</Command>
|
|||
<AdditionalIncludeDirectories>Include\Win32\Cxbx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>legacy_stdio_definitions.lib;d3d8.lib;dinput8.lib;dxguid.lib;odbc32.lib;odbccp32.lib;Shlwapi.lib;dxerr8.lib;xinput.lib;ws2_32.lib;dsound.lib;winmm.lib;ddraw.lib;d3dx8.lib;dbghelp.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>legacy_stdio_definitions.lib;d3d8.lib;dinput8.lib;dxguid.lib;odbc32.lib;odbccp32.lib;Shlwapi.lib;dxerr8.lib;ws2_32.lib;dsound.lib;winmm.lib;ddraw.lib;d3dx8.lib;dbghelp.lib;comctl32.lib;XINPUT9_1_0.LIB;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>$(Configuration)\;..\..\import\distorm\lib\Win32\;..\..\import\glew-2.0.0\lib\Release\Win32\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
|
|
|
@ -131,6 +131,8 @@ BEGIN
|
|||
MENUITEM "Config &Audio...", ID_SETTINGS_CONFIGURESOUND, GRAYED
|
||||
MENUITEM "Config &Video...", ID_SETTINGS_CONFIG_VIDEO
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Use XInput", ID_SETTINGS_XINPUT
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "&HLE Cache"
|
||||
BEGIN
|
||||
MENUITEM "&Clear entire HLE Cache", ID_CACHE_CLEARHLECACHE_ALL
|
||||
|
|
|
@ -782,76 +782,76 @@ void XBController::ListenPoll(XTL::XINPUT_STATE *Controller)
|
|||
Controller->Gamepad.sThumbRX -= wValue;
|
||||
break;
|
||||
case XBCTRL_OBJECT_A:
|
||||
Controller->Gamepad.bAnalogButtons[XINPUT_GAMEPAD_A] = (wValue / 128);
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_A] = (wValue / 128);
|
||||
break;
|
||||
case XBCTRL_OBJECT_B:
|
||||
Controller->Gamepad.bAnalogButtons[XINPUT_GAMEPAD_B] = (wValue / 128);
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_B] = (wValue / 128);
|
||||
break;
|
||||
case XBCTRL_OBJECT_X:
|
||||
Controller->Gamepad.bAnalogButtons[XINPUT_GAMEPAD_X] = (wValue / 128);
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_X] = (wValue / 128);
|
||||
break;
|
||||
case XBCTRL_OBJECT_Y:
|
||||
Controller->Gamepad.bAnalogButtons[XINPUT_GAMEPAD_Y] = (wValue / 128);
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_Y] = (wValue / 128);
|
||||
break;
|
||||
case XBCTRL_OBJECT_WHITE:
|
||||
Controller->Gamepad.bAnalogButtons[XINPUT_GAMEPAD_WHITE] = (wValue / 128);
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_WHITE] = (wValue / 128);
|
||||
break;
|
||||
case XBCTRL_OBJECT_BLACK:
|
||||
Controller->Gamepad.bAnalogButtons[XINPUT_GAMEPAD_BLACK] = (wValue / 128);
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_BLACK] = (wValue / 128);
|
||||
break;
|
||||
case XBCTRL_OBJECT_LTRIGGER:
|
||||
Controller->Gamepad.bAnalogButtons[XINPUT_GAMEPAD_LEFT_TRIGGER] = (wValue / 128);
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_LEFT_TRIGGER] = (wValue / 128);
|
||||
break;
|
||||
case XBCTRL_OBJECT_RTRIGGER:
|
||||
Controller->Gamepad.bAnalogButtons[XINPUT_GAMEPAD_RIGHT_TRIGGER] = (wValue / 128);
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_RIGHT_TRIGGER] = (wValue / 128);
|
||||
break;
|
||||
case XBCTRL_OBJECT_DPADUP:
|
||||
if(wValue > 0)
|
||||
Controller->Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_UP;
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_DPAD_UP;
|
||||
else
|
||||
Controller->Gamepad.wButtons &= ~XINPUT_GAMEPAD_DPAD_UP;
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_DPAD_UP;
|
||||
break;
|
||||
case XBCTRL_OBJECT_DPADDOWN:
|
||||
if(wValue > 0)
|
||||
Controller->Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_DOWN;
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_DPAD_DOWN;
|
||||
else
|
||||
Controller->Gamepad.wButtons &= ~XINPUT_GAMEPAD_DPAD_DOWN;
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_DPAD_DOWN;
|
||||
break;
|
||||
case XBCTRL_OBJECT_DPADLEFT:
|
||||
if(wValue > 0)
|
||||
Controller->Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_LEFT;
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_DPAD_LEFT;
|
||||
else
|
||||
Controller->Gamepad.wButtons &= ~XINPUT_GAMEPAD_DPAD_LEFT;
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_DPAD_LEFT;
|
||||
break;
|
||||
case XBCTRL_OBJECT_DPADRIGHT:
|
||||
if(wValue > 0)
|
||||
Controller->Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_RIGHT;
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_DPAD_RIGHT;
|
||||
else
|
||||
Controller->Gamepad.wButtons &= ~XINPUT_GAMEPAD_DPAD_RIGHT;
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_DPAD_RIGHT;
|
||||
break;
|
||||
case XBCTRL_OBJECT_BACK:
|
||||
if(wValue > 0)
|
||||
Controller->Gamepad.wButtons |= XINPUT_GAMEPAD_BACK;
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_BACK;
|
||||
else
|
||||
Controller->Gamepad.wButtons &= ~XINPUT_GAMEPAD_BACK;
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_BACK;
|
||||
break;
|
||||
case XBCTRL_OBJECT_START:
|
||||
if(wValue > 0)
|
||||
Controller->Gamepad.wButtons |= XINPUT_GAMEPAD_START;
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_START;
|
||||
else
|
||||
Controller->Gamepad.wButtons &= ~XINPUT_GAMEPAD_START;
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_START;
|
||||
break;
|
||||
case XBCTRL_OBJECT_LTHUMB:
|
||||
if(wValue > 0)
|
||||
Controller->Gamepad.wButtons |= XINPUT_GAMEPAD_LEFT_THUMB;
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_LEFT_THUMB;
|
||||
else
|
||||
Controller->Gamepad.wButtons &= ~XINPUT_GAMEPAD_LEFT_THUMB;
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_LEFT_THUMB;
|
||||
break;
|
||||
case XBCTRL_OBJECT_RTHUMB:
|
||||
if(wValue > 0)
|
||||
Controller->Gamepad.wButtons |= XINPUT_GAMEPAD_RIGHT_THUMB;
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_RIGHT_THUMB;
|
||||
else
|
||||
Controller->Gamepad.wButtons &= ~XINPUT_GAMEPAD_RIGHT_THUMB;
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_RIGHT_THUMB;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
#define ID_SETTINGS_CACHE 40083
|
||||
#define ID_CACHE_CLEARHLECACHE_ALL 40084
|
||||
#define ID_CACHE_CLEARHLECACHE_CURRENT 40085
|
||||
#define ID_SETTINGS_XINPUT 40086
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
|
@ -100,7 +101,7 @@
|
|||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 130
|
||||
#define _APS_NEXT_COMMAND_VALUE 40085
|
||||
#define _APS_NEXT_COMMAND_VALUE 40087
|
||||
#define _APS_NEXT_CONTROL_VALUE 1058
|
||||
#define _APS_NEXT_SYMED_VALUE 104
|
||||
#endif
|
||||
|
|
1211
src/Cxbx/WndMain.cpp
1211
src/Cxbx/WndMain.cpp
File diff suppressed because it is too large
Load Diff
|
@ -163,6 +163,11 @@ class WndMain : public Wnd
|
|||
// ******************************************************************
|
||||
int m_FlagsLLE;
|
||||
|
||||
// ******************************************************************
|
||||
// * XInout Enabled Flag
|
||||
// ******************************************************************
|
||||
int m_XInputEnabled;
|
||||
|
||||
// ******************************************************************
|
||||
// * debug output filenames
|
||||
// ******************************************************************
|
||||
|
|
|
@ -666,6 +666,19 @@ void CxbxKrnlInit
|
|||
DbgPrintf("EmuMain : LLE enabled for JIT.\n");
|
||||
}
|
||||
|
||||
// Process XInput Enabled flag
|
||||
{
|
||||
int XInputEnabled;
|
||||
g_EmuShared->GetXInputEnabled(&XInputEnabled);
|
||||
if (XInputEnabled) {
|
||||
g_XInputEnabled = true;
|
||||
printf("EmuMain : Using XInput\n");
|
||||
} else {
|
||||
g_XInputEnabled = false;
|
||||
printf("EmuMain : Using DirectInput\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize devices :
|
||||
char szBuffer[MAX_PATH];
|
||||
SHGetSpecialFolderPath(NULL, szBuffer, CSIDL_APPDATA, TRUE);
|
||||
|
|
|
@ -71,6 +71,7 @@ CHAR *g_strCurDrive= NULL;
|
|||
volatile bool g_bEmuException = false;
|
||||
volatile bool g_bEmuSuspended = false;
|
||||
volatile bool g_bPrintfOn = true;
|
||||
bool g_XInputEnabled = false;
|
||||
|
||||
// Delta added to host SystemTime, used in xboxkrnl::KeQuerySystemTime and xboxkrnl::NtSetSystemTime
|
||||
LARGE_INTEGER HostSystemTimeDelta = {};
|
||||
|
|
|
@ -95,6 +95,7 @@ g_pXInputSetStateStatus[XINPUT_SETSTATE_SLOTS];
|
|||
// 4 controllers
|
||||
#define XINPUT_HANDLE_SLOTS 4
|
||||
|
||||
extern bool g_XInputEnabled;
|
||||
extern HANDLE g_hInputHandle[XINPUT_HANDLE_SLOTS];
|
||||
|
||||
extern void InitializeSectionStructures(void);
|
||||
|
|
|
@ -52,28 +52,4 @@ extern void EmuDInputCleanup();
|
|||
// ******************************************************************
|
||||
extern void EmuDInputPoll(PXINPUT_STATE Controller);
|
||||
|
||||
// ******************************************************************
|
||||
// * offsets into analog button array
|
||||
// ******************************************************************
|
||||
#define XINPUT_GAMEPAD_A 0
|
||||
#define XINPUT_GAMEPAD_B 1
|
||||
#define XINPUT_GAMEPAD_X 2
|
||||
#define XINPUT_GAMEPAD_Y 3
|
||||
#define XINPUT_GAMEPAD_BLACK 4
|
||||
#define XINPUT_GAMEPAD_WHITE 5
|
||||
#define XINPUT_GAMEPAD_LEFT_TRIGGER 6
|
||||
#define XINPUT_GAMEPAD_RIGHT_TRIGGER 7
|
||||
|
||||
// ******************************************************************
|
||||
// * masks for digital buttons
|
||||
// ******************************************************************
|
||||
#define XINPUT_GAMEPAD_DPAD_UP 0x00000001
|
||||
#define XINPUT_GAMEPAD_DPAD_DOWN 0x00000002
|
||||
#define XINPUT_GAMEPAD_DPAD_LEFT 0x00000004
|
||||
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x00000008
|
||||
#define XINPUT_GAMEPAD_START 0x00000010
|
||||
#define XINPUT_GAMEPAD_BACK 0x00000020
|
||||
#define XINPUT_GAMEPAD_LEFT_THUMB 0x00000040
|
||||
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x00000080
|
||||
|
||||
#endif
|
||||
|
|
|
@ -91,6 +91,12 @@ class EmuShared : public Mutex
|
|||
void GetFlagsLLE( int *flags) { Lock(); *flags = m_FlagsLLE; Unlock(); }
|
||||
void SetFlagsLLE(const int *flags) { Lock(); m_FlagsLLE = *flags; Unlock(); }
|
||||
|
||||
// ******************************************************************
|
||||
// * XInput Flag Accessors
|
||||
// ******************************************************************
|
||||
void GetXInputEnabled(int* value) { Lock(); *value = m_XInputEnabled; Unlock(); }
|
||||
void SetXInputEnabled(int* value) { Lock(); m_XInputEnabled = *value; Unlock(); }
|
||||
|
||||
private:
|
||||
// ******************************************************************
|
||||
// * Constructor / Deconstructor
|
||||
|
@ -105,6 +111,7 @@ class EmuShared : public Mutex
|
|||
XBVideo m_XBVideo;
|
||||
char m_XbePath[MAX_PATH];
|
||||
int m_FlagsLLE;
|
||||
int m_XInputEnabled;
|
||||
};
|
||||
|
||||
// ******************************************************************
|
||||
|
|
|
@ -41,24 +41,6 @@
|
|||
#include "EmuShared.h"
|
||||
#include "EmuXInput.h"
|
||||
|
||||
//
|
||||
// Prevent naming collisions
|
||||
//
|
||||
#undef XINPUT_GAMEPAD_DPAD_UP
|
||||
#undef XINPUT_GAMEPAD_DPAD_DOWN
|
||||
#undef XINPUT_GAMEPAD_DPAD_LEFT
|
||||
#undef XINPUT_GAMEPAD_DPAD_RIGHT
|
||||
#undef XINPUT_GAMEPAD_START
|
||||
#undef XINPUT_GAMEPAD_BACK
|
||||
#undef XINPUT_GAMEPAD_LEFT_THUMB
|
||||
#undef XINPUT_GAMEPAD_RIGHT_THUMB
|
||||
#undef XINPUT_GAMEPAD_LEFT_SHOULDER
|
||||
#undef XINPUT_GAMEPAD_RIGHT_SHOULDER
|
||||
#undef XINPUT_GAMEPAD_A
|
||||
#undef XINPUT_GAMEPAD_B
|
||||
#undef XINPUT_GAMEPAD_X
|
||||
#undef XINPUT_GAMEPAD_Y
|
||||
|
||||
#include <xinput.h>
|
||||
|
||||
|
||||
|
@ -73,7 +55,7 @@ static BOOL g_bXInputInitialized = FALSE;
|
|||
// ******************************************************************
|
||||
// * patch: XInputPCPoll
|
||||
// ******************************************************************
|
||||
/*void XTL::EMUPATCH(XInputPCPoll)( XTL::PXINPUT_STATE Controller )
|
||||
void XTL::EmuXInputPCPoll( XTL::PXINPUT_STATE Controller )
|
||||
{
|
||||
//
|
||||
// Get the PC's XInput values
|
||||
|
@ -85,20 +67,68 @@ static BOOL g_bXInputInitialized = FALSE;
|
|||
//
|
||||
// Now convert those values to Xbox XInput
|
||||
//
|
||||
|
||||
// Analog Sticks
|
||||
Controller->Gamepad.sThumbLX = g_Controller.Gamepad.sThumbLX;
|
||||
Controller->Gamepad.sThumbLY = g_Controller.Gamepad.sThumbLY;
|
||||
Controller->Gamepad.sThumbRX = g_Controller.Gamepad.sThumbRX;
|
||||
Controller->Gamepad.sThumbRY = g_Controller.Gamepad.sThumbRY;
|
||||
|
||||
Controller->Gamepad.wButtons = g_Controller.Gamepad.wButtons & 0x00FF;
|
||||
// Analog Buttons
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_A] = (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_A) ? 255 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_B] = (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_B) ? 255 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_X] = (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_X) ? 255 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_Y] = (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_Y) ? 255 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_WHITE] = (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER) ? 255 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_BLACK] = (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER) ? 255 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_LEFT_TRIGGER] = g_Controller.Gamepad.bLeftTrigger;
|
||||
Controller->Gamepad.bAnalogButtons[XB_XINPUT_GAMEPAD_RIGHT_TRIGGER] = g_Controller.Gamepad.bRightTrigger;
|
||||
|
||||
Controller->Gamepad.bAnalogButtons[0] = (g_Controller.Gamepad.wButtons & 0x1000) ? 1 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[1] = (g_Controller.Gamepad.wButtons & 0x2000) ? 1 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[2] = (g_Controller.Gamepad.wButtons & 0x4000) ? 1 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[3] = (g_Controller.Gamepad.wButtons & 0x8000) ? 1 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[4] = (g_Controller.Gamepad.wButtons & 0x0100) ? 1 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[5] = (g_Controller.Gamepad.wButtons & 0x0200) ? 1 : 0;
|
||||
Controller->Gamepad.bAnalogButtons[6] = g_Controller.Gamepad.bLeftTrigger;
|
||||
Controller->Gamepad.bAnalogButtons[7] = g_Controller.Gamepad.bRightTrigger;
|
||||
}*/
|
||||
// Digital Buttons
|
||||
if (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_BACK) {
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_BACK;
|
||||
} else {
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_BACK;
|
||||
}
|
||||
|
||||
if (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_START) {
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_START;
|
||||
} else {
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_START;
|
||||
}
|
||||
|
||||
if (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB) {
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_LEFT_THUMB;
|
||||
} else {
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_LEFT_THUMB;
|
||||
}
|
||||
|
||||
if (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) {
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_RIGHT_THUMB;
|
||||
} else {
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_RIGHT_THUMB;
|
||||
}
|
||||
|
||||
if (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) {
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_DPAD_UP;
|
||||
} else {
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_DPAD_UP;
|
||||
}
|
||||
|
||||
if (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) {
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_DPAD_DOWN;
|
||||
} else {
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_DPAD_DOWN;
|
||||
}
|
||||
|
||||
if (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) {
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_DPAD_LEFT;
|
||||
} else {
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_DPAD_LEFT;
|
||||
}
|
||||
|
||||
if (g_Controller.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) {
|
||||
Controller->Gamepad.wButtons |= XB_XINPUT_GAMEPAD_DPAD_RIGHT;
|
||||
} else {
|
||||
Controller->Gamepad.wButtons &= ~XB_XINPUT_GAMEPAD_DPAD_RIGHT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,6 @@
|
|||
// ******************************************************************
|
||||
// * patch: XInputPCPoll
|
||||
// ******************************************************************
|
||||
// void EmuXInputPCPoll( XTL::PXINPUT_STATE Controller );
|
||||
void EmuXInputPCPoll( XTL::PXINPUT_STATE Controller );
|
||||
|
||||
#endif
|
|
@ -89,7 +89,6 @@ XFIBER g_Fibers[256];
|
|||
// Number of fiber routines queued
|
||||
int g_FiberCount = 0;
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// * patch: XFormatUtilityDrive
|
||||
// ******************************************************************
|
||||
|
@ -462,8 +461,12 @@ DWORD WINAPI XTL::EMUPATCH(XInputGetState)
|
|||
|
||||
if(dwPort == 0)
|
||||
{
|
||||
EmuDInputPoll(pState);
|
||||
// EmuXInputPCPoll(pState);
|
||||
if (g_XInputEnabled) {
|
||||
EmuXInputPCPoll(pState);
|
||||
} else {
|
||||
EmuDInputPoll(pState);
|
||||
}
|
||||
|
||||
ret = ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,6 +229,30 @@ typedef struct _XINPUT_STATE
|
|||
}
|
||||
XINPUT_STATE, *PXINPUT_STATE;
|
||||
|
||||
// ******************************************************************
|
||||
// * offsets into analog button array
|
||||
// ******************************************************************
|
||||
#define XB_XINPUT_GAMEPAD_A 0
|
||||
#define XB_XINPUT_GAMEPAD_B 1
|
||||
#define XB_XINPUT_GAMEPAD_X 2
|
||||
#define XB_XINPUT_GAMEPAD_Y 3
|
||||
#define XB_XINPUT_GAMEPAD_BLACK 4
|
||||
#define XB_XINPUT_GAMEPAD_WHITE 5
|
||||
#define XB_XINPUT_GAMEPAD_LEFT_TRIGGER 6
|
||||
#define XB_XINPUT_GAMEPAD_RIGHT_TRIGGER 7
|
||||
|
||||
// ******************************************************************
|
||||
// * masks for digital buttons
|
||||
// ******************************************************************
|
||||
#define XB_XINPUT_GAMEPAD_DPAD_UP 0x00000001
|
||||
#define XB_XINPUT_GAMEPAD_DPAD_DOWN 0x00000002
|
||||
#define XB_XINPUT_GAMEPAD_DPAD_LEFT 0x00000004
|
||||
#define XB_XINPUT_GAMEPAD_DPAD_RIGHT 0x00000008
|
||||
#define XB_XINPUT_GAMEPAD_START 0x00000010
|
||||
#define XB_XINPUT_GAMEPAD_BACK 0x00000020
|
||||
#define XB_XINPUT_GAMEPAD_LEFT_THUMB 0x00000040
|
||||
#define XB_XINPUT_GAMEPAD_RIGHT_THUMB 0x00000080
|
||||
|
||||
// ******************************************************************
|
||||
// * XINPUT_FEEDBACK_HEADER
|
||||
// ******************************************************************
|
||||
|
|
Loading…
Reference in New Issue