Fix Windows build, hopefully fix High DPI support on Windows 10 (fixes #202)

This commit is contained in:
Lior Halphon 2020-01-01 00:27:41 +02:00
parent 7929573dc1
commit 3882b1b4b9
2 changed files with 7 additions and 3 deletions

View File

@ -102,7 +102,7 @@ GL_LDFLAGS := $(shell $(PKG_CONFIG) --libs gl || echo -lGL)
endif endif
ifeq ($(PLATFORM),windows32) ifeq ($(PLATFORM),windows32)
CFLAGS += -IWindows -Drandom=rand CFLAGS += -IWindows -Drandom=rand
LDFLAGS += -lmsvcrt -lcomdlg32 -lSDL2main -Wl,/MANIFESTFILE:NUL LDFLAGS += -lmsvcrt -lcomdlg32 -luser32 -lSDL2main -Wl,/MANIFESTFILE:NUL
SDL_LDFLAGS := -lSDL2 SDL_LDFLAGS := -lSDL2
GL_LDFLAGS := -lopengl32 GL_LDFLAGS := -lopengl32
else else
@ -291,11 +291,11 @@ endif
# Windows version builds two, one with a conole and one without it # Windows version builds two, one with a conole and one without it
$(BIN)/SDL/sameboy.exe: $(CORE_OBJECTS) $(SDL_OBJECTS) $(OBJ)/Windows/resources.o $(BIN)/SDL/sameboy.exe: $(CORE_OBJECTS) $(SDL_OBJECTS) $(OBJ)/Windows/resources.o
-@$(MKDIR) -p $(dir $@) -@$(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 $(BIN)/SDL/sameboy_debugger.exe: $(CORE_OBJECTS) $(SDL_OBJECTS) $(OBJ)/Windows/resources.o
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
$(CC) $^ -o $@ $(LDFLAGS) $(SDL_LDFLAGS) -Wl,/subsystem:console $(CC) $^ -o $@ $(LDFLAGS) $(SDL_LDFLAGS) $(GL_LDFLAGS) -Wl,/subsystem:console
ifneq ($(USE_WINDRES),) ifneq ($(USE_WINDRES),)
$(OBJ)/%.o: %.rc $(OBJ)/%.o: %.rc

4
SDL/main.c Executable file → Normal file
View File

@ -10,6 +10,7 @@
#ifndef _WIN32 #ifndef _WIN32
#include <Windows.h>
#define AUDIO_FREQUENCY 96000 #define AUDIO_FREQUENCY 96000
#else #else
/* Windows (well, at least my VM) can't handle 96KHz sound well :( */ /* 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) int main(int argc, char **argv)
{ {
#ifdef _WIN32
SetProcessDPIAware();
#endif
#define str(x) #x #define str(x) #x
#define xstr(x) str(x) #define xstr(x) str(x)
fprintf(stderr, "SameBoy v" xstr(VERSION) "\n"); fprintf(stderr, "SameBoy v" xstr(VERSION) "\n");