1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-30 19:52:17 +01:00

Fix regression in engine detection for some cases (bug 5963, r=asherkin).

This commit is contained in:
Nicholas Hastings 2013-10-24 13:24:22 -04:00
parent 53c8161e35
commit 78827f0ea2
4 changed files with 9 additions and 13 deletions

View File

@ -70,10 +70,7 @@ mm_DetectGameInformation()
game_info_detected = -1;
if (!mm_GetGameName(game_name, sizeof(game_name)))
{
return false;
}
mm_GetGameName(game_name, sizeof(game_name));
if (!mm_GetFileOfAddress((void*)mm_DetectGameInformation, mm_path, sizeof(mm_path)))
{

View File

@ -191,7 +191,7 @@ mm_GetProcAddress(const char *name)
return mm_GetLibAddress(mm_library, name);
}
bool
void
mm_GetGameName(char *buffer, size_t size)
{
buffer[0] = '\0';
@ -217,7 +217,6 @@ mm_GetGameName(char *buffer, size_t size)
LocalFree(wargv);
return buffer[0] != 0;
#elif defined __APPLE__
int argc = *_NSGetArgc();
char **argv = *_NSGetArgv();
@ -234,7 +233,6 @@ mm_GetGameName(char *buffer, size_t size)
break;
}
return buffer[0] != 0;
#elif defined __linux__
FILE *pFile = fopen("/proc/self/cmdline", "rb");
if (!pFile)
@ -262,10 +260,14 @@ mm_GetGameName(char *buffer, size_t size)
free(arg);
fclose(pFile);
return buffer[0] != 0;
#else
#error unsupported platform
#endif
if (buffer[0] == 0)
{
strncpy(buffer, ".", size);
}
}
MetamodBackend

View File

@ -116,7 +116,7 @@ mm_UnloadMetamodLibrary();
extern void
mm_LogFatal(const char *message, ...);
extern bool
extern void
mm_GetGameName(char *buffer, size_t size);
extern MetamodBackend

View File

@ -88,10 +88,7 @@ public:
/* Backend should already filled in if loaded as gamedll */
if (gamedll_bridge == NULL)
{
if (!mm_GetGameName(game_name, sizeof(game_name)))
{
return false;
}
mm_GetGameName(game_name, sizeof(game_name));
mm_backend = mm_DetermineBackend(engineFactory, game_name);
}