Fix up some minor portability issues.

This commit is contained in:
Shpoike 2023-02-11 05:20:02 +00:00
parent 91e0ec1f2b
commit 22533dfab8
9 changed files with 33 additions and 20 deletions

View file

@ -131,7 +131,10 @@ ELSE()
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_OPENGL)
ENDIF()
FIND_PACKAGE(JPEG)
SET(FTE_DEP_JPEG true CACHE BOOL "Link against libjpeg.")
IF(FTE_DEP_JPEG)
FIND_PACKAGE(JPEG)
ENDIF()
IF(JPEG_FOUND)
INCLUDE_DIRECTORIES( ${JPEG_INCLUDE_DIRS} )
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};LIBJPEG_STATIC)

View file

@ -1000,10 +1000,10 @@ qboolean CL_CheckOrEnqueDownloadFile (const char *filename, const char *localnam
{
char base[MAX_QPATH];
COM_FileBase(filename, base, sizeof(base));
#ifndef FTE_TARGET_WEB
if (strncmp(cl_download_mapsrc.string, "http://", 7) && !strncmp(cl_download_mapsrc.string, "https://", 8))
#ifndef FTE_TARGET_WEB //don't care about prefixes in the web build, for site-relative uris.
if (strncmp(cl_download_mapsrc.string, "http://", 7) && strncmp(cl_download_mapsrc.string, "https://", 8))
{
Con_Printf("%s: Scheme not specified.\n", cl_download_mapsrc.name);
Con_Printf("%s: Scheme not specified, assuming https.\n", cl_download_mapsrc.name);
filename = va("https://%s/%s", cl_download_mapsrc.string, filename+5);
}
else

View file

@ -993,10 +993,10 @@ dllhandle_t *Sys_LoadLibrary(const char *name, dllfunction_t *funcs)
lib = NULL;
if (!lib)
lib = dlopen (name, RTLD_LOCAL|RTLD_LAZY);
if (!lib && !strstr(name, ".so"))
lib = dlopen (va("%s.so", name), RTLD_LOCAL|RTLD_LAZY);
if (!lib && !strstr(name, ".so") && !strncmp(name, "./", 2) && host_parms.binarydir)
lib = dlopen (va("%s%s.so", host_parms.binarydir, name+2), RTLD_LOCAL|RTLD_LAZY);
if (!lib && !strstr(name, ARCH_DL_POSTFIX))
lib = dlopen (va("%s"ARCH_DL_POSTFIX, name), RTLD_LOCAL|RTLD_LAZY);
if (!lib && !strstr(name, ARCH_DL_POSTFIX) && !strncmp(name, "./", 2) && host_parms.binarydir)
lib = dlopen (va("%s%s"ARCH_DL_POSTFIX, host_parms.binarydir, name+2), RTLD_LOCAL|RTLD_LAZY);
if (!lib)
{
Con_DLPrintf(2,"%s\n", dlerror());

View file

@ -690,7 +690,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ARCH_CPU_POSTFIX "x86"
#elif defined(__powerpc__) || defined(__ppc__)
#define ARCH_CPU_POSTFIX "ppc"
#elif defined(__aarch64__)
#elif defined(__aarch64__) || defined(__arm64__)
#define ARCH_CPU_POSTFIX "arm64"
#elif defined(__arm__)
#ifdef __SOFTFP__

View file

@ -1583,7 +1583,7 @@ static void MDNS_ProcessPacket(qbyte *inmsg, size_t inmsgsize, netadr_t *source)
static void MDNS_ReadPackets(void)
{
qbyte inmsg[9000];
ssize_t inmsgsize;
int inmsgsize;
netadr_t adr;
struct sockaddr_qstorage source;

View file

@ -182,12 +182,12 @@ qboolean EGL_LoadLibrary(char *driver)
#ifndef _WIN32
if (!eslibrary)
{
eslibrary = dlopen("libGL.so.1.2", RTLD_NOW|RTLD_GLOBAL);
eslibrary = dlopen("libGL"ARCH_DL_POSTFIX".1.2", RTLD_NOW|RTLD_GLOBAL);
if (eslibrary) Sys_Printf("Loaded libGL.so.1.2\n");
}
if (!eslibrary)
{
eslibrary = dlopen("libGL.so.1", RTLD_NOW|RTLD_GLOBAL);
eslibrary = dlopen("libGL"ARCH_DL_POSTFIX".1", RTLD_NOW|RTLD_GLOBAL);
if (eslibrary) Sys_Printf("Loaded libGL.so.1\n");
}
if (!eslibrary)

View file

@ -1562,10 +1562,20 @@ static int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
stat = CreateMainWindow(info, true);
if (stat)
{
EGLConfig cfg;
maindc = GetDC(mainwindow);
stat = EGL_Init (info, palette, EGL_PLATFORM_WIN32, mainwindow, maindc, (EGLNativeWindowType)mainwindow, (EGLNativeDisplayType)maindc);
if (stat)
if (!EGL_InitDisplay(info, EGL_PLATFORM_WIN32, maindc, (EGLNativeDisplayType)maindc, &cfg))
{
Con_Printf("couldn't find suitable EGL config\n");
return false;
}
if (!EGL_InitWindow(info, EGL_PLATFORM_WIN32, mainwindow, (EGLNativeWindowType)mainwindow, cfg))
{
Con_Printf("couldn't initialise EGL context\n");
return false;
}
if (!GL_Init(info, &EGL_Proc))
return false;
}
@ -3369,7 +3379,7 @@ rendererinfo_t eglrendererinfo =
GLBE_Init,
GLBE_GenBrushModelVBO,
GLBE_ClearVBO,
GLBE_UploadAllLightmaps,
GLBE_UpdateLightmaps,
GLBE_SelectEntity,
GLBE_SelectDLight,
GLBE_Scissor,

View file

@ -62,7 +62,7 @@ void ModBrush_LoadGLStuff(void *ctx, void *data, size_t a, size_t b); //data ===
#define GLdouble GLfloat
#else
#ifdef _WIN32 //windows might use the standard header filename, but it still requires that we manually include windows.h first.
#ifndef WIN32_BLOATED
#if !defined(WIN32_BLOATED) && !defined(WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>

View file

@ -1271,8 +1271,8 @@ dllhandle_t *Sys_LoadLibrary(const char *name, dllfunction_t *funcs)
dllhandle_t *lib;
lib = dlopen (name, RTLD_LAZY);
if (!lib && !strstr(name, ".so"))
lib = dlopen (va("%s.so", name), RTLD_LAZY);
if (!lib && !strstr(name, ARCH_DL_POSTFIX))
lib = dlopen (va("%s"ARCH_DL_POSTFIX, name), RTLD_LAZY);
if (!lib)
{
const char *err = dlerror();