From: twinaphex Date: Tue, 4 Dec 2012 13:16:34 +0000 (+0100) Subject: libretro: make RGB565 support into compile-time option X-Git-Tag: r18~49^2~6 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46aa5b98890412bca8487b28809df3ece137dba9;p=pcsx_rearmed.git libretro: make RGB565 support into compile-time option all libretro frontends should support this no matter what --- diff --git a/Makefile b/Makefile index 0c7854d7..2ca2fdd3 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ OBJS += plugins/gpu_unai/gpulib_if.o ifeq "$(ARCH)" "arm" OBJS += plugins/gpu_unai/gpu_arm.o endif -plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -O3 +plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -O3 CC_LINK = $(CXX) endif @@ -163,6 +163,7 @@ USE_PLUGIN_LIB = 1 endif ifeq "$(PLATFORM)" "libretro" OBJS += frontend/libretro.o +CFLAGS += -DFRONTEND_SUPPORTS_RGB565 endif ifeq "$(USE_PLUGIN_LIB)" "1" diff --git a/frontend/libretro.c b/frontend/libretro.c index 15041bc3..49e346b5 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -30,7 +30,6 @@ static retro_audio_sample_batch_t audio_batch_cb; static void *vout_buf; static int samples_sent, samples_to_send; static int plugins_opened; -static int native_rgb565; /* memory card data */ extern char Mcd1Data[MCD_SIZE]; @@ -51,6 +50,7 @@ static void vout_set_mode(int w, int h, int raw_w, int raw_h, int bpp) { } +#ifdef FRONTEND_SUPPORTS_RGB565 static void convert(void *buf, size_t bytes) { unsigned int i, v, *p = buf; @@ -60,6 +60,7 @@ static void convert(void *buf, size_t bytes) p[i] = (v & 0x001f001f) | ((v >> 1) & 0x7fe07fe0); } } +#endif static void vout_flip(const void *vram, int stride, int bgr24, int w, int h) { @@ -90,8 +91,9 @@ static void vout_flip(const void *vram, int stride, int bgr24, int w, int h) } out: - if (!native_rgb565) - convert(vout_buf, w * h * 2); +#ifndef FRONTEND_SUPPORTS_RGB565 + convert(vout_buf, w * h * 2); +#endif video_cb(vout_buf, w, h, w * 2); pl_rearmed_cbs.flip_cnt++; } @@ -237,11 +239,12 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code) bool retro_load_game(const struct retro_game_info *info) { +#ifdef FRONTEND_SUPPORTS_RGB565 enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; if (environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) { - native_rgb565 = 1; fprintf(stderr, "RGB565 supported, using it\n"); } +#endif if (plugins_opened) { ClosePlugins(); @@ -402,4 +405,3 @@ void retro_deinit(void) free(vout_buf); vout_buf = NULL; } - diff --git a/jni/Android.mk b/jni/Android.mk index 89af335c..06b43795 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -89,7 +89,7 @@ LOCAL_SRC_FILES += ../frontend/main.c ../frontend/plugin.c # libretro LOCAL_SRC_FILES += ../frontend/libretro.c -LOCAL_CFLAGS += -O3 -ffast-math -funroll-loops -DNDEBUG -D_FILE_OFFSET_BITS=64 -DHAVE_LIBRETRO -DNO_FRONTEND +LOCAL_CFLAGS += -O3 -ffast-math -funroll-loops -DNDEBUG -D_FILE_OFFSET_BITS=64 -DHAVE_LIBRETRO -DNO_FRONTEND -DFRONTEND_SUPPORTS_RGB565 LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include LOCAL_LDLIBS := -lz -llog