From 1074992a3eb4e0f7087bf15d7a3ae375ed3a7520 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Mon, 23 Jul 2018 10:19:12 +0100 Subject: [PATCH] Attempt to load unversioned library for compatibility with older installations Games built against a new gamemode_client.h will fail to work with older GameMode installations without this change. There are no ABI changes right now so just attempt to load the old unversioned path if loading the versioned one fails. --- lib/gamemode_client.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/gamemode_client.h b/lib/gamemode_client.h index 465da5b..83971b7 100644 --- a/lib/gamemode_client.h +++ b/lib/gamemode_client.h @@ -154,12 +154,18 @@ __attribute__((always_inline)) static inline int internal_load_libgamemode(void) /* Try and load libgamemode */ libgamemode = dlopen("libgamemode.so.0", RTLD_NOW); if (!libgamemode) { - snprintf(internal_gamemode_client_error_string, - sizeof(internal_gamemode_client_error_string), - "dylopen failed - %s", - dlerror()); - internal_libgamemode_loaded = -1; - return -1; + /* Attempt to load unversioned library for compatibility with older + * versions (as of writing, there are no ABI changes between the two - + * this may need to change if ever ABI-breaking changes are made) */ + libgamemode = dlopen("libgamemode.so", RTLD_NOW); + if (!libgamemode) { + snprintf(internal_gamemode_client_error_string, + sizeof(internal_gamemode_client_error_string), + "dlopen failed - %s", + dlerror()); + internal_libgamemode_loaded = -1; + return -1; + } } /* Attempt to bind all symbols */