|
2 | 2 | * vim: set ts=4 sw=4 tw=99 noet : |
3 | 3 | * ====================================================== |
4 | 4 | * Metamod:Source |
5 | | - * Copyright (C) 2004-2015 AlliedModders LLC and authors. |
| 5 | + * Copyright (C) 2004-2025 AlliedModders LLC and authors. |
6 | 6 | * All rights reserved. |
7 | 7 | * ====================================================== |
8 | 8 | * |
@@ -60,28 +60,24 @@ static char mm_path[PLATFORM_MAX_PATH]; |
60 | 60 | static bool g_is_source2 = false; |
61 | 61 |
|
62 | 62 | #if defined _WIN32 |
63 | | -#define SERVER_NAME "server.dll" |
| 63 | +#define SERVER_NAME_S1 "server.dll" |
| 64 | +#define SERVER_NAME_S2 SERVER_NAME_S1 |
64 | 65 | #if defined _WIN64 |
65 | | -#define PLATFORM_NAME "win64" |
| 66 | +#define PLATFORM_SUBDIR_S1 "/" |
| 67 | +#define PLATFORM_SUBDIR_S2 "/win64" |
66 | 68 | #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" |
75 | 71 | #endif |
76 | 72 | #elif defined __linux__ |
| 73 | +#define SERVER_NAME_S1 "server" LIB_SUFFIX |
| 74 | +#define SERVER_NAME_S2 "libserver" LIB_SUFFIX |
77 | 75 | #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" |
82 | 78 | #else |
83 | | -#define SERVER_NAME "server" LIB_SUFFIX |
84 | | -#define PLATFORM_NAME "linuxsteamrt32" |
| 79 | +#define PLATFORM_SUBDIR_S1 "/" |
| 80 | +#define PLATFORM_SUBDIR_S2 "/linuxsteamrt32" |
85 | 81 | #endif |
86 | 82 | #endif |
87 | 83 |
|
@@ -169,13 +165,14 @@ mm_DetectGameInformation() |
169 | 165 | } |
170 | 166 |
|
171 | 167 | 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; |
173 | 170 | 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); |
175 | 172 | 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); |
177 | 174 | 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); |
179 | 176 |
|
180 | 177 | if (mm_PathCmp(mm_path, temp_path)) |
181 | 178 | continue; |
|
0 commit comments