Hook the setenv function to fix display variable
This commit is contained in:
parent
54272aef11
commit
231be58dfa
@ -108,7 +108,6 @@ static void handleSegfault(int signal, siginfo_t *info, void *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void __attribute__((constructor)) hook_init()
|
||||
{
|
||||
printf("SEGA Lindbergh Loader\nRobert Dilley 2022\nNot for public consumption\n\n");
|
||||
@ -121,7 +120,7 @@ void __attribute__((constructor)) hook_init()
|
||||
|
||||
initConfig();
|
||||
|
||||
if(initPatch() != 0)
|
||||
if (initPatch() != 0)
|
||||
exit(1);
|
||||
|
||||
if (initEeprom() != 0)
|
||||
@ -494,3 +493,33 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
|
||||
|
||||
return _connect(sockfd, addr, addrlen);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the game changing the DISPLAY environment variable
|
||||
*/
|
||||
int setenv(const char *name, const char *value, int overwrite)
|
||||
{
|
||||
int (*_setenv)(const char *name, const char *value, int overwrite) = dlsym(RTLD_NEXT, "setenv");
|
||||
|
||||
if (strcmp(name, "DISPLAY") == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _setenv(name, value, overwrite);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the game unsetting the DISPLAY environment variable
|
||||
*/
|
||||
int unsetenv(const char *name)
|
||||
{
|
||||
int (*_unsetenv)(const char *name) = dlsym(RTLD_NEXT, "unsetenv");
|
||||
|
||||
if (strcmp(name, "DISPLAY") == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _unsetenv(name);
|
||||
}
|
Loading…
Reference in New Issue
Block a user