From 3882b1b4b9ab34361211cbf7840e2f11d888a16f Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Wed, 1 Jan 2020 00:27:41 +0200 Subject: [PATCH] Fix Windows build, hopefully fix High DPI support on Windows 10 (fixes #202) --- Makefile | 6 +++--- SDL/main.c | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) mode change 100755 => 100644 SDL/main.c diff --git a/Makefile b/Makefile index 1c23610..4417528 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,7 @@ GL_LDFLAGS := $(shell $(PKG_CONFIG) --libs gl || echo -lGL) endif ifeq ($(PLATFORM),windows32) CFLAGS += -IWindows -Drandom=rand -LDFLAGS += -lmsvcrt -lcomdlg32 -lSDL2main -Wl,/MANIFESTFILE:NUL +LDFLAGS += -lmsvcrt -lcomdlg32 -luser32 -lSDL2main -Wl,/MANIFESTFILE:NUL SDL_LDFLAGS := -lSDL2 GL_LDFLAGS := -lopengl32 else @@ -291,11 +291,11 @@ endif # Windows version builds two, one with a conole and one without it $(BIN)/SDL/sameboy.exe: $(CORE_OBJECTS) $(SDL_OBJECTS) $(OBJ)/Windows/resources.o -@$(MKDIR) -p $(dir $@) - $(CC) $^ -o $@ $(LDFLAGS) $(SDL_LDFLAGS) -Wl,/subsystem:windows + $(CC) $^ -o $@ $(LDFLAGS) $(SDL_LDFLAGS) $(GL_LDFLAGS) -Wl,/subsystem:windows $(BIN)/SDL/sameboy_debugger.exe: $(CORE_OBJECTS) $(SDL_OBJECTS) $(OBJ)/Windows/resources.o -@$(MKDIR) -p $(dir $@) - $(CC) $^ -o $@ $(LDFLAGS) $(SDL_LDFLAGS) -Wl,/subsystem:console + $(CC) $^ -o $@ $(LDFLAGS) $(SDL_LDFLAGS) $(GL_LDFLAGS) -Wl,/subsystem:console ifneq ($(USE_WINDRES),) $(OBJ)/%.o: %.rc diff --git a/SDL/main.c b/SDL/main.c old mode 100755 new mode 100644 index 51e7c1a..96f4994 --- a/SDL/main.c +++ b/SDL/main.c @@ -10,6 +10,7 @@ #ifndef _WIN32 +#include #define AUDIO_FREQUENCY 96000 #else /* Windows (well, at least my VM) can't handle 96KHz sound well :( */ @@ -551,6 +552,9 @@ static bool get_arg_flag(const char *flag, int *argc, char **argv) int main(int argc, char **argv) { +#ifdef _WIN32 + SetProcessDPIAware(); +#endif #define str(x) #x #define xstr(x) str(x) fprintf(stderr, "SameBoy v" xstr(VERSION) "\n");