From cafd6276c3a84da547436dd9653cc133c5e79ea8 Mon Sep 17 00:00:00 2001 From: dkeruza Date: Thu, 27 Feb 2025 16:26:25 -0500 Subject: [PATCH] Workaround 6 --- src/lindbergh/lindbergh.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/lindbergh/lindbergh.c b/src/lindbergh/lindbergh.c index 5de591f..3eb7f30 100644 --- a/src/lindbergh/lindbergh.c +++ b/src/lindbergh/lindbergh.c @@ -233,7 +233,7 @@ void testModePath(char *name) * Makes sure the environment variables are set correctly * to run the game. */ -void setEnvironmentVariables(int isFlatpak) +void setEnvironmentVariables(int isFlatpak, int zink) { // Ensure the library path is set correctly char libraryPath[128] = {0}; @@ -254,6 +254,9 @@ void setEnvironmentVariables(int isFlatpak) setenv(LD_PRELOAD, PRELOAD_FILE_NAME, 1); else setenv(LD_PRELOAD, PRELOAD_FILE_FLATPAK, 1); + + if(zink) + setenv("MESA_LOADER_DRIVER_OVERRIDE", "zink", 1); } /** @@ -400,13 +403,11 @@ int main(int argc, char *argv[]) } } - // Ensure environment variables are set correctly - setEnvironmentVariables(isFlatpak); - // Build up the command to start the game int testMode = 0; int gdb = 0; + int zink = 0; int forceGame = 0; int segaboot = 0; char extConfigPath[PATH_MAX] = {0}; @@ -431,6 +432,13 @@ int main(int argc, char *argv[]) gdb = 1; continue; } + + if (strcmp(argv[i], "--zink") == 0) + { + zink = 1; + continue; + } + if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--config") == 0) { if (i+1 >= argc) @@ -446,6 +454,9 @@ int main(int argc, char *argv[]) forceGame = 1; } + // Ensure environment variables are set correctly + setEnvironmentVariables(isFlatpak, zink); + char command[128] = {0}; strcpy(command, "./"); if (forceGame)