mirror of https://github.com/OpenRCT2/OpenRCT2.git
Rewrite platform_is_steam_overlay_attached for Unix to detect all possible situations
This commit is contained in:
parent
84bf968b23
commit
af6a6bb8be
|
@ -43,8 +43,35 @@ char platform_get_path_separator()
|
|||
}
|
||||
*/
|
||||
|
||||
// See http://syprog.blogspot.ru/2011/12/listing-loaded-shared-objects-in-linux.html
|
||||
struct lmap {
|
||||
void* base_address;
|
||||
char* path;
|
||||
void* unused;
|
||||
struct lmap *next, *prev;
|
||||
};
|
||||
|
||||
struct dummy {
|
||||
void* pointers[3];
|
||||
struct dummy* ptr;
|
||||
};
|
||||
|
||||
bool platform_is_steam_overlay_attached() {
|
||||
return dlopen("gameoverlayrenderer.so", RTLD_NOW | RTLD_NOLOAD) != NULL;
|
||||
void* processHandle = dlopen(NULL, RTLD_NOW);
|
||||
|
||||
struct dummy* p = (struct dummy*) processHandle;
|
||||
p = p->ptr;
|
||||
|
||||
struct lmap* pl = (struct lmap*) p->ptr;
|
||||
|
||||
while (pl != NULL) {
|
||||
if (strstr(pl->path, "gameoverlayrenderer.so") != NULL) {
|
||||
return true;
|
||||
}
|
||||
pl = pl->next;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue