mirror of
https://github.com/lindbergh-loader/lindbergh-loader.git
synced 2026-10-14 09:59:08 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cafd6276c3 | ||
|
|
a2dbf1cbda | ||
|
|
74d61985ec | ||
|
|
4d0996b905 | ||
|
|
52cb3eaf6b | ||
|
|
8b6604efc5 | ||
|
|
7b426f0d11 |
@@ -1,7 +1,8 @@
|
||||
CC = gcc -m32 -pthread
|
||||
CFLAGS = -g -fPIC -m32 -Wall -Werror -Wno-misleading-indentation -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-function -D_GNU_SOURCE -Wno-char-subscripts
|
||||
LD = g++ -m32
|
||||
LDFLAGS = -Wl,-z,defs -rdynamic -static-libgcc -lc -ldl -lGL -lglut -lX11 -lSDL2 -lm -lpthread -shared -nostdlib -lasound -L./src/libxdiff -lxdiff
|
||||
CC ?= gcc
|
||||
CFLAGS = -g -fPIC -m32 -pthread -Wall -Werror -Wno-misleading-indentation -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-function -D_GNU_SOURCE -Wno-char-subscripts
|
||||
CXX ?= g++
|
||||
LD = $(CXX)
|
||||
LDFLAGS = -m32 -Wl,-z,defs -rdynamic -static-libgcc -lc -ldl -lGL -lglut -lX11 -lXcursor -lSDL2 -lm -lpthread -shared -nostdlib -lasound -L./src/libxdiff -lxdiff -L/app/lib32
|
||||
|
||||
BUILD = build
|
||||
|
||||
@@ -17,14 +18,14 @@ all: lindbergh libxdiff.a lindbergh.so libsegaapi.so libkswapapi.so libposixtime
|
||||
|
||||
lindbergh: src/lindbergh/lindbergh.c src/lindbergh/log.c src/lindbergh/log.h src/lindbergh/jvs.c src/lindbergh/jvs.h src/lindbergh/config.h src/lindbergh/config.c src/lindbergh/evdevinput.h src/lindbergh/evdevinput.c
|
||||
mkdir -p $(BUILD)
|
||||
$(CC) src/lindbergh/lindbergh.c src/lindbergh/log.h src/lindbergh/log.c src/lindbergh/jvs.h src/lindbergh/jvs.c src/lindbergh/config.h src/lindbergh/config.c src/lindbergh/evdevinput.c src/lindbergh/evdevinput.h -o $(BUILD)/lindbergh -lm
|
||||
$(CC) -m32 src/lindbergh/lindbergh.c src/lindbergh/log.h src/lindbergh/log.c src/lindbergh/jvs.h src/lindbergh/jvs.c src/lindbergh/config.h src/lindbergh/config.c src/lindbergh/evdevinput.c src/lindbergh/evdevinput.h -o $(BUILD)/lindbergh -lm
|
||||
|
||||
libxdiff.a: $(XDIFF_OBJS)
|
||||
mkdir -p $(BUILD)
|
||||
ar rcs src/libxdiff/libxdiff.a $(XDIFF_OBJS)
|
||||
|
||||
src/libxdiff/xdiff/%.o: src/libxdiff/xdiff/%.c
|
||||
$(CC) -DHAVE_CONFIG_H -fPIC -c $< -o $@
|
||||
$(CC) -m32 -DHAVE_CONFIG_H -fPIC -c $< -o $@
|
||||
|
||||
lindbergh.so: $(OBJS)
|
||||
mkdir -p $(BUILD)
|
||||
@@ -37,10 +38,10 @@ libsegaapi.so: src/libsegaapi/libsegaapi.o
|
||||
$(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
|
||||
$(CC) -m32 src/libkswapapi/libkswapapi.o -fPIC -shared -o $(BUILD)/libkswapapi.so
|
||||
|
||||
libposixtime.so:
|
||||
$(CC) src/libposixtime/libposixtime.c src/libposixtime/libposixtime.h -m32 -shared -o $(BUILD)/libposixtime.so
|
||||
$(CC) -m32 src/libposixtime/libposixtime.c src/libposixtime/libposixtime.h -m32 -shared -o $(BUILD)/libposixtime.so
|
||||
ln -s -f libposixtime.so $(BUILD)/libposixtime.so.1
|
||||
ln -s -f libposixtime.so $(BUILD)/libposixtime.so.2.4
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1432,6 +1432,7 @@ 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)
|
||||
{
|
||||
@@ -1442,10 +1443,19 @@ void loadLibCg()
|
||||
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/libCg2.so", "r");
|
||||
else
|
||||
libF = fopen("./libCg.so", "r");
|
||||
|
||||
fseek(libF, 0x226d84, SEEK_SET);
|
||||
fread(libCgVersion, 9, 1, libF);
|
||||
fclose(libF);
|
||||
|
||||
Reference in New Issue
Block a user