2014-09-23 01:03:56 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2016-01-10 03:06:50 +00:00
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2015-01-07 16:46:50 +00:00
|
|
|
* Copyright (C) 2012-2015 - Michael Lelli
|
2016-10-27 15:47:10 +00:00
|
|
|
* Copyright (C) 2016 - Brad Parker
|
2014-09-23 01:03:56 +00:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
2015-06-29 22:38:10 +00:00
|
|
|
|
|
|
|
#include <boolean.h>
|
2016-03-20 13:53:54 +00:00
|
|
|
#include <lists/string_list.h>
|
2017-01-24 15:08:25 +00:00
|
|
|
#include <string/stdstring.h>
|
2016-05-10 17:03:53 +00:00
|
|
|
#include <libretro.h>
|
2015-06-29 22:38:10 +00:00
|
|
|
|
2016-09-06 21:53:44 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2016-09-29 19:07:10 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
2016-09-08 04:07:43 +00:00
|
|
|
#include "network/netplay/netplay.h"
|
|
|
|
#endif
|
|
|
|
|
2017-01-23 15:17:57 +00:00
|
|
|
#include "core.h"
|
2017-01-24 23:34:58 +00:00
|
|
|
#include "content.h"
|
2016-03-22 01:56:06 +00:00
|
|
|
#include "dynamic.h"
|
2016-01-27 07:13:54 +00:00
|
|
|
#include "msg_hash.h"
|
2016-05-09 16:20:52 +00:00
|
|
|
#include "managers/state_manager.h"
|
2016-09-01 03:36:52 +00:00
|
|
|
#include "verbosity.h"
|
2015-11-24 00:26:59 +00:00
|
|
|
#include "gfx/video_driver.h"
|
2015-11-23 18:40:09 +00:00
|
|
|
#include "audio/audio_driver.h"
|
2014-09-23 01:03:56 +00:00
|
|
|
|
2017-01-09 01:04:47 +00:00
|
|
|
static unsigned core_poll_type = POLL_TYPE_EARLY;
|
|
|
|
static bool core_inited = false;
|
|
|
|
static bool core_symbols_inited = false;
|
|
|
|
static bool core_game_loaded = false;
|
|
|
|
static bool core_input_polled = false;
|
|
|
|
static bool core_has_set_input_descriptors = false;
|
|
|
|
static uint64_t core_serialization_quirks_v = 0;
|
|
|
|
|
|
|
|
static struct retro_callbacks retro_ctx;
|
|
|
|
static struct retro_core_t core;
|
2016-01-27 00:16:53 +00:00
|
|
|
|
2016-05-07 22:31:21 +00:00
|
|
|
static void core_input_state_poll_maybe(void)
|
|
|
|
{
|
|
|
|
if (core_poll_type == POLL_TYPE_NORMAL)
|
|
|
|
input_poll();
|
|
|
|
}
|
|
|
|
|
|
|
|
static int16_t core_input_state_poll(unsigned port,
|
2016-01-27 00:16:53 +00:00
|
|
|
unsigned device, unsigned idx, unsigned id)
|
|
|
|
{
|
2016-01-28 05:20:44 +00:00
|
|
|
if (core_poll_type == POLL_TYPE_LATE)
|
2016-01-27 00:16:53 +00:00
|
|
|
{
|
2016-01-28 05:21:29 +00:00
|
|
|
if (!core_input_polled)
|
2016-01-27 00:16:53 +00:00
|
|
|
input_poll();
|
|
|
|
|
2016-01-28 05:21:29 +00:00
|
|
|
core_input_polled = true;
|
2016-01-27 00:16:53 +00:00
|
|
|
}
|
|
|
|
return input_state(port, device, idx, id);
|
|
|
|
}
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
void core_set_input_state(retro_ctx_input_state_info_t *info)
|
2015-12-05 15:54:03 +00:00
|
|
|
{
|
2016-05-07 23:33:57 +00:00
|
|
|
core.retro_set_input_state(info->cb);
|
2015-12-05 15:54:03 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 17:39:17 +00:00
|
|
|
/**
|
2016-05-07 22:31:21 +00:00
|
|
|
* core_init_libretro_cbs:
|
2015-01-08 17:39:17 +00:00
|
|
|
* @data : pointer to retro_callbacks object
|
|
|
|
*
|
2016-11-04 19:56:31 +00:00
|
|
|
* Initializes libretro callbacks, and binds the libretro callbacks
|
2015-01-08 17:39:17 +00:00
|
|
|
* to default callback functions.
|
|
|
|
**/
|
2016-05-07 22:31:21 +00:00
|
|
|
static bool core_init_libretro_cbs(void *data)
|
2014-09-23 01:03:56 +00:00
|
|
|
{
|
2014-09-23 02:42:49 +00:00
|
|
|
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
|
|
|
|
|
|
|
|
if (!cbs)
|
2016-01-27 02:14:36 +00:00
|
|
|
return false;
|
2014-09-23 02:42:49 +00:00
|
|
|
|
2015-12-03 23:26:09 +00:00
|
|
|
core.retro_set_video_refresh(video_driver_frame);
|
2015-10-06 17:34:09 +00:00
|
|
|
core.retro_set_audio_sample(audio_driver_sample);
|
|
|
|
core.retro_set_audio_sample_batch(audio_driver_sample_batch);
|
2016-05-07 22:31:21 +00:00
|
|
|
core.retro_set_input_state(core_input_state_poll);
|
|
|
|
core.retro_set_input_poll(core_input_state_poll_maybe);
|
2014-09-23 01:03:56 +00:00
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
core_set_default_callbacks(cbs);
|
2014-09-23 01:55:19 +00:00
|
|
|
|
2016-09-29 19:07:10 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
2015-12-05 15:38:24 +00:00
|
|
|
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
|
2016-01-27 02:14:36 +00:00
|
|
|
return true;
|
2014-09-23 01:03:56 +00:00
|
|
|
|
2016-09-29 02:45:31 +00:00
|
|
|
core_set_netplay_callbacks();
|
2014-09-23 01:03:56 +00:00
|
|
|
#endif
|
2016-01-27 02:14:36 +00:00
|
|
|
|
|
|
|
return true;
|
2014-09-23 01:03:56 +00:00
|
|
|
}
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
/**
|
|
|
|
* core_set_default_callbacks:
|
|
|
|
* @data : pointer to retro_callbacks object
|
|
|
|
*
|
|
|
|
* Binds the libretro callbacks to default callback functions.
|
|
|
|
**/
|
|
|
|
bool core_set_default_callbacks(void *data)
|
|
|
|
{
|
|
|
|
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
|
|
|
|
|
|
|
|
if (!cbs)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
cbs->frame_cb = video_driver_frame;
|
|
|
|
cbs->sample_cb = audio_driver_sample;
|
|
|
|
cbs->sample_batch_cb = audio_driver_sample_batch;
|
|
|
|
cbs->state_cb = core_input_state_poll;
|
|
|
|
cbs->poll_cb = input_poll;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool core_deinit(void *data)
|
|
|
|
{
|
|
|
|
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
|
|
|
|
|
|
|
|
if (!cbs)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
cbs->frame_cb = NULL;
|
|
|
|
cbs->sample_cb = NULL;
|
|
|
|
cbs->sample_batch_cb = NULL;
|
|
|
|
cbs->state_cb = NULL;
|
|
|
|
cbs->poll_cb = NULL;
|
|
|
|
|
2016-09-06 01:52:29 +00:00
|
|
|
core_inited = false;
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_uninit_libretro_callbacks(void)
|
|
|
|
{
|
|
|
|
return core_deinit(&retro_ctx);
|
|
|
|
}
|
|
|
|
|
2015-01-08 17:39:17 +00:00
|
|
|
/**
|
2016-05-07 22:31:21 +00:00
|
|
|
* core_set_rewind_callbacks:
|
2015-01-08 17:39:17 +00:00
|
|
|
*
|
|
|
|
* Sets the audio sampling callbacks based on whether or not
|
|
|
|
* rewinding is currently activated.
|
|
|
|
**/
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_set_rewind_callbacks(void)
|
2014-09-23 01:03:56 +00:00
|
|
|
{
|
2015-09-16 09:14:43 +00:00
|
|
|
if (state_manager_frame_is_reversed())
|
2014-09-23 01:03:56 +00:00
|
|
|
{
|
2015-10-06 17:34:09 +00:00
|
|
|
core.retro_set_audio_sample(audio_driver_sample_rewind);
|
|
|
|
core.retro_set_audio_sample_batch(audio_driver_sample_batch_rewind);
|
2014-09-23 01:03:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-10-06 17:34:09 +00:00
|
|
|
core.retro_set_audio_sample(audio_driver_sample);
|
|
|
|
core.retro_set_audio_sample_batch(audio_driver_sample_batch);
|
2014-09-23 01:03:56 +00:00
|
|
|
}
|
2016-05-07 23:33:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-09-29 21:10:21 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
2016-09-29 02:45:31 +00:00
|
|
|
/**
|
|
|
|
* core_set_netplay_callbacks:
|
|
|
|
*
|
|
|
|
* Set the I/O callbacks to use netplay's interceding callback system. Should
|
2016-12-18 04:08:59 +00:00
|
|
|
* only be called while initializing netplay.
|
2016-09-29 02:45:31 +00:00
|
|
|
**/
|
|
|
|
bool core_set_netplay_callbacks(void)
|
|
|
|
{
|
|
|
|
/* Force normal poll type for netplay. */
|
|
|
|
core_poll_type = POLL_TYPE_NORMAL;
|
|
|
|
|
|
|
|
/* And use netplay's interceding callbacks */
|
|
|
|
core.retro_set_video_refresh(video_frame_net);
|
|
|
|
core.retro_set_audio_sample(audio_sample_net);
|
|
|
|
core.retro_set_audio_sample_batch(audio_sample_batch_net);
|
|
|
|
core.retro_set_input_state(input_state_net);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2016-12-18 04:08:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* core_unset_netplay_callbacks
|
|
|
|
*
|
|
|
|
* Unset the I/O callbacks from having used netplay's interceding callback
|
|
|
|
* system. Should only be called while uninitializing netplay.
|
|
|
|
*/
|
|
|
|
bool core_unset_netplay_callbacks(void)
|
|
|
|
{
|
|
|
|
struct retro_callbacks cbs;
|
|
|
|
if (!core_set_default_callbacks(&cbs))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
core.retro_set_video_refresh(cbs.frame_cb);
|
|
|
|
core.retro_set_audio_sample(cbs.sample_cb);
|
|
|
|
core.retro_set_audio_sample_batch(cbs.sample_batch_cb);
|
|
|
|
core.retro_set_input_state(cbs.state_cb);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2016-09-29 21:10:21 +00:00
|
|
|
#endif
|
2016-09-29 02:45:31 +00:00
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_set_cheat(retro_ctx_cheat_info_t *info)
|
|
|
|
{
|
|
|
|
core.retro_cheat_set(info->index, info->enabled, info->code);
|
|
|
|
return true;
|
2014-09-23 01:03:56 +00:00
|
|
|
}
|
2016-01-27 02:08:49 +00:00
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_reset_cheat(void)
|
2016-01-27 02:08:49 +00:00
|
|
|
{
|
2016-05-07 23:33:57 +00:00
|
|
|
core.retro_cheat_reset();
|
|
|
|
return true;
|
|
|
|
}
|
2016-01-27 03:54:22 +00:00
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_api_version(retro_ctx_api_info_t *api)
|
|
|
|
{
|
|
|
|
if (!api)
|
|
|
|
return false;
|
|
|
|
api->version = core.retro_api_version();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_set_poll_type(unsigned *type)
|
|
|
|
{
|
|
|
|
core_poll_type = *type;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-07-23 05:06:32 +00:00
|
|
|
void core_uninit_symbols(void)
|
|
|
|
{
|
|
|
|
uninit_libretro_sym(&core);
|
2016-09-06 01:52:29 +00:00
|
|
|
core_symbols_inited = false;
|
2016-07-23 05:06:32 +00:00
|
|
|
}
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_init_symbols(enum rarch_core_type *type)
|
|
|
|
{
|
|
|
|
if (!type)
|
|
|
|
return false;
|
2016-10-12 00:28:36 +00:00
|
|
|
if (!init_libretro_sym(*type, &core))
|
|
|
|
return false;
|
2016-09-06 01:52:29 +00:00
|
|
|
core_symbols_inited = true;
|
2016-05-07 23:33:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_set_controller_port_device(retro_ctx_controller_info_t *pad)
|
|
|
|
{
|
|
|
|
if (!pad)
|
|
|
|
return false;
|
|
|
|
core.retro_set_controller_port_device(pad->port, pad->device);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_get_memory(retro_ctx_memory_info_t *info)
|
|
|
|
{
|
|
|
|
if (!info)
|
|
|
|
return false;
|
|
|
|
info->size = core.retro_get_memory_size(info->id);
|
|
|
|
info->data = core.retro_get_memory_data(info->id);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_load_game(retro_ctx_load_content_info_t *load_info)
|
|
|
|
{
|
2017-01-25 14:44:21 +00:00
|
|
|
bool contentless = false;
|
2017-01-25 14:51:57 +00:00
|
|
|
bool is_inited = false;
|
2017-01-25 14:44:21 +00:00
|
|
|
|
2017-01-25 14:51:57 +00:00
|
|
|
content_get_status(&contentless, &is_inited);
|
2017-01-25 14:44:21 +00:00
|
|
|
|
2016-09-11 17:46:13 +00:00
|
|
|
if (load_info && load_info->special)
|
2016-09-29 18:35:26 +00:00
|
|
|
core_game_loaded = core.retro_load_game_special(
|
|
|
|
load_info->special->id, load_info->info, load_info->content->size);
|
2017-01-24 15:08:25 +00:00
|
|
|
else if (load_info && !string_is_empty(load_info->content->elems[0].data))
|
2016-09-11 17:46:13 +00:00
|
|
|
core_game_loaded = core.retro_load_game(load_info->info);
|
2017-01-25 14:44:21 +00:00
|
|
|
else if (contentless)
|
2016-09-11 17:46:13 +00:00
|
|
|
core_game_loaded = core.retro_load_game(NULL);
|
2017-01-24 23:34:58 +00:00
|
|
|
else
|
|
|
|
core_game_loaded = false;
|
2016-09-03 16:50:04 +00:00
|
|
|
|
|
|
|
return core_game_loaded;
|
2016-05-07 23:33:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool core_get_system_info(struct retro_system_info *system)
|
|
|
|
{
|
|
|
|
if (!system)
|
|
|
|
return false;
|
|
|
|
core.retro_get_system_info(system);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_unserialize(retro_ctx_serialize_info_t *info)
|
|
|
|
{
|
|
|
|
if (!info)
|
|
|
|
return false;
|
|
|
|
if (!core.retro_unserialize(info->data_const, info->size))
|
|
|
|
return false;
|
2016-10-04 17:44:35 +00:00
|
|
|
|
|
|
|
#if HAVE_NETWORKING
|
|
|
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_LOAD_SAVESTATE, info);
|
|
|
|
#endif
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_serialize(retro_ctx_serialize_info_t *info)
|
|
|
|
{
|
|
|
|
if (!info)
|
|
|
|
return false;
|
|
|
|
if (!core.retro_serialize(info->data, info->size))
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_serialize_size(retro_ctx_size_info_t *info)
|
|
|
|
{
|
|
|
|
if (!info)
|
|
|
|
return false;
|
|
|
|
info->size = core.retro_serialize_size();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-09-30 19:37:02 +00:00
|
|
|
uint64_t core_serialization_quirks(void)
|
2016-09-30 18:51:05 +00:00
|
|
|
{
|
|
|
|
return core_serialization_quirks_v;
|
|
|
|
}
|
|
|
|
|
2016-09-30 19:37:02 +00:00
|
|
|
void core_set_serialization_quirks(uint64_t quirks)
|
2016-09-30 18:51:05 +00:00
|
|
|
{
|
|
|
|
core_serialization_quirks_v = quirks;
|
|
|
|
}
|
|
|
|
|
2016-10-25 02:58:00 +00:00
|
|
|
void core_frame(retro_ctx_frame_info_t *info)
|
2016-05-07 23:33:57 +00:00
|
|
|
{
|
2016-10-25 03:01:44 +00:00
|
|
|
if (retro_ctx.frame_cb)
|
|
|
|
retro_ctx.frame_cb(
|
|
|
|
info->data, info->width, info->height, info->pitch);
|
2016-05-07 23:33:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool core_poll(void)
|
|
|
|
{
|
|
|
|
if (!retro_ctx.poll_cb)
|
|
|
|
return false;
|
|
|
|
retro_ctx.poll_cb();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_set_environment(retro_ctx_environ_info_t *info)
|
|
|
|
{
|
|
|
|
if (!info)
|
|
|
|
return false;
|
|
|
|
core.retro_set_environment(info->env);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_get_system_av_info(struct retro_system_av_info *av_info)
|
|
|
|
{
|
|
|
|
if (!av_info)
|
|
|
|
return false;
|
|
|
|
core.retro_get_system_av_info(av_info);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_reset(void)
|
|
|
|
{
|
|
|
|
core.retro_reset();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_init(void)
|
|
|
|
{
|
|
|
|
core.retro_init();
|
2016-09-06 01:52:29 +00:00
|
|
|
core_inited = true;
|
2016-05-07 23:33:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_unload(void)
|
|
|
|
{
|
|
|
|
core.retro_deinit();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-07-23 05:06:32 +00:00
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_unload_game(void)
|
|
|
|
{
|
2017-01-25 14:22:12 +00:00
|
|
|
video_driver_free_hw_context();
|
2016-05-08 16:00:32 +00:00
|
|
|
audio_driver_stop();
|
2016-05-07 23:33:57 +00:00
|
|
|
core.retro_unload_game();
|
2016-09-03 16:50:04 +00:00
|
|
|
core_game_loaded = false;
|
2016-05-07 23:33:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_run(void)
|
|
|
|
{
|
2016-10-04 17:40:07 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
|
|
|
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_PRE_FRAME, NULL))
|
|
|
|
{
|
2016-12-16 15:13:44 +00:00
|
|
|
/* Paused due to netplay. We must poll and display something so that a
|
|
|
|
* netplay peer pausing doesn't just hang. */
|
|
|
|
input_poll();
|
|
|
|
video_driver_cached_frame();
|
2016-10-04 17:40:07 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
switch (core_poll_type)
|
2016-01-27 02:08:49 +00:00
|
|
|
{
|
2016-05-07 23:33:57 +00:00
|
|
|
case POLL_TYPE_EARLY:
|
|
|
|
input_poll();
|
2016-04-05 22:20:14 +00:00
|
|
|
break;
|
2016-05-07 23:33:57 +00:00
|
|
|
case POLL_TYPE_LATE:
|
|
|
|
core_input_polled = false;
|
2016-01-27 02:08:49 +00:00
|
|
|
break;
|
2016-09-29 18:35:26 +00:00
|
|
|
default:
|
|
|
|
break;
|
2016-01-27 02:08:49 +00:00
|
|
|
}
|
2016-09-29 18:35:26 +00:00
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
if (core.retro_run)
|
|
|
|
core.retro_run();
|
|
|
|
if (core_poll_type == POLL_TYPE_LATE && !core_input_polled)
|
|
|
|
input_poll();
|
2016-10-04 17:40:07 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_NETWORKING
|
|
|
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_POST_FRAME, NULL);
|
|
|
|
#endif
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-01-23 13:50:00 +00:00
|
|
|
bool core_load(unsigned poll_type_behavior)
|
2016-05-07 23:33:57 +00:00
|
|
|
{
|
2017-01-23 13:50:00 +00:00
|
|
|
core_poll_type = poll_type_behavior;
|
2016-05-07 23:33:57 +00:00
|
|
|
|
|
|
|
if (!core_verify_api_version())
|
|
|
|
return false;
|
|
|
|
if (!core_init_libretro_cbs(&retro_ctx))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
core_get_system_av_info(video_viewport_get_system_av_info());
|
2016-01-27 02:08:49 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2016-05-07 23:33:57 +00:00
|
|
|
|
|
|
|
bool core_verify_api_version(void)
|
|
|
|
{
|
|
|
|
unsigned api_version = core.retro_api_version();
|
2016-11-04 19:56:31 +00:00
|
|
|
RARCH_LOG("%s: %u\n",
|
2016-06-20 02:23:00 +00:00
|
|
|
msg_hash_to_str(MSG_VERSION_OF_LIBRETRO_API),
|
|
|
|
api_version);
|
2016-11-04 19:56:31 +00:00
|
|
|
RARCH_LOG("%s: %u\n",
|
2016-06-20 02:23:00 +00:00
|
|
|
msg_hash_to_str(MSG_COMPILED_AGAINST_API),
|
|
|
|
RETRO_API_VERSION);
|
2016-05-07 23:33:57 +00:00
|
|
|
|
|
|
|
if (api_version != RETRO_API_VERSION)
|
|
|
|
{
|
|
|
|
RARCH_WARN("%s\n", msg_hash_to_str(MSG_LIBRETRO_ABI_BREAK));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-09-03 16:50:04 +00:00
|
|
|
bool core_get_region(retro_ctx_region_info_t *info)
|
|
|
|
{
|
|
|
|
if (!info)
|
|
|
|
return false;
|
|
|
|
info->region = core.retro_get_region();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_has_set_input_descriptor(void)
|
|
|
|
{
|
|
|
|
return core_has_set_input_descriptors;
|
|
|
|
}
|
|
|
|
|
|
|
|
void core_set_input_descriptors(void)
|
|
|
|
{
|
|
|
|
core_has_set_input_descriptors = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void core_unset_input_descriptors(void)
|
|
|
|
{
|
|
|
|
core_has_set_input_descriptors = false;
|
|
|
|
}
|
2016-09-03 16:50:04 +00:00
|
|
|
|
2016-09-06 01:52:29 +00:00
|
|
|
bool core_is_inited(void)
|
|
|
|
{
|
|
|
|
return core_inited;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool core_is_symbols_inited(void)
|
|
|
|
{
|
|
|
|
return core_symbols_inited;
|
|
|
|
}
|
|
|
|
|
2016-09-03 16:50:04 +00:00
|
|
|
bool core_is_game_loaded(void)
|
|
|
|
{
|
|
|
|
return core_game_loaded;
|
|
|
|
}
|