Create CORE_CTL_VERIFY_API_VERSION

This commit is contained in:
twinaphex 2016-01-27 08:13:54 +01:00
parent 76f068f852
commit 392fee9023
3 changed files with 18 additions and 9 deletions

View File

@ -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;

View File

@ -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

View File

@ -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();