Skip to content

Commit 2165f73

Browse files
committed
Fix gameinfo loading on Linux x64 S1 games
(cherry picked from commit 4bc5a3a) (cherry picked from commit 25270ff)
1 parent b795893 commit 2165f73

1 file changed

Lines changed: 18 additions & 21 deletions

File tree

loader/gamedll.cpp

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* vim: set ts=4 sw=4 tw=99 noet :
33
* ======================================================
44
* Metamod:Source
5-
* Copyright (C) 2004-2015 AlliedModders LLC and authors.
5+
* Copyright (C) 2004-2025 AlliedModders LLC and authors.
66
* All rights reserved.
77
* ======================================================
88
*
@@ -59,28 +59,24 @@ static char mm_path[PLATFORM_MAX_PATH];
5959
static bool g_is_source2 = false;
6060

6161
#if defined _WIN32
62-
#define SERVER_NAME "server.dll"
62+
#define SERVER_NAME_S1 "server.dll"
63+
#define SERVER_NAME_S2 SERVER_NAME_S1
6364
#if defined _WIN64
64-
#define PLATFORM_NAME "win64"
65+
#define PLATFORM_SUBDIR_S1 "/"
66+
#define PLATFORM_SUBDIR_S2 "/win64"
6567
#else
66-
#define PLATFORM_NAME "win32"
67-
#endif
68-
#elif defined __APPLE__
69-
#define SERVER_NAME "server.dylib"
70-
#if defined __amd64__
71-
#define PLATFORM_NAME "osx64"
72-
#else
73-
#define PLATFORM_NAME "osx32"
68+
#define PLATFORM_SUBDIR_S1 "/"
69+
#define PLATFORM_SUBDIR_S2 "/win32"
7470
#endif
7571
#elif defined __linux__
72+
#define SERVER_NAME_S1 "server" LIB_SUFFIX
73+
#define SERVER_NAME_S2 "libserver" LIB_SUFFIX
7674
#if defined __amd64__
77-
// hackhack - source2 uses libserver as name on POSIX, but source1 x64 does not
78-
// (but source1 x64 is also client-only right now so what-ev)
79-
#define SERVER_NAME "libserver" LIB_SUFFIX
80-
#define PLATFORM_NAME "linuxsteamrt64"
75+
#define PLATFORM_SUBDIR_S1 "/linux64"
76+
#define PLATFORM_SUBDIR_S2 "/linuxsteamrt64"
8177
#else
82-
#define SERVER_NAME "server" LIB_SUFFIX
83-
#define PLATFORM_NAME "linuxsteamrt32"
78+
#define PLATFORM_SUBDIR_S1 "/"
79+
#define PLATFORM_SUBDIR_S2 "/linuxsteamrt32"
8480
#endif
8581
#endif
8682

@@ -168,13 +164,14 @@ mm_DetectGameInformation()
168164
}
169165

170166
const char *pRelPath = is_source2 ? "../../" : "";
171-
const char *pOSDir = is_source2 ? PLATFORM_NAME "/" : "";
167+
const char *pOSDir = is_source2 ? PLATFORM_SUBDIR_S2 "/" : PLATFORM_SUBDIR_S1;
168+
const char *pServerBin = is_source2 ? SERVER_NAME_S2 : SERVER_NAME_S1;
172169
if (stricmp(key, "GameBin") == 0)
173-
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s/%s" SERVER_NAME, lptr, pRelPath, ptr, pOSDir);
170+
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s%s/%s", lptr, pRelPath, ptr, pOSDir, pServerBin);
174171
else if (!ptr[0])
175-
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%sbin/%s" SERVER_NAME, lptr, pRelPath, pOSDir);
172+
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%sbin%s/%s", lptr, pRelPath, pOSDir, pServerBin);
176173
else
177-
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s/bin/%s" SERVER_NAME, lptr, pRelPath, ptr, pOSDir);
174+
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s/bin%s/%s", lptr, pRelPath, ptr, pOSDir, pServerBin);
178175

179176
if (mm_PathCmp(mm_path, temp_path))
180177
continue;

0 commit comments

Comments
 (0)