summaryrefslogtreecommitdiffstats
path: root/src/skel/glfw/glfw.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-10-02 16:36:56 +0200
committereray orçunus <erayorcunus@gmail.com>2020-10-02 20:18:34 +0200
commit3bd333022778cee8dd95b58b02a7263870546c1b (patch)
treec75422bd786b704644e9944cca012397cee0d897 /src/skel/glfw/glfw.cpp
parentMerge branch 'master' of github.com:erorcun/re3 (diff)
downloadre3-3bd333022778cee8dd95b58b02a7263870546c1b.tar
re3-3bd333022778cee8dd95b58b02a7263870546c1b.tar.gz
re3-3bd333022778cee8dd95b58b02a7263870546c1b.tar.bz2
re3-3bd333022778cee8dd95b58b02a7263870546c1b.tar.lz
re3-3bd333022778cee8dd95b58b02a7263870546c1b.tar.xz
re3-3bd333022778cee8dd95b58b02a7263870546c1b.tar.zst
re3-3bd333022778cee8dd95b58b02a7263870546c1b.zip
Diffstat (limited to 'src/skel/glfw/glfw.cpp')
-rw-r--r--src/skel/glfw/glfw.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index 944e87b5..cd8380b2 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -41,7 +41,6 @@
#include "AnimViewer.h"
#include "Font.h"
-
#define MAX_SUBSYSTEMS (16)
@@ -425,6 +424,10 @@ psInitialize(void)
_dwOperatingSystemVersion = OS_WIN95;
}
}
+#else
+ _dwOperatingSystemVersion = OS_WINXP; // To fool other classes
+#endif
+
#ifndef PS2_MENU
@@ -434,6 +437,8 @@ psInitialize(void)
#endif
+
+#ifdef _WIN32
MEMORYSTATUS memstats;
GlobalMemoryStatus(&memstats);
@@ -442,20 +447,10 @@ psInitialize(void)
debug("Physical memory size %u\n", memstats.dwTotalPhys);
debug("Available physical memory %u\n", memstats.dwAvailPhys);
#else
-
-#ifndef PS2_MENU
-
-#ifdef GTA3_1_1_PATCH
- FrontEndMenuManager.LoadSettings();
-#endif
-
-#endif
struct sysinfo systemInfo;
sysinfo(&systemInfo);
_dwMemAvailPhys = systemInfo.freeram;
- _dwOperatingSystemVersion = OS_WINXP; // To fool other classes
-
debug("Physical memory size %u\n", systemInfo.totalram);
debug("Available physical memory %u\n", systemInfo.freeram);
@@ -835,7 +830,7 @@ bool IsThisJoystickBlacklisted(int i)
const char* joyname = glfwGetJoystickName(i);
- if (strncmp(joyname, gSelectedJoystickName, sizeof(gSelectedJoystickName)) == 0)
+ if (strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0)
return false;
return true;
@@ -844,6 +839,9 @@ bool IsThisJoystickBlacklisted(int i)
void _InputInitialiseJoys()
{
+ PSGLOBAL(joy1id) = -1;
+ PSGLOBAL(joy2id) = -1;
+
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
if (glfwJoystickPresent(i) && !IsThisJoystickBlacklisted(i)) {
if (PSGLOBAL(joy1id) == -1)
@@ -858,7 +856,9 @@ void _InputInitialiseJoys()
if (PSGLOBAL(joy1id) != -1) {
int count;
glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
+#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
strcpy(gSelectedJoystickName, glfwGetJoystickName(PSGLOBAL(joy1id)));
+#endif
ControlsManager.InitDefaultControlConfigJoyPad(count);
}
}
@@ -2067,14 +2067,15 @@ void joysChangeCB(int jid, int event)
if (event == GLFW_CONNECTED && !IsThisJoystickBlacklisted(jid)) {
if (PSGLOBAL(joy1id) == -1) {
PSGLOBAL(joy1id) = jid;
+#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
strcpy(gSelectedJoystickName, glfwGetJoystickName(jid));
+#endif
} else if (PSGLOBAL(joy2id) == -1)
PSGLOBAL(joy2id) = jid;
} else if (event == GLFW_DISCONNECTED) {
if (PSGLOBAL(joy1id) == jid) {
PSGLOBAL(joy1id) = -1;
- strcpy(gSelectedJoystickName, "");
} else if (PSGLOBAL(joy2id) == jid)
PSGLOBAL(joy2id) = -1;
}