From 3edcab0b467d87ab76c7ac72c58fb8466b3e0c04 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 2 Jul 2018 15:21:40 +0100 Subject: [PATCH 1/4] [SDL] SDL_CreateRGBSurface flags are deprecated in SDL2 --- sdl/sdl2/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdl/sdl2/main.c b/sdl/sdl2/main.c index 6121f71..fb42b68 100644 --- a/sdl/sdl2/main.c +++ b/sdl/sdl2/main.c @@ -150,7 +150,7 @@ static int sdl_video_init() } sdl_video.window = SDL_CreateWindow("Genesis Plus GX", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, VIDEO_WIDTH, VIDEO_HEIGHT, fullscreen); sdl_video.surf_screen = SDL_GetWindowSurface(sdl_video.window); - sdl_video.surf_bitmap = SDL_CreateRGBSurfaceWithFormat(SDL_SWSURFACE, 720, 576, SDL_BITSPERPIXEL(surface_format), surface_format); + sdl_video.surf_bitmap = SDL_CreateRGBSurfaceWithFormat(0, 720, 576, SDL_BITSPERPIXEL(surface_format), surface_format); sdl_video.frames_rendered = 0; SDL_ShowCursor(0); return 1; From 5eafe5b0cca17d96b2c5c031d2daa592f4a8504e Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 2 Jul 2018 21:04:35 +0100 Subject: [PATCH 2/4] [SDL] the window surface should not be freed According to SDL's docs, the window surface is freed automatically by other functions (SDL_Quit in SDL1.2, and SDL_DestroyWindow in SDL2). I think this might have actually been the cause of those segmentation errors upon closing that I noticed back when I opened #114. --- sdl/sdl1/main.c | 5 +---- sdl/sdl2/main.c | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sdl/sdl1/main.c b/sdl/sdl1/main.c index c4ab724..fefcb5e 100644 --- a/sdl/sdl1/main.c +++ b/sdl/sdl1/main.c @@ -244,10 +244,7 @@ static void sdl_video_update() static void sdl_video_close() { - if (sdl_video.surf_bitmap) - SDL_FreeSurface(sdl_video.surf_bitmap); - if (sdl_video.surf_screen) - SDL_FreeSurface(sdl_video.surf_screen); + SDL_FreeSurface(sdl_video.surf_bitmap); } /* Timer Sync */ diff --git a/sdl/sdl2/main.c b/sdl/sdl2/main.c index fb42b68..7e9b6ef 100644 --- a/sdl/sdl2/main.c +++ b/sdl/sdl2/main.c @@ -250,10 +250,8 @@ static void sdl_video_update() static void sdl_video_close() { - if (sdl_video.surf_bitmap) - SDL_FreeSurface(sdl_video.surf_bitmap); - if (sdl_video.surf_screen) - SDL_FreeSurface(sdl_video.surf_screen); + SDL_FreeSurface(sdl_video.surf_bitmap); + SDL_DestroyWindow(sdl_video.window); } /* Timer Sync */ From 7a4e30d27ee4ecdd80766fa5dc9511af93bdd0b0 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 9 Jul 2018 17:41:36 +0100 Subject: [PATCH 3/4] [Core/CD] fix libFLAC compilation on MinGW-w64 Without autotools, fseeko cannot be detected automatically, so we cheat a little. --- core/cd_hw/libchdr/deps/libFLAC/include/share/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/cd_hw/libchdr/deps/libFLAC/include/share/compat.h b/core/cd_hw/libchdr/deps/libFLAC/include/share/compat.h index dcb9350..744aabb 100644 --- a/core/cd_hw/libchdr/deps/libFLAC/include/share/compat.h +++ b/core/cd_hw/libchdr/deps/libFLAC/include/share/compat.h @@ -53,7 +53,7 @@ #define fseeko _fseeki64 #define ftello _ftelli64 #else /* MinGW */ -#if !defined(HAVE_FSEEKO) +#if !defined(HAVE_FSEEKO) && !defined(__MINGW64_VERSION_MAJOR) #define fseeko fseeko64 #define ftello ftello64 #endif From 49b90b966c82021610bfee5308217f068f7a8a38 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 9 Jul 2018 21:00:24 +0100 Subject: [PATCH 4/4] [SDL] remove -ansi compiler flag It seems like it's just an alias for -std=c89, which gets overridden by -std=c99 later. --- sdl/Makefile.sdl1 | 2 +- sdl/Makefile.sdl2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdl/Makefile.sdl1 b/sdl/Makefile.sdl1 index 681a31a..4a8699e 100644 --- a/sdl/Makefile.sdl1 +++ b/sdl/Makefile.sdl1 @@ -28,7 +28,7 @@ NAME = gen_sdl CC = gcc -CFLAGS = `sdl-config --cflags` -march=native -O6 -fomit-frame-pointer -Wall -Wno-strict-aliasing -ansi -std=c99 -pedantic-errors +CFLAGS = `sdl-config --cflags` -march=native -O6 -fomit-frame-pointer -Wall -Wno-strict-aliasing -std=c99 -pedantic-errors #-g -ggdb -pg #-fomit-frame-pointer #LDFLAGS = -pg diff --git a/sdl/Makefile.sdl2 b/sdl/Makefile.sdl2 index ac5c497..03bbce4 100644 --- a/sdl/Makefile.sdl2 +++ b/sdl/Makefile.sdl2 @@ -28,7 +28,7 @@ NAME = gen_sdl2 CC = gcc -CFLAGS = `sdl2-config --cflags` -march=native -O6 -fomit-frame-pointer -Wall -Wno-strict-aliasing -ansi -std=c99 -pedantic-errors +CFLAGS = `sdl2-config --cflags` -march=native -O6 -fomit-frame-pointer -Wall -Wno-strict-aliasing -std=c99 -pedantic-errors #-g -ggdb -pg #-fomit-frame-pointer #LDFLAGS = -pg