From b9cdcb2d81d9e7a688d35e065d4e34b5eeed290e Mon Sep 17 00:00:00 2001 From: DanTheMan827 <790119+DanTheMan827@users.noreply.github.com> Date: Fri, 22 Jan 2021 11:15:23 -0600 Subject: [PATCH 1/2] Load gamecontrollerdb.txt before SDL_Init --- src/pc/controller/controller_sdl2.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pc/controller/controller_sdl2.c b/src/pc/controller/controller_sdl2.c index a71a82eb..c7e9c7c7 100644 --- a/src/pc/controller/controller_sdl2.c +++ b/src/pc/controller/controller_sdl2.c @@ -89,13 +89,6 @@ static void controller_sdl_bind(void) { } static void controller_sdl_init(void) { - if (SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_EVENTS) != 0) { - fprintf(stderr, "SDL init error: %s\n", SDL_GetError()); - return; - } - - haptics_enabled = (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0); - // try loading an external gamecontroller mapping file uint64_t gcsize = 0; void *gcdata = fs_load_file("gamecontrollerdb.txt", &gcsize); @@ -109,6 +102,13 @@ static void controller_sdl_init(void) { free(gcdata); } + if (SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_EVENTS) != 0) { + fprintf(stderr, "SDL init error: %s\n", SDL_GetError()); + return; + } + + haptics_enabled = (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0); + #ifdef BETTERCAMERA if (newcam_mouse == 1) SDL_SetRelativeMouseMode(SDL_TRUE); From f9a26149ebf4d18a9743c2abb8d0b72264b1ae1f Mon Sep 17 00:00:00 2001 From: DanTheMan827 <790119+DanTheMan827@users.noreply.github.com> Date: Sun, 24 Jan 2021 14:48:15 -0600 Subject: [PATCH 2/2] Add NO_PIE option --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 772f31a7..621aedd9 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,9 @@ TARGET_WEB ?= 0 # Makeflag to enable OSX fixes OSX_BUILD ?= 0 +# Enable -no-pie linker option +NO_PIE ?= 1 + # Specify the target you are building for, TARGET_BITS=0 means native TARGET_ARCH ?= native TARGET_BITS ?= 0 @@ -638,9 +641,13 @@ else ifeq ($(OSX_BUILD),1) LDFLAGS := -lm $(BACKEND_LDFLAGS) -no-pie -lpthread else - LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -lm $(BACKEND_LDFLAGS) -no-pie -lpthread + LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -lm $(BACKEND_LDFLAGS) -lpthread -ldl + ifeq ($(NO_PIE), 1) + LDFLAGS += -no-pie + endif + ifeq ($(DISCORDRPC),1) - LDFLAGS += -ldl -Wl,-rpath . + LDFLAGS += -Wl,-rpath . endif endif # End of LDFLAGS