From 811f9e81dbff4bed18644e19631fd4893e73e6ee Mon Sep 17 00:00:00 2001 From: barbudreadmon Date: Tue, 2 Nov 2021 22:42:39 +0100 Subject: [PATCH] (libretro) fix pixel format on android --- yabause/src/libretro/Makefile | 3 ++- yabause/src/libretro/Makefile.common | 6 ++++++ yabause/src/libretro/jni/Android.mk | 1 + yabause/src/libretro/libretro.c | 14 ++++++++------ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/yabause/src/libretro/Makefile b/yabause/src/libretro/Makefile index b211643b7..5bf4284bc 100644 --- a/yabause/src/libretro/Makefile +++ b/yabause/src/libretro/Makefile @@ -8,6 +8,7 @@ DYNAREC = 0 HAVE_GRIFFIN = 0 HAVE_THREADS = 1 HAVE_MUSASHI = 1 +USE_RGB_565 = 1 HAVE_UWP = 0 HAVE_SYS_PARAM_H = 1 HAVE_FSEEKO = 0 @@ -515,7 +516,7 @@ FLAGS += $(fpic) INCFLAGS := $(foreach dir,$(INCLUDE_DIRS),-I$(dir)) WARNINGS := -FLAGS += $(INCFLAGS) -D__LIBRETRO__ $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DUSE_16BPP=1 -DUSE_RGB_565=1 \ +FLAGS += $(INCFLAGS) -D__LIBRETRO__ $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) \ -DNO_CLI -DHAVE_SYS_TIME_H -DHAVE_GETTIMEOFDAY -DHAVE_STDINT_H=1 -DVERSION=\"0.9.15\" \ -DHAVE_LROUND -D_7ZIP_ST -DFLAC__HAS_OGG=0 -DFLAC__NO_DLL diff --git a/yabause/src/libretro/Makefile.common b/yabause/src/libretro/Makefile.common index 0462c8f69..6a83e40cd 100644 --- a/yabause/src/libretro/Makefile.common +++ b/yabause/src/libretro/Makefile.common @@ -220,3 +220,9 @@ ifeq ($(HAVE_MUSASHI), 1) else OBJECTS_C += $(C68KEXEC_OBJECT) endif + +ifeq ($(USE_RGB_565), 1) + FLAGS += -DUSE_16BPP=1 -DUSE_RGB_565=1 +else + FLAGS += -DUSE_16BPP=1 -DUSE_RGB_555=1 +endif diff --git a/yabause/src/libretro/jni/Android.mk b/yabause/src/libretro/jni/Android.mk index acf9b67b5..6402bf5eb 100644 --- a/yabause/src/libretro/jni/Android.mk +++ b/yabause/src/libretro/jni/Android.mk @@ -6,6 +6,7 @@ FLAGS := DYNAREC := 0 HAVE_THREADS := 1 HAVE_MUSASHI := 1 +USE_RGB_565 := 1 # The following is broken upstream ? USE_PLAY_JIT := 0 USE_SCSP2 := 0 diff --git a/yabause/src/libretro/libretro.c b/yabause/src/libretro/libretro.c index 6666eb59f..f52ac1ea4 100644 --- a/yabause/src/libretro/libretro.c +++ b/yabause/src/libretro/libretro.c @@ -994,12 +994,6 @@ void retro_init(void) if (environ_cb(RETRO_ENVIRONMENT_GET_PERF_INTERFACE, &perf_cb)) perf_get_cpu_features_cb = perf_cb.get_cpu_features; -#if 1 - enum retro_pixel_format rgb565 = RETRO_PIXEL_FORMAT_RGB565; - if(environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &rgb565)) - log_cb(RETRO_LOG_INFO, "Frontend supports RGB565 - will use that instead of XRGB1555.\n"); -#endif - if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir) { strncpy(g_system_dir, dir, sizeof(g_system_dir)); @@ -1027,6 +1021,14 @@ bool retro_load_game(const struct retro_game_info *info) if (!info) return false; +#ifdef USE_RGB_565 + enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; +#else + enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_0RGB1555; +#endif + if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) + return false; + check_variables(); snprintf(bios_path, sizeof(bios_path), "%s%csaturn_bios.bin", g_system_dir, slash);