From 392fee9023b4a7e5be6ac7b96ab6217541c7527f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Jan 2016 08:13:54 +0100 Subject: [PATCH] Create CORE_CTL_VERIFY_API_VERSION --- libretro_version_1.c | 14 ++++++++++++++ libretro_version_1.h | 4 +++- retroarch.c | 9 +-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/libretro_version_1.c b/libretro_version_1.c index b1a2811f06..ee999fd8f8 100644 --- a/libretro_version_1.c +++ b/libretro_version_1.c @@ -27,6 +27,7 @@ #include "libretro.h" #include "libretro_version_1.h" #include "general.h" +#include "msg_hash.h" #include "rewind.h" #include "gfx/video_driver.h" #include "audio/audio_driver.h" @@ -262,6 +263,19 @@ bool core_ctl(enum core_ctl_state state, void *data) return retro_init_libretro_cbs(&retro_ctx); case CORE_CTL_DEINIT: return retro_uninit_libretro_cbs(&retro_ctx); + case CORE_CTL_VERIFY_API_VERSION: + { + unsigned api_version = core.retro_api_version(); + RARCH_LOG("Version of libretro API: %u\n", api_version); + RARCH_LOG("Compiled against API: %u\n", RETRO_API_VERSION); + + if (api_version != RETRO_API_VERSION) + { + RARCH_WARN("%s\n", msg_hash_to_str(MSG_LIBRETRO_ABI_BREAK)); + return false; + } + } + break; case CORE_CTL_NONE: default: break; diff --git a/libretro_version_1.h b/libretro_version_1.h index 537812ac32..f2e7ec7c56 100644 --- a/libretro_version_1.h +++ b/libretro_version_1.h @@ -72,7 +72,9 @@ enum core_ctl_state CORE_CTL_RETRO_SERIALIZE, - CORE_CTL_RETRO_UNSERIALIZE + CORE_CTL_RETRO_UNSERIALIZE, + + CORE_CTL_VERIFY_API_VERSION }; typedef struct retro_ctx_serialize_info diff --git a/retroarch.c b/retroarch.c index 150eedf2c2..8845db80c6 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1478,14 +1478,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) } break; case RARCH_CTL_VERIFY_API_VERSION: - { - unsigned api_version = core.retro_api_version(); - RARCH_LOG("Version of libretro API: %u\n", api_version); - RARCH_LOG("Compiled against API: %u\n", RETRO_API_VERSION); - - if (api_version != RETRO_API_VERSION) - RARCH_WARN("%s\n", msg_hash_to_str(MSG_LIBRETRO_ABI_BREAK)); - } + core_ctl(CORE_CTL_VERIFY_API_VERSION, NULL); break; case RARCH_CTL_FILL_PATHNAMES: rarch_init_savefile_paths();