mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
Merge core_impl.c into retroarch.c
This commit is contained in:
parent
f7d24b7c10
commit
4d8f5f4dde
@ -164,7 +164,6 @@ OBJ += frontend/frontend.o \
|
|||||||
ui/drivers/null/ui_null_browser_window.o \
|
ui/drivers/null/ui_null_browser_window.o \
|
||||||
ui/drivers/null/ui_null_msg_window.o \
|
ui/drivers/null/ui_null_msg_window.o \
|
||||||
ui/drivers/null/ui_null_application.o \
|
ui/drivers/null/ui_null_application.o \
|
||||||
core_impl.o \
|
|
||||||
retroarch.o \
|
retroarch.o \
|
||||||
dirs.o \
|
dirs.o \
|
||||||
paths.o \
|
paths.o \
|
||||||
|
8
core.h
8
core.h
@ -203,14 +203,6 @@ bool core_reset_cheat(void);
|
|||||||
|
|
||||||
bool core_api_version(retro_ctx_api_info_t *api);
|
bool core_api_version(retro_ctx_api_info_t *api);
|
||||||
|
|
||||||
/* Compare libretro core API version against API version
|
|
||||||
* used by RetroArch.
|
|
||||||
*
|
|
||||||
* TODO - when libretro v2 gets added, allow for switching
|
|
||||||
* between libretro version backend dynamically.
|
|
||||||
*/
|
|
||||||
bool core_verify_api_version(void);
|
|
||||||
|
|
||||||
bool core_get_region(retro_ctx_region_info_t *info);
|
bool core_get_region(retro_ctx_region_info_t *info);
|
||||||
|
|
||||||
bool core_get_memory(retro_ctx_memory_info_t *info);
|
bool core_get_memory(retro_ctx_memory_info_t *info);
|
||||||
|
546
core_impl.c
546
core_impl.c
@ -1,546 +0,0 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
|
||||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
||||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
|
||||||
* Copyright (C) 2012-2015 - Michael Lelli
|
|
||||||
* Copyright (C) 2016-2019 - Brad Parker
|
|
||||||
*
|
|
||||||
* 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>
|
|
||||||
|
|
||||||
#include <boolean.h>
|
|
||||||
#include <lists/string_list.h>
|
|
||||||
#include <string/stdstring.h>
|
|
||||||
#include <libretro.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
|
||||||
#include "network/netplay/netplay.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "core.h"
|
|
||||||
#include "content.h"
|
|
||||||
#include "dynamic.h"
|
|
||||||
#include "msg_hash.h"
|
|
||||||
#include "managers/state_manager.h"
|
|
||||||
#include "verbosity.h"
|
|
||||||
#include "retroarch.h"
|
|
||||||
#include "tasks/tasks_internal.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_RUNAHEAD
|
|
||||||
#include "runahead/copy_load_info.h"
|
|
||||||
#include "runahead/secondary_core.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct retro_callbacks retro_ctx;
|
|
||||||
struct retro_core_t current_core;
|
|
||||||
|
|
||||||
static void retro_run_null(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void retro_frame_null(const void *data, unsigned width,
|
|
||||||
unsigned height, size_t pitch)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void retro_input_poll_null(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void core_input_state_poll_maybe(void)
|
|
||||||
{
|
|
||||||
if (current_core.poll_type == POLL_TYPE_NORMAL)
|
|
||||||
input_poll();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int16_t core_input_state_poll(unsigned port,
|
|
||||||
unsigned device, unsigned idx, unsigned id)
|
|
||||||
{
|
|
||||||
if (current_core.poll_type == POLL_TYPE_LATE)
|
|
||||||
{
|
|
||||||
if (!current_core.input_polled)
|
|
||||||
input_poll();
|
|
||||||
|
|
||||||
current_core.input_polled = true;
|
|
||||||
}
|
|
||||||
return input_state(port, device, idx, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void core_set_input_state(retro_ctx_input_state_info_t *info)
|
|
||||||
{
|
|
||||||
current_core.retro_set_input_state(info->cb);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* core_init_libretro_cbs:
|
|
||||||
* @data : pointer to retro_callbacks object
|
|
||||||
*
|
|
||||||
* Initializes libretro callbacks, and binds the libretro callbacks
|
|
||||||
* to default callback functions.
|
|
||||||
**/
|
|
||||||
static bool core_init_libretro_cbs(struct retro_callbacks *cbs)
|
|
||||||
{
|
|
||||||
current_core.retro_set_video_refresh(video_driver_frame);
|
|
||||||
current_core.retro_set_audio_sample(audio_driver_sample);
|
|
||||||
current_core.retro_set_audio_sample_batch(audio_driver_sample_batch);
|
|
||||||
current_core.retro_set_input_state(core_input_state_poll);
|
|
||||||
current_core.retro_set_input_poll(core_input_state_poll_maybe);
|
|
||||||
|
|
||||||
core_set_default_callbacks(cbs);
|
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
|
||||||
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
core_set_netplay_callbacks();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* core_set_default_callbacks:
|
|
||||||
* @data : pointer to retro_callbacks object
|
|
||||||
*
|
|
||||||
* Binds the libretro callbacks to default callback functions.
|
|
||||||
**/
|
|
||||||
bool core_set_default_callbacks(struct retro_callbacks *cbs)
|
|
||||||
{
|
|
||||||
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 = retro_frame_null;
|
|
||||||
cbs->sample_cb = NULL;
|
|
||||||
cbs->sample_batch_cb = NULL;
|
|
||||||
cbs->state_cb = NULL;
|
|
||||||
cbs->poll_cb = retro_input_poll_null;
|
|
||||||
|
|
||||||
current_core.inited = false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_uninit_libretro_callbacks(void)
|
|
||||||
{
|
|
||||||
return core_deinit(&retro_ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* core_set_rewind_callbacks:
|
|
||||||
*
|
|
||||||
* Sets the audio sampling callbacks based on whether or not
|
|
||||||
* rewinding is currently activated.
|
|
||||||
**/
|
|
||||||
bool core_set_rewind_callbacks(void)
|
|
||||||
{
|
|
||||||
if (state_manager_frame_is_reversed())
|
|
||||||
{
|
|
||||||
current_core.retro_set_audio_sample(audio_driver_sample_rewind);
|
|
||||||
current_core.retro_set_audio_sample_batch(audio_driver_sample_batch_rewind);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
current_core.retro_set_audio_sample(audio_driver_sample);
|
|
||||||
current_core.retro_set_audio_sample_batch(audio_driver_sample_batch);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
|
||||||
/**
|
|
||||||
* core_set_netplay_callbacks:
|
|
||||||
*
|
|
||||||
* Set the I/O callbacks to use netplay's interceding callback system. Should
|
|
||||||
* only be called while initializing netplay.
|
|
||||||
**/
|
|
||||||
bool core_set_netplay_callbacks(void)
|
|
||||||
{
|
|
||||||
/* Force normal poll type for netplay. */
|
|
||||||
current_core.poll_type = POLL_TYPE_NORMAL;
|
|
||||||
|
|
||||||
/* And use netplay's interceding callbacks */
|
|
||||||
current_core.retro_set_video_refresh(video_frame_net);
|
|
||||||
current_core.retro_set_audio_sample(audio_sample_net);
|
|
||||||
current_core.retro_set_audio_sample_batch(audio_sample_batch_net);
|
|
||||||
current_core.retro_set_input_state(input_state_net);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
current_core.retro_set_video_refresh(cbs.frame_cb);
|
|
||||||
current_core.retro_set_audio_sample(cbs.sample_cb);
|
|
||||||
current_core.retro_set_audio_sample_batch(cbs.sample_batch_cb);
|
|
||||||
current_core.retro_set_input_state(cbs.state_cb);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool core_set_cheat(retro_ctx_cheat_info_t *info)
|
|
||||||
{
|
|
||||||
current_core.retro_cheat_set(info->index, info->enabled, info->code);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_reset_cheat(void)
|
|
||||||
{
|
|
||||||
current_core.retro_cheat_reset();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_api_version(retro_ctx_api_info_t *api)
|
|
||||||
{
|
|
||||||
if (!api)
|
|
||||||
return false;
|
|
||||||
api->version = current_core.retro_api_version();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_set_poll_type(unsigned *type)
|
|
||||||
{
|
|
||||||
current_core.poll_type = *type;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void core_uninit_symbols(void)
|
|
||||||
{
|
|
||||||
uninit_libretro_sym(¤t_core);
|
|
||||||
current_core.symbols_inited = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_init_symbols(enum rarch_core_type *type)
|
|
||||||
{
|
|
||||||
if (!type || !init_libretro_sym(*type, ¤t_core))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!current_core.retro_run)
|
|
||||||
current_core.retro_run = retro_run_null;
|
|
||||||
current_core.symbols_inited = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_set_controller_port_device(retro_ctx_controller_info_t *pad)
|
|
||||||
{
|
|
||||||
if (!pad)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
#ifdef HAVE_RUNAHEAD
|
|
||||||
remember_controller_port_device(pad->port, pad->device);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
current_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 = current_core.retro_get_memory_size(info->id);
|
|
||||||
info->data = current_core.retro_get_memory_data(info->id);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_load_game(retro_ctx_load_content_info_t *load_info)
|
|
||||||
{
|
|
||||||
bool contentless = false;
|
|
||||||
bool is_inited = false;
|
|
||||||
|
|
||||||
video_driver_set_cached_frame_ptr(NULL);
|
|
||||||
|
|
||||||
#ifdef HAVE_RUNAHEAD
|
|
||||||
set_load_content_info(load_info);
|
|
||||||
clear_controller_port_map();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
content_get_status(&contentless, &is_inited);
|
|
||||||
set_save_state_in_background(false);
|
|
||||||
|
|
||||||
if (load_info && load_info->special)
|
|
||||||
current_core.game_loaded = current_core.retro_load_game_special(
|
|
||||||
load_info->special->id, load_info->info, load_info->content->size);
|
|
||||||
else if (load_info && !string_is_empty(load_info->content->elems[0].data))
|
|
||||||
current_core.game_loaded = current_core.retro_load_game(load_info->info);
|
|
||||||
else if (contentless)
|
|
||||||
current_core.game_loaded = current_core.retro_load_game(NULL);
|
|
||||||
else
|
|
||||||
current_core.game_loaded = false;
|
|
||||||
|
|
||||||
return current_core.game_loaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_get_system_info(struct retro_system_info *system)
|
|
||||||
{
|
|
||||||
if (!system)
|
|
||||||
return false;
|
|
||||||
current_core.retro_get_system_info(system);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_unserialize(retro_ctx_serialize_info_t *info)
|
|
||||||
{
|
|
||||||
if (!info || !current_core.retro_unserialize(info->data_const, info->size))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
#if HAVE_NETWORKING
|
|
||||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_LOAD_SAVESTATE, info);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_serialize(retro_ctx_serialize_info_t *info)
|
|
||||||
{
|
|
||||||
if (!info || !current_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 = current_core.retro_serialize_size();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t core_serialization_quirks(void)
|
|
||||||
{
|
|
||||||
return current_core.serialization_quirks_v;
|
|
||||||
}
|
|
||||||
|
|
||||||
void core_set_serialization_quirks(uint64_t quirks)
|
|
||||||
{
|
|
||||||
current_core.serialization_quirks_v = quirks;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_set_environment(retro_ctx_environ_info_t *info)
|
|
||||||
{
|
|
||||||
if (!info)
|
|
||||||
return false;
|
|
||||||
current_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;
|
|
||||||
current_core.retro_get_system_av_info(av_info);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_reset(void)
|
|
||||||
{
|
|
||||||
video_driver_set_cached_frame_ptr(NULL);
|
|
||||||
|
|
||||||
current_core.retro_reset();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_init(void)
|
|
||||||
{
|
|
||||||
video_driver_set_cached_frame_ptr(NULL);
|
|
||||||
|
|
||||||
current_core.retro_init();
|
|
||||||
current_core.inited = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_unload(void)
|
|
||||||
{
|
|
||||||
video_driver_set_cached_frame_ptr(NULL);
|
|
||||||
|
|
||||||
if (current_core.inited)
|
|
||||||
current_core.retro_deinit();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_unload_game(void)
|
|
||||||
{
|
|
||||||
video_driver_free_hw_context();
|
|
||||||
|
|
||||||
video_driver_set_cached_frame_ptr(NULL);
|
|
||||||
|
|
||||||
if (current_core.game_loaded)
|
|
||||||
{
|
|
||||||
current_core.retro_unload_game();
|
|
||||||
current_core.game_loaded = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
audio_driver_stop();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_run(void)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_NETWORKING
|
|
||||||
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_PRE_FRAME, NULL))
|
|
||||||
{
|
|
||||||
/* 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();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (current_core.poll_type)
|
|
||||||
{
|
|
||||||
case POLL_TYPE_EARLY:
|
|
||||||
input_poll();
|
|
||||||
break;
|
|
||||||
case POLL_TYPE_LATE:
|
|
||||||
current_core.input_polled = false;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
current_core.retro_run();
|
|
||||||
|
|
||||||
if (current_core.poll_type == POLL_TYPE_LATE && !current_core.input_polled)
|
|
||||||
input_poll();
|
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
|
||||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_POST_FRAME, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_run_no_input_polling(void)
|
|
||||||
{
|
|
||||||
current_core.retro_run();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_load(unsigned poll_type_behavior)
|
|
||||||
{
|
|
||||||
current_core.poll_type = poll_type_behavior;
|
|
||||||
|
|
||||||
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());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_verify_api_version(void)
|
|
||||||
{
|
|
||||||
unsigned api_version = current_core.retro_api_version();
|
|
||||||
RARCH_LOG("%s: %u\n",
|
|
||||||
msg_hash_to_str(MSG_VERSION_OF_LIBRETRO_API),
|
|
||||||
api_version);
|
|
||||||
RARCH_LOG("%s: %u\n",
|
|
||||||
msg_hash_to_str(MSG_COMPILED_AGAINST_API),
|
|
||||||
RETRO_API_VERSION);
|
|
||||||
|
|
||||||
if (api_version != RETRO_API_VERSION)
|
|
||||||
{
|
|
||||||
RARCH_WARN("%s\n", msg_hash_to_str(MSG_LIBRETRO_ABI_BREAK));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_get_region(retro_ctx_region_info_t *info)
|
|
||||||
{
|
|
||||||
if (!info)
|
|
||||||
return false;
|
|
||||||
info->region = current_core.retro_get_region();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_has_set_input_descriptor(void)
|
|
||||||
{
|
|
||||||
return current_core.has_set_input_descriptors;
|
|
||||||
}
|
|
||||||
|
|
||||||
void core_set_input_descriptors(void)
|
|
||||||
{
|
|
||||||
current_core.has_set_input_descriptors = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void core_unset_input_descriptors(void)
|
|
||||||
{
|
|
||||||
current_core.has_set_input_descriptors = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_is_inited(void)
|
|
||||||
{
|
|
||||||
return current_core.inited;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_is_symbols_inited(void)
|
|
||||||
{
|
|
||||||
return current_core.symbols_inited;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core_is_game_loaded(void)
|
|
||||||
{
|
|
||||||
return current_core.game_loaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
void core_free_retro_game_info(struct retro_game_info *dest)
|
|
||||||
{
|
|
||||||
if (!dest)
|
|
||||||
return;
|
|
||||||
if (dest->path)
|
|
||||||
free((void*)dest->path);
|
|
||||||
if (dest->data)
|
|
||||||
free((void*)dest->data);
|
|
||||||
if (dest->meta)
|
|
||||||
free((void*)dest->meta);
|
|
||||||
dest->path = NULL;
|
|
||||||
dest->data = NULL;
|
|
||||||
dest->meta = NULL;
|
|
||||||
}
|
|
@ -1071,7 +1071,6 @@ GIT
|
|||||||
/*============================================================
|
/*============================================================
|
||||||
RETROARCH
|
RETROARCH
|
||||||
============================================================ */
|
============================================================ */
|
||||||
#include "../core_impl.c"
|
|
||||||
#include "../retroarch.c"
|
#include "../retroarch.c"
|
||||||
#include "../dirs.c"
|
#include "../dirs.c"
|
||||||
#include "../paths.c"
|
#include "../paths.c"
|
||||||
|
567
retroarch.c
567
retroarch.c
@ -164,6 +164,8 @@
|
|||||||
#include "retroarch.h"
|
#include "retroarch.h"
|
||||||
|
|
||||||
#ifdef HAVE_RUNAHEAD
|
#ifdef HAVE_RUNAHEAD
|
||||||
|
#include "runahead/copy_load_info.h"
|
||||||
|
#include "runahead/secondary_core.h"
|
||||||
#include "runahead/run_ahead.h"
|
#include "runahead/run_ahead.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -7742,6 +7744,20 @@ static void video_driver_pixel_converter_free(void)
|
|||||||
video_driver_scaler_ptr = NULL;
|
video_driver_scaler_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void video_driver_free_hw_context(void)
|
||||||
|
{
|
||||||
|
video_driver_context_lock();
|
||||||
|
|
||||||
|
if (hw_render.context_destroy)
|
||||||
|
hw_render.context_destroy();
|
||||||
|
|
||||||
|
memset(&hw_render, 0, sizeof(hw_render));
|
||||||
|
|
||||||
|
video_driver_context_unlock();
|
||||||
|
|
||||||
|
hw_render_context_negotiation = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void video_driver_free_internal(void)
|
static void video_driver_free_internal(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
@ -8398,7 +8414,7 @@ static void video_driver_lock_new(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_driver_destroy(void)
|
static void video_driver_destroy(void)
|
||||||
{
|
{
|
||||||
video_display_server_destroy();
|
video_display_server_destroy();
|
||||||
crt_video_restore();
|
crt_video_restore();
|
||||||
@ -8595,27 +8611,6 @@ bool video_driver_get_prev_video_out(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool video_driver_init(bool *video_is_threaded)
|
|
||||||
{
|
|
||||||
video_driver_lock_new();
|
|
||||||
video_driver_filter_free();
|
|
||||||
video_driver_set_cached_frame_ptr(NULL);
|
|
||||||
return video_driver_init_internal(video_is_threaded);
|
|
||||||
}
|
|
||||||
|
|
||||||
void video_driver_destroy_data(void)
|
|
||||||
{
|
|
||||||
video_driver_data = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void video_driver_free(void)
|
|
||||||
{
|
|
||||||
video_driver_free_internal();
|
|
||||||
video_driver_lock_free();
|
|
||||||
video_driver_data = NULL;
|
|
||||||
video_driver_set_cached_frame_ptr(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void video_driver_monitor_reset(void)
|
void video_driver_monitor_reset(void)
|
||||||
{
|
{
|
||||||
video_driver_frame_time_count = 0;
|
video_driver_frame_time_count = 0;
|
||||||
@ -8963,19 +8958,6 @@ bool video_driver_is_hw_context(void)
|
|||||||
return is_hw_context;
|
return is_hw_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_driver_free_hw_context(void)
|
|
||||||
{
|
|
||||||
video_driver_context_lock();
|
|
||||||
|
|
||||||
if (hw_render.context_destroy)
|
|
||||||
hw_render.context_destroy();
|
|
||||||
|
|
||||||
memset(&hw_render, 0, sizeof(hw_render));
|
|
||||||
|
|
||||||
video_driver_context_unlock();
|
|
||||||
|
|
||||||
hw_render_context_negotiation = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const struct retro_hw_render_context_negotiation_interface *
|
const struct retro_hw_render_context_negotiation_interface *
|
||||||
video_driver_get_context_negotiation_interface(void)
|
video_driver_get_context_negotiation_interface(void)
|
||||||
@ -11422,7 +11404,11 @@ void drivers_init(int flags)
|
|||||||
video_driver_get_hw_context_internal();
|
video_driver_get_hw_context_internal();
|
||||||
|
|
||||||
video_driver_monitor_reset();
|
video_driver_monitor_reset();
|
||||||
video_driver_init(&video_is_threaded);
|
|
||||||
|
video_driver_lock_new();
|
||||||
|
video_driver_filter_free();
|
||||||
|
video_driver_set_cached_frame_ptr(NULL);
|
||||||
|
video_driver_init_internal(&video_is_threaded);
|
||||||
|
|
||||||
if (!video_driver_is_video_cache_context_ack()
|
if (!video_driver_is_video_cache_context_ack()
|
||||||
&& hwr->context_reset)
|
&& hwr->context_reset)
|
||||||
@ -11588,13 +11574,20 @@ void driver_uninit(int flags)
|
|||||||
led_driver_free();
|
led_driver_free();
|
||||||
|
|
||||||
if (flags & DRIVERS_VIDEO_INPUT)
|
if (flags & DRIVERS_VIDEO_INPUT)
|
||||||
video_driver_free();
|
{
|
||||||
|
video_driver_free_internal();
|
||||||
|
video_driver_lock_free();
|
||||||
|
video_driver_data = NULL;
|
||||||
|
video_driver_set_cached_frame_ptr(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & DRIVER_AUDIO_MASK)
|
if (flags & DRIVER_AUDIO_MASK)
|
||||||
audio_driver_deinit();
|
audio_driver_deinit();
|
||||||
|
|
||||||
if ((flags & DRIVER_VIDEO_MASK))
|
if ((flags & DRIVER_VIDEO_MASK))
|
||||||
video_driver_destroy_data();
|
{
|
||||||
|
video_driver_data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & DRIVER_INPUT_MASK))
|
if ((flags & DRIVER_INPUT_MASK))
|
||||||
{
|
{
|
||||||
@ -16337,3 +16330,501 @@ enum retro_language rarch_get_language_from_iso(const char *iso639)
|
|||||||
|
|
||||||
return lang;
|
return lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Libretro core loader */
|
||||||
|
|
||||||
|
struct retro_callbacks retro_ctx;
|
||||||
|
struct retro_core_t current_core;
|
||||||
|
|
||||||
|
static void retro_run_null(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void retro_frame_null(const void *data, unsigned width,
|
||||||
|
unsigned height, size_t pitch)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void retro_input_poll_null(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void core_input_state_poll_maybe(void)
|
||||||
|
{
|
||||||
|
if (current_core.poll_type == POLL_TYPE_NORMAL)
|
||||||
|
input_poll();
|
||||||
|
}
|
||||||
|
|
||||||
|
static int16_t core_input_state_poll(unsigned port,
|
||||||
|
unsigned device, unsigned idx, unsigned id)
|
||||||
|
{
|
||||||
|
if (current_core.poll_type == POLL_TYPE_LATE)
|
||||||
|
{
|
||||||
|
if (!current_core.input_polled)
|
||||||
|
input_poll();
|
||||||
|
|
||||||
|
current_core.input_polled = true;
|
||||||
|
}
|
||||||
|
return input_state(port, device, idx, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void core_set_input_state(retro_ctx_input_state_info_t *info)
|
||||||
|
{
|
||||||
|
current_core.retro_set_input_state(info->cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* core_init_libretro_cbs:
|
||||||
|
* @data : pointer to retro_callbacks object
|
||||||
|
*
|
||||||
|
* Initializes libretro callbacks, and binds the libretro callbacks
|
||||||
|
* to default callback functions.
|
||||||
|
**/
|
||||||
|
static bool core_init_libretro_cbs(struct retro_callbacks *cbs)
|
||||||
|
{
|
||||||
|
current_core.retro_set_video_refresh(video_driver_frame);
|
||||||
|
current_core.retro_set_audio_sample(audio_driver_sample);
|
||||||
|
current_core.retro_set_audio_sample_batch(audio_driver_sample_batch);
|
||||||
|
current_core.retro_set_input_state(core_input_state_poll);
|
||||||
|
current_core.retro_set_input_poll(core_input_state_poll_maybe);
|
||||||
|
|
||||||
|
core_set_default_callbacks(cbs);
|
||||||
|
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
core_set_netplay_callbacks();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* core_set_default_callbacks:
|
||||||
|
* @data : pointer to retro_callbacks object
|
||||||
|
*
|
||||||
|
* Binds the libretro callbacks to default callback functions.
|
||||||
|
**/
|
||||||
|
bool core_set_default_callbacks(struct retro_callbacks *cbs)
|
||||||
|
{
|
||||||
|
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 = retro_frame_null;
|
||||||
|
cbs->sample_cb = NULL;
|
||||||
|
cbs->sample_batch_cb = NULL;
|
||||||
|
cbs->state_cb = NULL;
|
||||||
|
cbs->poll_cb = retro_input_poll_null;
|
||||||
|
|
||||||
|
current_core.inited = false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_uninit_libretro_callbacks(void)
|
||||||
|
{
|
||||||
|
return core_deinit(&retro_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* core_set_rewind_callbacks:
|
||||||
|
*
|
||||||
|
* Sets the audio sampling callbacks based on whether or not
|
||||||
|
* rewinding is currently activated.
|
||||||
|
**/
|
||||||
|
bool core_set_rewind_callbacks(void)
|
||||||
|
{
|
||||||
|
if (state_manager_frame_is_reversed())
|
||||||
|
{
|
||||||
|
current_core.retro_set_audio_sample(audio_driver_sample_rewind);
|
||||||
|
current_core.retro_set_audio_sample_batch(audio_driver_sample_batch_rewind);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
current_core.retro_set_audio_sample(audio_driver_sample);
|
||||||
|
current_core.retro_set_audio_sample_batch(audio_driver_sample_batch);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
/**
|
||||||
|
* core_set_netplay_callbacks:
|
||||||
|
*
|
||||||
|
* Set the I/O callbacks to use netplay's interceding callback system. Should
|
||||||
|
* only be called while initializing netplay.
|
||||||
|
**/
|
||||||
|
bool core_set_netplay_callbacks(void)
|
||||||
|
{
|
||||||
|
/* Force normal poll type for netplay. */
|
||||||
|
current_core.poll_type = POLL_TYPE_NORMAL;
|
||||||
|
|
||||||
|
/* And use netplay's interceding callbacks */
|
||||||
|
current_core.retro_set_video_refresh(video_frame_net);
|
||||||
|
current_core.retro_set_audio_sample(audio_sample_net);
|
||||||
|
current_core.retro_set_audio_sample_batch(audio_sample_batch_net);
|
||||||
|
current_core.retro_set_input_state(input_state_net);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
current_core.retro_set_video_refresh(cbs.frame_cb);
|
||||||
|
current_core.retro_set_audio_sample(cbs.sample_cb);
|
||||||
|
current_core.retro_set_audio_sample_batch(cbs.sample_batch_cb);
|
||||||
|
current_core.retro_set_input_state(cbs.state_cb);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool core_set_cheat(retro_ctx_cheat_info_t *info)
|
||||||
|
{
|
||||||
|
current_core.retro_cheat_set(info->index, info->enabled, info->code);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_reset_cheat(void)
|
||||||
|
{
|
||||||
|
current_core.retro_cheat_reset();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_api_version(retro_ctx_api_info_t *api)
|
||||||
|
{
|
||||||
|
if (!api)
|
||||||
|
return false;
|
||||||
|
api->version = current_core.retro_api_version();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_set_poll_type(unsigned *type)
|
||||||
|
{
|
||||||
|
current_core.poll_type = *type;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void core_uninit_symbols(void)
|
||||||
|
{
|
||||||
|
uninit_libretro_sym(¤t_core);
|
||||||
|
current_core.symbols_inited = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_init_symbols(enum rarch_core_type *type)
|
||||||
|
{
|
||||||
|
if (!type || !init_libretro_sym(*type, ¤t_core))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!current_core.retro_run)
|
||||||
|
current_core.retro_run = retro_run_null;
|
||||||
|
current_core.symbols_inited = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_set_controller_port_device(retro_ctx_controller_info_t *pad)
|
||||||
|
{
|
||||||
|
if (!pad)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#ifdef HAVE_RUNAHEAD
|
||||||
|
remember_controller_port_device(pad->port, pad->device);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
current_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 = current_core.retro_get_memory_size(info->id);
|
||||||
|
info->data = current_core.retro_get_memory_data(info->id);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_load_game(retro_ctx_load_content_info_t *load_info)
|
||||||
|
{
|
||||||
|
bool contentless = false;
|
||||||
|
bool is_inited = false;
|
||||||
|
|
||||||
|
video_driver_set_cached_frame_ptr(NULL);
|
||||||
|
|
||||||
|
#ifdef HAVE_RUNAHEAD
|
||||||
|
set_load_content_info(load_info);
|
||||||
|
clear_controller_port_map();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
content_get_status(&contentless, &is_inited);
|
||||||
|
set_save_state_in_background(false);
|
||||||
|
|
||||||
|
if (load_info && load_info->special)
|
||||||
|
current_core.game_loaded = current_core.retro_load_game_special(
|
||||||
|
load_info->special->id, load_info->info, load_info->content->size);
|
||||||
|
else if (load_info && !string_is_empty(load_info->content->elems[0].data))
|
||||||
|
current_core.game_loaded = current_core.retro_load_game(load_info->info);
|
||||||
|
else if (contentless)
|
||||||
|
current_core.game_loaded = current_core.retro_load_game(NULL);
|
||||||
|
else
|
||||||
|
current_core.game_loaded = false;
|
||||||
|
|
||||||
|
return current_core.game_loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_get_system_info(struct retro_system_info *system)
|
||||||
|
{
|
||||||
|
if (!system)
|
||||||
|
return false;
|
||||||
|
current_core.retro_get_system_info(system);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_unserialize(retro_ctx_serialize_info_t *info)
|
||||||
|
{
|
||||||
|
if (!info || !current_core.retro_unserialize(info->data_const, info->size))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#if HAVE_NETWORKING
|
||||||
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_LOAD_SAVESTATE, info);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_serialize(retro_ctx_serialize_info_t *info)
|
||||||
|
{
|
||||||
|
if (!info || !current_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 = current_core.retro_serialize_size();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t core_serialization_quirks(void)
|
||||||
|
{
|
||||||
|
return current_core.serialization_quirks_v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void core_set_serialization_quirks(uint64_t quirks)
|
||||||
|
{
|
||||||
|
current_core.serialization_quirks_v = quirks;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_set_environment(retro_ctx_environ_info_t *info)
|
||||||
|
{
|
||||||
|
if (!info)
|
||||||
|
return false;
|
||||||
|
current_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;
|
||||||
|
current_core.retro_get_system_av_info(av_info);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_reset(void)
|
||||||
|
{
|
||||||
|
video_driver_set_cached_frame_ptr(NULL);
|
||||||
|
|
||||||
|
current_core.retro_reset();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_init(void)
|
||||||
|
{
|
||||||
|
video_driver_set_cached_frame_ptr(NULL);
|
||||||
|
|
||||||
|
current_core.retro_init();
|
||||||
|
current_core.inited = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_unload(void)
|
||||||
|
{
|
||||||
|
video_driver_set_cached_frame_ptr(NULL);
|
||||||
|
|
||||||
|
if (current_core.inited)
|
||||||
|
current_core.retro_deinit();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_unload_game(void)
|
||||||
|
{
|
||||||
|
video_driver_free_hw_context();
|
||||||
|
|
||||||
|
video_driver_set_cached_frame_ptr(NULL);
|
||||||
|
|
||||||
|
if (current_core.game_loaded)
|
||||||
|
{
|
||||||
|
current_core.retro_unload_game();
|
||||||
|
current_core.game_loaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
audio_driver_stop();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_run(void)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_PRE_FRAME, NULL))
|
||||||
|
{
|
||||||
|
/* 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();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch (current_core.poll_type)
|
||||||
|
{
|
||||||
|
case POLL_TYPE_EARLY:
|
||||||
|
input_poll();
|
||||||
|
break;
|
||||||
|
case POLL_TYPE_LATE:
|
||||||
|
current_core.input_polled = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
current_core.retro_run();
|
||||||
|
|
||||||
|
if (current_core.poll_type == POLL_TYPE_LATE && !current_core.input_polled)
|
||||||
|
input_poll();
|
||||||
|
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_POST_FRAME, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_run_no_input_polling(void)
|
||||||
|
{
|
||||||
|
current_core.retro_run();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool core_verify_api_version(void)
|
||||||
|
{
|
||||||
|
unsigned api_version = current_core.retro_api_version();
|
||||||
|
RARCH_LOG("%s: %u\n",
|
||||||
|
msg_hash_to_str(MSG_VERSION_OF_LIBRETRO_API),
|
||||||
|
api_version);
|
||||||
|
RARCH_LOG("%s: %u\n",
|
||||||
|
msg_hash_to_str(MSG_COMPILED_AGAINST_API),
|
||||||
|
RETRO_API_VERSION);
|
||||||
|
|
||||||
|
if (api_version != RETRO_API_VERSION)
|
||||||
|
{
|
||||||
|
RARCH_WARN("%s\n", msg_hash_to_str(MSG_LIBRETRO_ABI_BREAK));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_load(unsigned poll_type_behavior)
|
||||||
|
{
|
||||||
|
current_core.poll_type = poll_type_behavior;
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_get_region(retro_ctx_region_info_t *info)
|
||||||
|
{
|
||||||
|
if (!info)
|
||||||
|
return false;
|
||||||
|
info->region = current_core.retro_get_region();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_has_set_input_descriptor(void)
|
||||||
|
{
|
||||||
|
return current_core.has_set_input_descriptors;
|
||||||
|
}
|
||||||
|
|
||||||
|
void core_set_input_descriptors(void)
|
||||||
|
{
|
||||||
|
current_core.has_set_input_descriptors = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void core_unset_input_descriptors(void)
|
||||||
|
{
|
||||||
|
current_core.has_set_input_descriptors = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_is_inited(void)
|
||||||
|
{
|
||||||
|
return current_core.inited;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_is_symbols_inited(void)
|
||||||
|
{
|
||||||
|
return current_core.symbols_inited;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool core_is_game_loaded(void)
|
||||||
|
{
|
||||||
|
return current_core.game_loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
void core_free_retro_game_info(struct retro_game_info *dest)
|
||||||
|
{
|
||||||
|
if (!dest)
|
||||||
|
return;
|
||||||
|
if (dest->path)
|
||||||
|
free((void*)dest->path);
|
||||||
|
if (dest->data)
|
||||||
|
free((void*)dest->data);
|
||||||
|
if (dest->meta)
|
||||||
|
free((void*)dest->meta);
|
||||||
|
dest->path = NULL;
|
||||||
|
dest->data = NULL;
|
||||||
|
dest->meta = NULL;
|
||||||
|
}
|
||||||
|
@ -1649,7 +1649,6 @@ bool video_driver_has_windowed(void);
|
|||||||
|
|
||||||
bool video_driver_cached_frame_has_valid_framebuffer(void);
|
bool video_driver_cached_frame_has_valid_framebuffer(void);
|
||||||
|
|
||||||
void video_driver_destroy(void);
|
|
||||||
void video_driver_set_cached_frame_ptr(const void *data);
|
void video_driver_set_cached_frame_ptr(const void *data);
|
||||||
void video_driver_set_stub_frame(void);
|
void video_driver_set_stub_frame(void);
|
||||||
void video_driver_unset_stub_frame(void);
|
void video_driver_unset_stub_frame(void);
|
||||||
@ -1667,10 +1666,6 @@ void video_driver_unset_rgba(void);
|
|||||||
bool video_driver_supports_rgba(void);
|
bool video_driver_supports_rgba(void);
|
||||||
bool video_driver_get_next_video_out(void);
|
bool video_driver_get_next_video_out(void);
|
||||||
bool video_driver_get_prev_video_out(void);
|
bool video_driver_get_prev_video_out(void);
|
||||||
bool video_driver_init(bool *video_is_threaded);
|
|
||||||
void video_driver_destroy_data(void);
|
|
||||||
void video_driver_free(void);
|
|
||||||
void video_driver_free_hw_context(void);
|
|
||||||
void video_driver_monitor_reset(void);
|
void video_driver_monitor_reset(void);
|
||||||
void video_driver_set_aspect_ratio(void);
|
void video_driver_set_aspect_ratio(void);
|
||||||
void video_driver_update_viewport(struct video_viewport* vp, bool force_full, bool keep_aspect);
|
void video_driver_update_viewport(struct video_viewport* vp, bool force_full, bool keep_aspect);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user