Compare commits

..
4 Commits
Author SHA1 Message Date
dkeruza 7b426f0d11 Workaround - Ups 2025-02-27 00:11:06 -05:00
dkeruza 442d03b144 Update lindbergh.cWorkaround 2025-02-26 22:14:11 -05:00
dkeruza 50a1a35f7f Workaround 2025-02-26 22:05:53 -05:00
dkeruza 728c308835 Workaround 2025-02-17 22:14:12 -05:00
3 changed files with 40 additions and 12 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ lindbergh.so: $(OBJS)
$(CC) $(CFLAGS) -c $< -o $@
libsegaapi.so: src/libsegaapi/libsegaapi.o
gcc -m32 -O0 -g src/libsegaapi/libsegaapi.c -lFAudio -fPIC -shared -o $(BUILD)/libsegaapi.so
$(CC) -m32 -O0 -g src/libsegaapi/libsegaapi.c -lFAudio -L/app/lib32 -fPIC -shared -o $(BUILD)/libsegaapi.so
libkswapapi.so: src/libkswapapi/libkswapapi.o
$(CC) src/libkswapapi/libkswapapi.o -fPIC -shared -o $(BUILD)/libkswapapi.so
+21 -7
View File
@@ -11,6 +11,7 @@
#define LD_LIBRARY_PATH "LD_LIBRARY_PATH"
#define LD_PRELOAD "LD_PRELOAD"
#define PRELOAD_FILE_NAME "lindbergh.so"
#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"
@@ -232,7 +233,7 @@ void testModePath(char *name)
* Makes sure the environment variables are set correctly
* to run the game.
*/
void setEnvironmentVariables()
void setEnvironmentVariables(int isFlatpak)
{
// Ensure the library path is set correctly
char libraryPath[128] = {0};
@@ -249,7 +250,10 @@ void setEnvironmentVariables()
setenv(LD_LIBRARY_PATH, libraryPath, 1);
// Ensure the preload path is set correctly
setenv(LD_PRELOAD, PRELOAD_FILE_NAME, 1);
if (!isFlatpak)
setenv(LD_PRELOAD, PRELOAD_FILE_NAME, 1);
else
setenv(LD_PRELOAD, PRELOAD_FILE_FLATPAK, 1);
}
/**
@@ -316,9 +320,6 @@ void printVersion() {
*/
int main(int argc, char *argv[])
{
// Ensure environment variables are set correctly
setEnvironmentVariables();
// Check for --version before directory operations
if (argc > 1 && strcmp(argv[1], "--version") == 0) {
printVersion();
@@ -338,6 +339,7 @@ int main(int argc, char *argv[])
char *game = NULL;
int lindberghSharedObjectFound = 0;
int isFlatpak = 0;
while ((ent = readdir(dir)) != NULL)
{
@@ -385,10 +387,22 @@ int main(int argc, char *argv[])
if (!lindberghSharedObjectFound)
{
log_error("The preload object lindbergh.so was not found in this directory.");
return EXIT_FAILURE;
FILE *file = fopen(PRELOAD_FILE_FLATPAK, "r");
if (file)
{
fclose(file);
isFlatpak = 1;
}
else
{
log_error("The preload object lindbergh.so was not found in this directory.");
return EXIT_FAILURE;
}
}
// Ensure environment variables are set correctly
setEnvironmentVariables(isFlatpak);
// Build up the command to start the game
int testMode = 0;
+18 -4
View File
@@ -1432,16 +1432,30 @@ int parseCgcArgs(const char *input, const char ***compilerArgs, const char **out
void loadLibCg()
{
int isFlatpak = 0;
void *handle = dlopen("./libCg.so", RTLD_NOW);
if (!handle)
{
fprintf(stderr, "Error: Unable to load library libCg.so %s\n", dlerror());
fprintf(stderr, "Error: libCg.so version 2.0 is needed to compile the shaders in the game's folder.\n");
exit(1);
handle = dlopen("/app/lib32/libCg2.so", RTLD_NOW);
if (!handle)
{
fprintf(stderr, "Error: Unable to load library libCg.so %s\n", dlerror());
fprintf(stderr, "Error: libCg.so version 2.0 is needed to compile the shaders in the game's folder.\n");
exit(1);
}
else
{
isFlatpak = 1;
}
}
char libCgVersion[9];
FILE *libF = fopen("./libCg.so", "r");
FILE *libF;
if (isFlatpak)
libF = fopen("/app.lib32/libCg.so", "r");
else
libF = fopen("./libCg.so", "r");
fseek(libF, 0x226d84, SEEK_SET);
fread(libCgVersion, 9, 1, libF);
fclose(libF);