mirror of
https://github.com/halpz/re3.git
synced 2025-06-28 17:16:19 +00:00
Merge remote-tracking branch 'origin/master' into miami
# Conflicts: # gamefiles/TEXT/american.gxt # premake5.lua # src/audio/MusicManager.cpp # src/control/Darkel.cpp # src/control/Script.cpp # src/core/FileLoader.cpp # src/core/Frontend.cpp # src/core/Game.cpp # src/core/Streaming.cpp # src/core/config.h # src/core/re3.cpp # src/extras/frontendoption.cpp # src/extras/frontendoption.h # src/render/Hud.cpp # src/skel/glfw/glfw.cpp # src/vehicles/CarGen.cpp # src/vehicles/Vehicle.cpp # src/weapons/WeaponInfo.cpp # utils/gxt/american.txt
This commit is contained in:
@ -84,6 +84,16 @@ void FileTimeToSystemTime(time_t* writeTime, SYSTEMTIME* out) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Because wchar length differs between platforms.
|
||||
wchar*
|
||||
AllocUnicode(const char* src)
|
||||
{
|
||||
wchar *dst = (wchar*)malloc(strlen(src)*2 + 2);
|
||||
wchar *i = dst;
|
||||
while((*i++ = (unsigned char)*src++) != '\0');
|
||||
return dst;
|
||||
}
|
||||
|
||||
// Funcs/features from Windows that we need on other platforms
|
||||
#ifndef _WIN32
|
||||
char *strupr(char *s) {
|
||||
|
@ -67,6 +67,10 @@ void CapturePad(RwInt32 padID);
|
||||
void joysChangeCB(int jid, int event);
|
||||
#endif
|
||||
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
extern char gSelectedJoystickName[128];
|
||||
#endif
|
||||
|
||||
enum eGameState
|
||||
{
|
||||
GS_START_UP = 0,
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "AnimViewer.h"
|
||||
#include "Font.h"
|
||||
|
||||
|
||||
#define MAX_SUBSYSTEMS (16)
|
||||
|
||||
|
||||
@ -92,6 +91,11 @@ long _dwOperatingSystemVersion;
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
char gSelectedJoystickName[128] = "";
|
||||
#endif
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
*/
|
||||
@ -429,6 +433,10 @@ psInitialize(void)
|
||||
_dwOperatingSystemVersion = OS_WIN95;
|
||||
}
|
||||
}
|
||||
#else
|
||||
_dwOperatingSystemVersion = OS_WINXP; // To fool other classes
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef PS2_MENU
|
||||
|
||||
@ -438,6 +446,8 @@ psInitialize(void)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
MEMORYSTATUS memstats;
|
||||
GlobalMemoryStatus(&memstats);
|
||||
|
||||
@ -445,17 +455,22 @@ psInitialize(void)
|
||||
|
||||
debug("Physical memory size %u\n", memstats.dwTotalPhys);
|
||||
debug("Available physical memory %u\n", memstats.dwAvailPhys);
|
||||
#elif defined (__APPLE__)
|
||||
uint64_t size = 0;
|
||||
uint64_t page_size = 0;
|
||||
size_t uint64_len = sizeof(uint64_t);
|
||||
size_t ull_len = sizeof(unsigned long long);
|
||||
sysctl((int[]){CTL_HW, HW_PAGESIZE}, 2, &page_size, &ull_len, NULL, 0);
|
||||
sysctl((int[]){CTL_HW, HW_MEMSIZE}, 2, &size, &uint64_len, NULL, 0);
|
||||
vm_statistics_data_t vm_stat;
|
||||
mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
|
||||
host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vm_stat, &count);
|
||||
_dwMemAvailPhys = (uint64_t)(vm_stat.free_count * page_size);
|
||||
debug("Physical memory size %llu\n", _dwMemAvailPhys);
|
||||
debug("Available physical memory %llu\n", size);
|
||||
#else
|
||||
|
||||
#ifndef PS2_MENU
|
||||
|
||||
#ifdef GTA3_1_1_PATCH
|
||||
FrontEndMenuManager.LoadSettings();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifndef __APPLE__
|
||||
struct sysinfo systemInfo;
|
||||
struct sysinfo systemInfo;
|
||||
sysinfo(&systemInfo);
|
||||
_dwMemAvailPhys = systemInfo.freeram;
|
||||
debug("Physical memory size %u\n", systemInfo.totalram);
|
||||
@ -476,7 +491,8 @@ psInitialize(void)
|
||||
#endif
|
||||
_dwOperatingSystemVersion = OS_WINXP; // To fool other classes
|
||||
#endif
|
||||
TheText.Unload();
|
||||
|
||||
TheText.Unload();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -843,35 +859,26 @@ void joysChangeCB(int jid, int event);
|
||||
|
||||
bool IsThisJoystickBlacklisted(int i)
|
||||
{
|
||||
#ifndef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
return false;
|
||||
#else
|
||||
if (glfwJoystickIsGamepad(i))
|
||||
return false;
|
||||
|
||||
const char* joyname = glfwGetJoystickName(i);
|
||||
|
||||
// this is just a keyboard and mouse
|
||||
// Microsoft Microsoft® 2.4GHz Transceiver v8.0 Consumer Control
|
||||
// Microsoft Microsoft® 2.4GHz Transceiver v8.0 System Control
|
||||
if (strstr(joyname, "2.4GHz Transceiver"))
|
||||
return true;
|
||||
// COMPANY USB Device System Control
|
||||
// COMPANY USB Device Consumer Control
|
||||
if (strstr(joyname, "COMPANY USB"))
|
||||
return true;
|
||||
// i.e. Synaptics TM2438-005
|
||||
if (strstr(joyname, "Synaptics "))
|
||||
return true;
|
||||
// i.e. ELAN Touchscreen
|
||||
if (strstr(joyname, "ELAN "))
|
||||
return true;
|
||||
// i.e. Primax Electronics, Ltd HP Wireless Keyboard Mouse Kit Consumer Control
|
||||
if (strstr(joyname, "Keyboard"))
|
||||
return true;
|
||||
if (strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
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)
|
||||
@ -886,6 +893,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);
|
||||
}
|
||||
}
|
||||
@ -2104,18 +2114,19 @@ void CapturePad(RwInt32 padID)
|
||||
|
||||
void joysChangeCB(int jid, int event)
|
||||
{
|
||||
if (event == GLFW_CONNECTED && !IsThisJoystickBlacklisted(jid))
|
||||
{
|
||||
if (PSGLOBAL(joy1id) == -1)
|
||||
if (event == GLFW_CONNECTED && !IsThisJoystickBlacklisted(jid)) {
|
||||
if (PSGLOBAL(joy1id) == -1) {
|
||||
PSGLOBAL(joy1id) = jid;
|
||||
else if (PSGLOBAL(joy2id) == -1)
|
||||
#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)
|
||||
|
||||
} else if (event == GLFW_DISCONNECTED) {
|
||||
if (PSGLOBAL(joy1id) == jid) {
|
||||
PSGLOBAL(joy1id) = -1;
|
||||
else if (PSGLOBAL(joy2id) == jid)
|
||||
} else if (PSGLOBAL(joy2id) == jid)
|
||||
PSGLOBAL(joy2id) = -1;
|
||||
}
|
||||
}
|
||||
|
@ -3414,4 +3414,4 @@ int strncasecmp(const char *str1, const char *str2, size_t len)
|
||||
return _strnicmp(str1, str2, len);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user