Skip to content

Commit 4bc5a3a

Browse files
committed
Fix gameinfo loading on Linux x64 S1 games
1 parent 6c5847e commit 4bc5a3a

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

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
*
@@ -60,28 +60,24 @@ static char mm_path[PLATFORM_MAX_PATH];
6060
static bool g_is_source2 = false;
6161

6262
#if defined _WIN32
63-
#define SERVER_NAME "server.dll"
63+
#define SERVER_NAME_S1 "server.dll"
64+
#define SERVER_NAME_S2 SERVER_NAME_S1
6465
#if defined _WIN64
65-
#define PLATFORM_NAME "win64"
66+
#define PLATFORM_SUBDIR_S1 "/"
67+
#define PLATFORM_SUBDIR_S2 "/win64"
6668
#else
67-
#define PLATFORM_NAME "win32"
68-
#endif
69-
#elif defined __APPLE__
70-
#define SERVER_NAME "server.dylib"
71-
#if defined __amd64__
72-
#define PLATFORM_NAME "osx64"
73-
#else
74-
#define PLATFORM_NAME "osx32"
69+
#define PLATFORM_SUBDIR_S1 "/"
70+
#define PLATFORM_SUBDIR_S2 "/win32"
7571
#endif
7672
#elif defined __linux__
73+
#define SERVER_NAME_S1 "server" LIB_SUFFIX
74+
#define SERVER_NAME_S2 "libserver" LIB_SUFFIX
7775
#if defined __amd64__
78-
// hackhack - source2 uses libserver as name on POSIX, but source1 x64 does not
79-
// (but source1 x64 is also client-only right now so what-ev)
80-
#define SERVER_NAME "libserver" LIB_SUFFIX
81-
#define PLATFORM_NAME "linuxsteamrt64"
76+
#define PLATFORM_SUBDIR_S1 "/linux64"
77+
#define PLATFORM_SUBDIR_S2 "/linuxsteamrt64"
8278
#else
83-
#define SERVER_NAME "server" LIB_SUFFIX
84-
#define PLATFORM_NAME "linuxsteamrt32"
79+
#define PLATFORM_SUBDIR_S1 "/"
80+
#define PLATFORM_SUBDIR_S2 "/linuxsteamrt32"
8581
#endif
8682
#endif
8783

@@ -169,13 +165,14 @@ mm_DetectGameInformation()
169165
}
170166

171167
const char *pRelPath = is_source2 ? "../../" : "";
172-
const char *pOSDir = is_source2 ? PLATFORM_NAME "/" : "";
168+
const char *pOSDir = is_source2 ? PLATFORM_SUBDIR_S2 "/" : PLATFORM_SUBDIR_S1;
169+
const char *pServerBin = is_source2 ? SERVER_NAME_S2 : SERVER_NAME_S1;
173170
if (stricmp(key, "GameBin") == 0)
174-
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s/%s" SERVER_NAME, lptr, pRelPath, ptr, pOSDir);
171+
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s%s/%s", lptr, pRelPath, ptr, pOSDir, pServerBin);
175172
else if (!ptr[0])
176-
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%sbin/%s" SERVER_NAME, lptr, pRelPath, pOSDir);
173+
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%sbin%s/%s", lptr, pRelPath, pOSDir, pServerBin);
177174
else
178-
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s/bin/%s" SERVER_NAME, lptr, pRelPath, ptr, pOSDir);
175+
mm_PathFormat(temp_path, sizeof(temp_path), "%s/%s%s/bin%s/%s", lptr, pRelPath, ptr, pOSDir, pServerBin);
179176

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

0 commit comments

Comments
 (0)