Detect joystick menu for XInput

This commit is contained in:
erorcun
2021-02-05 17:51:57 +03:00
parent c002dd6cba
commit c7ba01b034
10 changed files with 112 additions and 14 deletions

View File

@ -71,7 +71,7 @@ void CapturePad(RwInt32 padID);
void joysChangeCB(int jid, int event);
#endif
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
#ifdef DETECT_JOYSTICK_MENU
extern char gSelectedJoystickName[128];
#endif

View File

@ -81,7 +81,7 @@ static psGlobalType PsGlobal;
size_t _dwMemAvailPhys;
RwUInt32 gGameState;
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
#ifdef DETECT_JOYSTICK_MENU
char gSelectedJoystickName[128] = "";
#endif
@ -841,7 +841,7 @@ void joysChangeCB(int jid, int event);
bool IsThisJoystickBlacklisted(int i)
{
#ifndef DONT_TRUST_RECOGNIZED_JOYSTICKS
#ifndef DETECT_JOYSTICK_MENU
return false;
#else
if (glfwJoystickIsGamepad(i))
@ -906,7 +906,7 @@ void _InputInitialiseJoys()
if (PSGLOBAL(joy1id) != -1) {
int count;
glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
#ifdef DETECT_JOYSTICK_MENU
strcpy(gSelectedJoystickName, glfwGetJoystickName(PSGLOBAL(joy1id)));
#endif
ControlsManager.InitDefaultControlConfigJoyPad(count);
@ -2150,7 +2150,7 @@ void joysChangeCB(int jid, int event)
if (event == GLFW_CONNECTED && !IsThisJoystickBlacklisted(jid)) {
if (PSGLOBAL(joy1id) == -1) {
PSGLOBAL(joy1id) = jid;
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
#ifdef DETECT_JOYSTICK_MENU
strcpy(gSelectedJoystickName, glfwGetJoystickName(jid));
#endif
// This is behind LOAD_INI_SETTINGS, because otherwise the Init call below will destroy/overwrite your bindings.

View File

@ -121,6 +121,10 @@ DWORD _dwOperatingSystemVersion;
RwUInt32 gGameState;
CJoySticks AllValidWinJoys;
#ifdef DETECT_JOYSTICK_MENU
char gSelectedJoystickName[128] = "";
#endif
// What is that for anyway?
#ifndef IMPROVED_VIDEOMODE
static RwBool defaultFullscreenRes = TRUE;