1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 19:43:06 +01:00
Files
OpenRCT2/src/platform/linux.c
2015-11-29 12:15:47 +01:00

60 lines
1.6 KiB
C

/*****************************************************************************
* Copyright (c) 2014 Ted John
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#if defined(__linux__)
#include "platform.h"
#include <dlfcn.h>
// 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_check_steam_overlay_attached() {
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) {
dlclose(processHandle);
return true;
}
pl = pl->next;
}
dlclose(processHandle);
return false;
}
#endif