Merge commit '1d96a10acb661e07775de954338f4bb3724705a3' into libretro_core

# Conflicts:
#	libretro/libretro.c
This commit is contained in:
Lior Halphon 2017-12-29 13:18:52 +02:00
commit 0891de668b
3 changed files with 38 additions and 17 deletions

View File

@ -1,6 +1,11 @@
STATIC_LINKING := 0 STATIC_LINKING := 0
AR := ar AR := ar
GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
ifeq ($(platform),) ifeq ($(platform),)
platform = unix platform = unix
ifeq ($(shell uname -a),) ifeq ($(shell uname -a),)
@ -48,7 +53,7 @@ endif
ifeq ($(platform), osx) ifeq ($(platform), osx)
ifndef ($(NOUNIVERSAL)) ifndef ($(NOUNIVERSAL))
CXXFLAGS += $(ARCHFLAGS) CFLAGS += $(ARCHFLAGS)
LFLAGS += $(ARCHFLAGS) LFLAGS += $(ARCHFLAGS)
endif endif
endif endif
@ -88,10 +93,10 @@ else
endif endif
ifeq ($(platform),$(filter $(platform),ios9 ios-arm64)) ifeq ($(platform),$(filter $(platform),ios9 ios-arm64))
CC += -miphoneos-version-min=8.0 CC += -miphoneos-version-min=8.0
CXXFLAGS += -miphoneos-version-min=8.0 CFLAGS += -miphoneos-version-min=8.0
else else
CC += -miphoneos-version-min=5.0 CC += -miphoneos-version-min=5.0
CXXFLAGS += -miphoneos-version-min=5.0 CFLAGS += -miphoneos-version-min=5.0
endif endif
else ifneq (,$(findstring qnx,$(platform))) else ifneq (,$(findstring qnx,$(platform)))
TARGET := $(TARGET_NAME)_libretro_qnx.so TARGET := $(TARGET_NAME)_libretro_qnx.so
@ -121,9 +126,9 @@ MKDIR := $(shell which mkdir)
LDFLAGS += $(LIBM) LDFLAGS += $(LIBM)
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
CXXFLAGS += -O0 -g CFLAGS += -O0 -g
else else
CXXFLAGS += -O2 -DNDEBUG CFLAGS += -O2 -DNDEBUG
endif endif
include Makefile.common include Makefile.common
@ -131,7 +136,6 @@ include Makefile.common
OBJECTS := $(patsubst %.c,$(CORE_DIR)/build/obj/%_libretro.c.o,$(SOURCES_C)) OBJECTS := $(patsubst %.c,$(CORE_DIR)/build/obj/%_libretro.c.o,$(SOURCES_C))
CFLAGS += -Wall -D__LIBRETRO__ $(fpic) $(INCFLAGS) -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES CFLAGS += -Wall -D__LIBRETRO__ $(fpic) $(INCFLAGS) -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES
CXXFLAGS += -Wall -D__LIBRETRO__ $(fpic)
all: $(TARGET) all: $(TARGET)

View File

@ -1,7 +1,11 @@
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
LOCAL_CXXFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
include $(CLEAR_VARS)
HAVE_NETWORK = 1 HAVE_NETWORK = 1
LOCAL_MODULE := libretro LOCAL_MODULE := libretro

View File

@ -14,6 +14,8 @@
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
#define SAMEBOY_CORE_VERSION "0.9"
#include <Core/gb.h> #include <Core/gb.h>
#include "libretro.h" #include "libretro.h"
@ -168,12 +170,15 @@ void retro_get_system_info(struct retro_system_info *info)
{ {
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->library_name = "SameBoy"; info->library_name = "SameBoy";
info->library_version = "0.9"; #ifdef GIT_VERSION
info->library_version = SAMEBOY_CORE_VERSION GIT_VERSION;
#else
info->library_version = SAMEBOY_CORE_VERSION;
#endif
info->need_fullpath = true; info->need_fullpath = true;
info->valid_extensions = "gb|gbc"; info->valid_extensions = "gb|gbc";
} }
void retro_get_system_av_info(struct retro_system_av_info *info) void retro_get_system_av_info(struct retro_system_av_info *info)
{ {
struct retro_game_geometry geom = { VIDEO_WIDTH, VIDEO_HEIGHT,VIDEO_WIDTH, VIDEO_HEIGHT ,160.0 / 144.0 }; struct retro_game_geometry geom = { VIDEO_WIDTH, VIDEO_HEIGHT,VIDEO_WIDTH, VIDEO_HEIGHT ,160.0 / 144.0 };
@ -202,13 +207,6 @@ void retro_set_environment(retro_environment_t cb)
{ NULL, 0 }, { NULL, 0 },
}; };
cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports); cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
static struct retro_variable vars[] = {
{ "sameboy_color_correction_mode", "Color Correction; off|correct curves|emulate hardware|preserve brightness" },
{ "sameboy_high_pass_filter_mode", "High Pass Filter; off|accurate|remove dc offset" },
};
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
} }
void retro_set_audio_sample(retro_audio_sample_t cb) void retro_set_audio_sample(retro_audio_sample_t cb)
@ -246,7 +244,7 @@ static void check_variables(void)
var.key = "sameboy_color_correction_mode"; var.key = "sameboy_color_correction_mode";
var.value = NULL; var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value && GB_is_cgb(&gb))
{ {
if (strcmp(var.value, "off") == 0) if (strcmp(var.value, "off") == 0)
GB_set_color_correction_mode(&gb, GB_COLOR_CORRECTION_DISABLED); GB_set_color_correction_mode(&gb, GB_COLOR_CORRECTION_DISABLED);
@ -422,6 +420,21 @@ bool retro_load_game(const struct retro_game_info *info)
else else
log_cb(RETRO_LOG_INFO, "Rumble environment not supported.\n"); log_cb(RETRO_LOG_INFO, "Rumble environment not supported.\n");
static struct retro_variable vars_cgb[] = {
{ "sameboy_color_correction_mode", "Color Correction; off|correct curves|emulate hardware|preserve brightness" },
{ "sameboy_high_pass_filter_mode", "High Pass Filter; off|accurate|remove dc offset" },
{ NULL }
};
static struct retro_variable vars_dmg[] = {
{ "sameboy_high_pass_filter_mode", "High Pass Filter; off|accurate|remove dc offset" },
{ NULL }
};
if (GB_is_cgb(&gb))
environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, vars_cgb);
else
environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, vars_dmg);
check_variables(); check_variables();
return true; return true;