1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-26 19:54:14 +01:00

Fix gameinfo loading on Linux x64 S1 games

(cherry picked from commit 4bc5a3a0b7c9b92fc2365ab86f9d7d425459a547)
(cherry picked from commit 25270ffbd80f03fc3e0a89b9cf732b3fe287f4b5)
This commit is contained in:
Nicholas Hastings 2025-02-17 14:25:58 -05:00
parent b795893c26
commit 2165f730f2

View File

@ -2,7 +2,7 @@
* vim: set ts=4 sw=4 tw=99 noet : * vim: set ts=4 sw=4 tw=99 noet :
* ====================================================== * ======================================================
* Metamod:Source * Metamod:Source
* Copyright (C) 2004-2015 AlliedModders LLC and authors. * Copyright (C) 2004-2025 AlliedModders LLC and authors.
* All rights reserved. * All rights reserved.
* ====================================================== * ======================================================
* *
@ -59,28 +59,24 @@ static char mm_path[PLATFORM_MAX_PATH];
static bool g_is_source2 = false; static bool g_is_source2 = false;
#if defined _WIN32 #if defined _WIN32
#define SERVER_NAME "server.dll" #define SERVER_NAME_S1 "server.dll"
#define SERVER_NAME_S2 SERVER_NAME_S1
#if defined _WIN64 #if defined _WIN64
#define PLATFORM_NAME "win64" #define PLATFORM_SUBDIR_S1 "/"
#define PLATFORM_SUBDIR_S2 "/win64"
#else #else
#define PLATFORM_NAME "win32" #define PLATFORM_SUBDIR_S1 "/"
#endif #define PLATFORM_SUBDIR_S2 "/win32"
#elif defined __APPLE__
#define SERVER_NAME "server.dylib"
#if defined __amd64__
#define PLATFORM_NAME "osx64"
#else
#define PLATFORM_NAME "osx32"
#endif #endif
#elif defined __linux__ #elif defined __linux__
#define SERVER_NAME_S1 "server" LIB_SUFFIX
#define SERVER_NAME_S2 "libserver" LIB_SUFFIX
#if defined __amd64__ #if defined __amd64__
// hackhack - source2 uses libserver as name on POSIX, but source1 x64 does not #define PLATFORM_SUBDIR_S1 "/linux64"
// (but source1 x64 is also client-only right now so what-ev) #define PLATFORM_SUBDIR_S2 "/linuxsteamrt64"
#define SERVER_NAME "libserver" LIB_SUFFIX
#define PLATFORM_NAME "linuxsteamrt64"
#else #else
#define SERVER_NAME "server" LIB_SUFFIX #define PLATFORM_SUBDIR_S1 "/"
#define PLATFORM_NAME "linuxsteamrt32" #define PLATFORM_SUBDIR_S2 "/linuxsteamrt32"
#endif #endif
#endif #endif
@ -168,13 +164,14 @@ mm_DetectGameInformation()
} }
const char *pRelPath = is_source2 ? "../../" : ""; const char *pRelPath = is_source2 ? "../../" : "";
const char *pOSDir = is_source2 ? PLATFORM_NAME "/" : ""; const char *pOSDir = is_source2 ? PLATFORM_SUBDIR_S2 "/" : PLATFORM_SUBDIR_S1;
const char *pServerBin = is_source2 ? SERVER_NAME_S2 : SERVER_NAME_S1;
if (stricmp(key, "GameBin") == 0) if (stricmp(key, "GameBin") == 0)
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s/%s" SERVER_NAME, lptr, pRelPath, ptr, pOSDir); mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s%s/%s", lptr, pRelPath, ptr, pOSDir, pServerBin);
else if (!ptr[0]) else if (!ptr[0])
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%sbin/%s" SERVER_NAME, lptr, pRelPath, pOSDir); mm_PathFormat(temp_path, sizeof(temp_path), "%s/%sbin%s/%s", lptr, pRelPath, pOSDir, pServerBin);
else else
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s/bin/%s" SERVER_NAME, lptr, pRelPath, ptr, pOSDir); mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s/bin%s/%s", lptr, pRelPath, ptr, pOSDir, pServerBin);
if (mm_PathCmp(mm_path, temp_path)) if (mm_PathCmp(mm_path, temp_path))
continue; continue;