Implement CORE_CTL_RETRO_API_VERSION

This commit is contained in:
twinaphex 2016-01-28 04:26:17 +01:00
parent ab221f96f1
commit 857618d672
3 changed files with 19 additions and 1 deletions

View File

@ -174,6 +174,12 @@ bool core_ctl(enum core_ctl_state state, void *data)
switch (state)
{
case CORE_CTL_RETRO_API_VERSION:
{
retro_ctx_api_info_t *api = (retro_ctx_api_info_t*)data;
api->version = core.retro_api_version();
}
break;
case CORE_CTL_SET_POLL_TYPE:
{
unsigned *poll_type = (unsigned*)data;

View File

@ -80,6 +80,8 @@ enum core_ctl_state
CORE_CTL_RETRO_SYMBOLS_INIT,
CORE_CTL_RETRO_API_VERSION,
/* Compare libretro core API version against API version
* used by RetroArch.
*
@ -102,6 +104,11 @@ enum core_ctl_state
CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE
};
typedef struct retro_ctx_api_info
{
unsigned version;
} retro_ctx_api_info_t;
typedef struct retro_ctx_controller_info
{
unsigned port;

View File

@ -157,11 +157,16 @@ bool np_bsv_parse_header(const uint32_t *header, uint32_t magic)
uint32_t np_impl_magic(void)
{
size_t i, len;
retro_ctx_api_info_t api_info;
unsigned api;
uint32_t res = 0;
rarch_system_info_t *info = NULL;
const char *lib = NULL;
const char *ver = PACKAGE_VERSION;
unsigned api = core.retro_api_version();
core_ctl(CORE_CTL_RETRO_API_VERSION, &api_info);
api = api_info.version;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);