mirror of
https://github.com/lindbergh-loader/lindbergh-loader.git
synced 2026-10-14 01:49:12 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32d7347282 | ||
|
|
d500a5b80d | ||
|
|
e9390c85fa | ||
|
|
412d19e5f9 | ||
|
|
a374dec081 | ||
|
|
d1c98e6a7f | ||
|
|
1ade940d2f | ||
|
|
2e2a2b4052 | ||
|
|
23152f5788 | ||
|
|
efe34307e3 | ||
|
|
11b657e961 | ||
|
|
5ea59a05fd |
@@ -3,15 +3,19 @@ name: Automated Builds
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '.github/ISSUE_TEMPLATE/*'
|
||||
- '.docs/changelog'
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '.github/ISSUE_TEMPLATE/*'
|
||||
- '.docs/changelog'
|
||||
|
||||
jobs:
|
||||
linux-build:
|
||||
|
||||
@@ -2,6 +2,17 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [2.0.7]
|
||||
### Added
|
||||
- Option -g | --gamepath to lindbergh to point to games in a different folder.
|
||||
- lindbergh elf searches for lindbergh.so in common library folders ("/usr/lib/i386-linux-gnu", "/usr/lib32", etc).
|
||||
- Improved Distro detection function to inform that the Distro is not based on Debian.
|
||||
|
||||
## [2.0.6]
|
||||
### Fixed
|
||||
- Reverted (Fixed LGJ, VT3 and ID4/ID5 JVS passthrough).
|
||||
- Outrun 2 High Scores.
|
||||
|
||||
## [2.0.5]
|
||||
### Fixed
|
||||
- Fixed LGJ, VT3 and ID4/ID5 JVS passthrough.
|
||||
|
||||
+132
-19
@@ -177,32 +177,76 @@ static void handleSegfault(int signal, siginfo_t *info, void *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
char *checkIDlike()
|
||||
char *trimOS_ID(char *str)
|
||||
{
|
||||
FILE *file = fopen("/etc/os-release", "r");
|
||||
if (!file)
|
||||
if (!str)
|
||||
return str;
|
||||
|
||||
char *end;
|
||||
while (isspace((unsigned char)*str) || *str == '"' || *str == '\'')
|
||||
str++;
|
||||
|
||||
if (*str == 0)
|
||||
return str;
|
||||
|
||||
end = str + strlen(str) - 1;
|
||||
while (end > str && (isspace((unsigned char)*end) || *end == '"' || *end == '\''))
|
||||
end--;
|
||||
|
||||
*(end + 1) = '\0';
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
bool checkOS_ID()
|
||||
{
|
||||
FILE *fp = fopen("/etc/os-release", "r");
|
||||
if (!fp)
|
||||
{
|
||||
perror("Failed to open /etc/os-release");
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
char line[256];
|
||||
char *result = NULL;
|
||||
bool found = false;
|
||||
|
||||
while (fgets(line, sizeof(line), file))
|
||||
while (fgets(line, sizeof(line), fp))
|
||||
{
|
||||
if (strncmp(line, "ID_LIKE=", 8) == 0)
|
||||
if (strncmp(line, "ID=", 3) == 0)
|
||||
{
|
||||
char *id_like = strchr(line, '=');
|
||||
if (id_like)
|
||||
char *value = trimOS_ID(line + 3);
|
||||
if (strcmp(value, "debian") == 0 || strcmp(value, "ubuntu") == 0)
|
||||
{
|
||||
result = strdup(id_like);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strncmp(line, "ID_LIKE=", 8) == 0)
|
||||
{
|
||||
char value_part[256];
|
||||
strncpy(value_part, line + 8, sizeof(value_part) - 1);
|
||||
value_part[sizeof(value_part) - 1] = '\0';
|
||||
|
||||
char *value_trimmed = trimOS_ID(value_part);
|
||||
char *token = strtok(value_trimmed, " \t\n");
|
||||
|
||||
while (token != NULL)
|
||||
{
|
||||
char *clean_token = trimOS_ID(token);
|
||||
if (strcmp(clean_token, "debian") == 0 || strcmp(clean_token, "ubuntu") == 0)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
token = strtok(NULL, " \t\n");
|
||||
}
|
||||
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
return result;
|
||||
|
||||
fclose(fp);
|
||||
return found;
|
||||
}
|
||||
|
||||
void __attribute__((constructor)) hook_init()
|
||||
@@ -221,12 +265,7 @@ void __attribute__((constructor)) hook_init()
|
||||
|
||||
gId = getConfig()->crc32;
|
||||
|
||||
char *id_like = checkIDlike();
|
||||
if (id_like == NULL)
|
||||
{
|
||||
log_warn("Unable to get system info on current OS");
|
||||
}
|
||||
else if (strstr(id_like, "debian") == NULL)
|
||||
if (!checkOS_ID())
|
||||
{
|
||||
log_warn("Seems like you're not in debian-like system. There might be unexpected issues.");
|
||||
}
|
||||
@@ -337,9 +376,67 @@ DIR *opendir(const char *dirname)
|
||||
return _opendir(dirname + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Fix for Outrun high scores
|
||||
switch (gId)
|
||||
{
|
||||
case OUTRUN_2_SP_SDX:
|
||||
case OUTRUN_2_SP_SDX_REVA:
|
||||
case OUTRUN_2_SP_SDX_TEST:
|
||||
case OUTRUN_2_SP_SDX_REVA_TEST:
|
||||
case OUTRUN_2_SP_SDX_REVA_TEST2:
|
||||
{
|
||||
if (strcmp(dirname, "/home/disk1/rankingdata") == 0)
|
||||
{
|
||||
return _opendir("./rankingdata");
|
||||
}
|
||||
}
|
||||
}
|
||||
return _opendir(dirname);
|
||||
}
|
||||
|
||||
int remove(const char *path)
|
||||
{
|
||||
int (*_remove)(const char *path) = dlsym(RTLD_NEXT, "remove");
|
||||
|
||||
switch (gId)
|
||||
{
|
||||
case OUTRUN_2_SP_SDX:
|
||||
case OUTRUN_2_SP_SDX_REVA:
|
||||
case OUTRUN_2_SP_SDX_TEST:
|
||||
case OUTRUN_2_SP_SDX_REVA_TEST:
|
||||
case OUTRUN_2_SP_SDX_REVA_TEST2:
|
||||
{
|
||||
if (strcmp(path, "/home/disk1/rankingdata/%s") == 0)
|
||||
{
|
||||
return _remove("./rankingdata/%s");
|
||||
}
|
||||
}
|
||||
}
|
||||
return _remove(path);
|
||||
}
|
||||
|
||||
int mkdir(const char *path, mode_t mode)
|
||||
{
|
||||
int (*_mkdir)(const char *path, mode_t mode) = dlsym(RTLD_NEXT, "mkdir");
|
||||
|
||||
switch (gId)
|
||||
{
|
||||
case OUTRUN_2_SP_SDX:
|
||||
case OUTRUN_2_SP_SDX_REVA:
|
||||
case OUTRUN_2_SP_SDX_TEST:
|
||||
case OUTRUN_2_SP_SDX_REVA_TEST:
|
||||
case OUTRUN_2_SP_SDX_REVA_TEST2:
|
||||
{
|
||||
if (strcmp(path, "/home/disk1/rankingdata") == 0)
|
||||
{
|
||||
return _mkdir("./rankingdata", mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
return _mkdir(path, mode);
|
||||
}
|
||||
|
||||
int __xstat64(int ver, const char *path, struct stat64 *stat_buf)
|
||||
{
|
||||
int (*___xstat64)(int ver, const char *path, struct stat64 *stat_buf) = dlsym(RTLD_NEXT, "__xstat64");
|
||||
@@ -572,6 +669,22 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
|
||||
pathname = newPathname;
|
||||
}
|
||||
|
||||
// Fix for Outrun high scores
|
||||
switch (gId)
|
||||
{
|
||||
case OUTRUN_2_SP_SDX:
|
||||
case OUTRUN_2_SP_SDX_REVA:
|
||||
case OUTRUN_2_SP_SDX_TEST:
|
||||
case OUTRUN_2_SP_SDX_REVA_TEST:
|
||||
case OUTRUN_2_SP_SDX_REVA_TEST2:
|
||||
{
|
||||
if ((newPathname = strstr(pathname, "/home/disk1")) != NULL)
|
||||
{
|
||||
pathname = newPathname + 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This forces LGJ games and ID games to not use the pre-compiled shaders.
|
||||
if ((strstr(pathname, "asm_lbg") != NULL) || (strstr(pathname, "asm_gl") != NULL))
|
||||
{
|
||||
|
||||
+237
-30
@@ -1,8 +1,12 @@
|
||||
#include <dirent.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "evdevinput.h"
|
||||
#include "version.h"
|
||||
@@ -14,8 +18,10 @@
|
||||
#define PRELOAD_FILE_FLATPAK "/app/lib32/lindbergh.so"
|
||||
#define TEAM "bobbydilley, retrofan, dkeruza-neo, doozer, francesco, rolel, caviar-x"
|
||||
#define LINDBERGH_CONFIG_PATH "LINDBERGH_CONFIG_PATH"
|
||||
#define MAX_PATH_LEN 1024
|
||||
|
||||
uint32_t elf_crc = 0;
|
||||
char *ldPreloadLibrary = "";
|
||||
|
||||
// List of all lindbergh executables known, not including the test executables
|
||||
char *games[] = {"main.exe",
|
||||
@@ -149,13 +155,29 @@ int lookupCrcTable(uint32_t crc)
|
||||
|
||||
void isCleanElf(char *command)
|
||||
{
|
||||
const char *space_pos = strchr(command, ' ');
|
||||
size_t length = space_pos ? (size_t)(space_pos - command) : strlen(command);
|
||||
char *last_space = strrchr(command, ' ');
|
||||
size_t length;
|
||||
if (last_space != NULL && strcmp(last_space, " -t") == 0)
|
||||
length = (size_t)(last_space - command);
|
||||
else
|
||||
length = strlen(command);
|
||||
|
||||
char elfName[256];
|
||||
strncpy(elfName, command, length);
|
||||
elfName[length] = '\0';
|
||||
|
||||
// Remove double quotes from path if it was added.
|
||||
int j = 0;
|
||||
for (int i = 0; elfName[i] != '\0'; i++)
|
||||
{
|
||||
if (elfName[i] != '"')
|
||||
{
|
||||
elfName[j] = elfName[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
elfName[j] = '\0';
|
||||
|
||||
FILE *file = fopen(elfName, "rb");
|
||||
if (!file)
|
||||
{
|
||||
@@ -196,34 +218,54 @@ void isCleanElf(char *command)
|
||||
*/
|
||||
void testModePath(char *name)
|
||||
{
|
||||
char *pos;
|
||||
// Check if a different testmode elf is used
|
||||
if (strcmp(name, "./hod4M.elf") == 0)
|
||||
pos = strstr(name, "/hod4M.elf");
|
||||
if (pos != NULL)
|
||||
{
|
||||
strcpy(name, "./hod4testM.elf");
|
||||
strcpy(pos, "/hod4testM.elf");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(name, "./hodexRI.elf") == 0)
|
||||
pos = strstr(name, "/hodexRI.elf");
|
||||
if (pos != NULL)
|
||||
{
|
||||
strcpy(name, "./hodextestR.elf");
|
||||
strcpy(pos, "/hodextestR.elf");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(name, "./Jennifer") == 0)
|
||||
pos = strstr(name, "/Jennifer\"/Jennifer");
|
||||
if (pos != NULL)
|
||||
{
|
||||
strcpy(name, "../JenTest/JenTest");
|
||||
strcpy(pos, "/Jennifer\"/../JenTest/JenTest");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(name, "./apacheM.elf") == 0)
|
||||
pos = strstr(name, "/Jennifer");
|
||||
if (pos != NULL)
|
||||
{
|
||||
strcpy(name, "./apachetestM.elf");
|
||||
strcpy(pos, "/../JenTest/JenTest");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(name, "./vt3_Lindbergh") == 0)
|
||||
pos = strstr(name, "/apacheM.elf");
|
||||
if (pos != NULL)
|
||||
{
|
||||
strcpy(name, "./vt3_testmode");
|
||||
strcpy(pos, "/apachetestM.elf");
|
||||
return;
|
||||
}
|
||||
|
||||
pos = strstr(name, "/vt3_Lindbergh\"/vt3_Lindbergh");
|
||||
if (pos != NULL)
|
||||
{
|
||||
strcpy(pos, "/vt3_Lindbergh\"/vt3_testmode");
|
||||
return;
|
||||
}
|
||||
|
||||
pos = strstr(name, "/vt3_Lindbergh");
|
||||
if (pos != NULL)
|
||||
{
|
||||
strcpy(pos, "/vt3_testmode");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -231,6 +273,95 @@ void testModePath(char *name)
|
||||
strcat(name, " -t");
|
||||
}
|
||||
|
||||
bool isValidDirectory(const char *path)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
if (stat(path, &statbuf) != 0)
|
||||
return false;
|
||||
|
||||
return S_ISDIR(statbuf.st_mode);
|
||||
}
|
||||
|
||||
char *find32bLibFolder(void)
|
||||
{
|
||||
const char *candidates[] = {"lib32", "lib/i386-linux-gnu", "lib/i686-linux-gnu", "lib"};
|
||||
int num_candidates = sizeof(candidates) / sizeof(candidates[0]);
|
||||
|
||||
char current_path[PATH_MAX];
|
||||
struct stat st;
|
||||
char *result_path = NULL;
|
||||
|
||||
for (int i = 0; i < num_candidates; ++i)
|
||||
{
|
||||
int written = snprintf(current_path, sizeof(current_path), "/usr/%s", candidates[i]);
|
||||
|
||||
if (written < 0 || (size_t)written >= sizeof(current_path))
|
||||
continue;
|
||||
|
||||
if (stat(current_path, &st) == 0 && S_ISDIR(st.st_mode))
|
||||
{
|
||||
size_t path_len = strlen(current_path);
|
||||
result_path = (char *)malloc(path_len + 1);
|
||||
|
||||
if (result_path == NULL)
|
||||
{
|
||||
log_fatal("Failed to allocate memory for result path.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(result_path, current_path);
|
||||
return result_path;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *findLDPreloadLibrary()
|
||||
{
|
||||
const char *library_name = PRELOAD_FILE_NAME;
|
||||
static char *empty_string = "";
|
||||
char *found_path_ptr = NULL;
|
||||
|
||||
char *search_dir = find32bLibFolder();
|
||||
|
||||
if (search_dir == NULL || search_dir[0] == '\0')
|
||||
{
|
||||
log_error("Error: search_dir is NULL or empty.\n");
|
||||
return empty_string;
|
||||
}
|
||||
|
||||
char full_library_path[PATH_MAX];
|
||||
|
||||
int len_written = snprintf(full_library_path, sizeof(full_library_path), "%s/%s", search_dir, library_name);
|
||||
|
||||
if (len_written < 0 || (size_t)len_written >= sizeof(full_library_path))
|
||||
{
|
||||
log_error("find_preload_library_in_specific_dir: Warning: Constructed path is too long or invalid: %s/%s\n", search_dir,
|
||||
library_name);
|
||||
return empty_string;
|
||||
}
|
||||
|
||||
if (access(full_library_path, F_OK) == 0)
|
||||
{
|
||||
found_path_ptr = (char *)malloc(strlen(full_library_path) + 1);
|
||||
if (found_path_ptr == NULL)
|
||||
{
|
||||
log_error("find_preload_library_in_specific_dir: Failed to allocate memory for result path");
|
||||
return empty_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(found_path_ptr, full_library_path);
|
||||
return found_path_ptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return empty_string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sure the environment variables are set correctly
|
||||
* to run the game.
|
||||
@@ -252,10 +383,12 @@ void setEnvironmentVariables(int isFlatpak, int zink, int nvidia)
|
||||
setenv(LD_LIBRARY_PATH, libraryPath, 1);
|
||||
|
||||
// Ensure the preload path is set correctly
|
||||
if (!isFlatpak)
|
||||
setenv(LD_PRELOAD, PRELOAD_FILE_NAME, 1);
|
||||
else
|
||||
if (isFlatpak)
|
||||
setenv(LD_PRELOAD, PRELOAD_FILE_FLATPAK, 1);
|
||||
else if (strcmp(ldPreloadLibrary, "") != 0)
|
||||
setenv(LD_PRELOAD, ldPreloadLibrary, 1);
|
||||
else
|
||||
setenv(LD_PRELOAD, PRELOAD_FILE_NAME, 1);
|
||||
|
||||
if (zink)
|
||||
setenv("MESA_LOADER_DRIVER_OVERRIDE", "zink", 1);
|
||||
@@ -283,6 +416,7 @@ void printUsage(char *argv[])
|
||||
printf(" --version Displays the version of the loader and team's names\n");
|
||||
printf(" --help Displays this usage text\n");
|
||||
printf(" --config | -c Specifies configuration path\n");
|
||||
printf(" --gamepath | -g Specifies game path\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,9 +473,59 @@ int main(int argc, char *argv[])
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "--help") == 0)
|
||||
{
|
||||
printUsage(argv);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "--list-controllers") == 0)
|
||||
{
|
||||
return listControllers();
|
||||
}
|
||||
|
||||
// We save the current dir to return to it later
|
||||
char curDir[MAX_PATH_LEN];
|
||||
if (getcwd(curDir, sizeof(curDir)) == NULL)
|
||||
{
|
||||
log_error("Error: could not get the current directory.");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Check if a game folder was passed as a parameter
|
||||
char gamePath[PATH_MAX] = {0};
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i], "-g") == 0 || strcmp(argv[i], "--gamepath") == 0)
|
||||
{
|
||||
if (i + 1 >= argc)
|
||||
{
|
||||
break;
|
||||
}
|
||||
strncpy(gamePath, argv[i + 1], PATH_MAX);
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Look for the games
|
||||
struct dirent *ent;
|
||||
DIR *dir = opendir(".");
|
||||
DIR *dir;
|
||||
|
||||
if (gamePath[0] != '\0')
|
||||
{
|
||||
// Check if the passed folder is valid
|
||||
if (!isValidDirectory(gamePath))
|
||||
{
|
||||
log_error("The game folder is invalid.");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
dir = opendir(gamePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = opendir(curDir);
|
||||
}
|
||||
|
||||
if (dir == NULL)
|
||||
{
|
||||
@@ -387,16 +571,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
closedir(dir);
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "--help") == 0)
|
||||
{
|
||||
printUsage(argv);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "--list-controllers") == 0)
|
||||
{
|
||||
return listControllers();
|
||||
}
|
||||
ldPreloadLibrary = findLDPreloadLibrary();
|
||||
|
||||
if (!lindberghSharedObjectFound)
|
||||
{
|
||||
@@ -406,7 +581,7 @@ int main(int argc, char *argv[])
|
||||
fclose(file);
|
||||
isFlatpak = 1;
|
||||
}
|
||||
else
|
||||
else if (strcmp(ldPreloadLibrary, "") == 0)
|
||||
{
|
||||
log_error("The preload object lindbergh.so was not found in this directory.");
|
||||
return EXIT_FAILURE;
|
||||
@@ -466,6 +641,15 @@ int main(int argc, char *argv[])
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "-g") == 0 || strcmp(argv[i], "--gamepath") == 0)
|
||||
{
|
||||
if (i + 1 >= argc)
|
||||
break;
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Treat the argument as the game name
|
||||
strcpy(forceGamePath, argv[i]);
|
||||
forceGame = 1;
|
||||
@@ -475,14 +659,18 @@ int main(int argc, char *argv[])
|
||||
setEnvironmentVariables(isFlatpak, zink, nvidia);
|
||||
|
||||
char command[128] = {0};
|
||||
strcpy(command, "./");
|
||||
if (gamePath[0] != '\0')
|
||||
sprintf(command, "\"%s\"/", gamePath);
|
||||
else
|
||||
strcpy(command, "./");
|
||||
|
||||
if (forceGame)
|
||||
{
|
||||
strcat(command, forceGamePath);
|
||||
}
|
||||
else if (segaboot)
|
||||
{
|
||||
strcat(command, "segaboot -t");
|
||||
strcat(command, "segaboot -t");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -514,5 +702,24 @@ int main(int argc, char *argv[])
|
||||
|
||||
log_info("Starting $ %s", command);
|
||||
|
||||
return system(command);
|
||||
if (gamePath[0] != '\0')
|
||||
{
|
||||
if (chdir(gamePath) != 0)
|
||||
{
|
||||
log_error("Could not change to game path.");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
int sysCmd = system(command);
|
||||
|
||||
if (gamePath[0] != '\0')
|
||||
{
|
||||
if (chdir(curDir) != 0)
|
||||
{
|
||||
log_error("Could not return to the original directory.");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return sysCmd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user