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
|
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/>.
|
|
|
|
*/
|
|
|
|
|
2016-05-08 03:29:10 +00:00
|
|
|
#ifndef _LIBRETRO_CORE_IMPL_H
|
|
|
|
#define _LIBRETRO_CORE_IMPL_H
|
2014-09-23 01:03:56 +00:00
|
|
|
|
2016-01-27 02:08:49 +00:00
|
|
|
#include <boolean.h>
|
2016-05-10 17:03:53 +00:00
|
|
|
#include <libretro.h>
|
2016-09-06 04:11:44 +00:00
|
|
|
|
2016-06-03 01:22:35 +00:00
|
|
|
#include <retro_common_api.h>
|
2016-01-27 02:08:49 +00:00
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
#include "core_type.h"
|
2016-09-06 04:11:44 +00:00
|
|
|
#include "input/input_defines.h"
|
2014-09-23 01:03:56 +00:00
|
|
|
|
2016-06-03 01:22:35 +00:00
|
|
|
RETRO_BEGIN_DECLS
|
|
|
|
|
2016-01-27 00:16:53 +00:00
|
|
|
enum
|
|
|
|
{
|
2017-12-12 07:55:31 +00:00
|
|
|
/* Polling is performed before
|
2016-02-04 19:56:22 +00:00
|
|
|
* call to retro_run. */
|
2016-01-27 00:16:53 +00:00
|
|
|
POLL_TYPE_EARLY = 0,
|
2016-02-04 19:56:22 +00:00
|
|
|
|
2016-01-27 00:16:53 +00:00
|
|
|
/* Polling is performed when requested. */
|
|
|
|
POLL_TYPE_NORMAL,
|
2016-02-04 19:56:22 +00:00
|
|
|
|
2017-12-12 07:55:31 +00:00
|
|
|
/* Polling is performed on first call to
|
2016-01-27 00:17:55 +00:00
|
|
|
* retro_input_state per frame. */
|
2016-01-27 00:16:53 +00:00
|
|
|
POLL_TYPE_LATE
|
|
|
|
};
|
|
|
|
|
2016-11-13 20:58:09 +00:00
|
|
|
typedef struct rarch_memory_descriptor
|
|
|
|
{
|
|
|
|
struct retro_memory_descriptor core;
|
|
|
|
size_t disconnect_mask;
|
|
|
|
} rarch_memory_descriptor_t;
|
|
|
|
|
|
|
|
typedef struct rarch_memory_map
|
|
|
|
{
|
|
|
|
rarch_memory_descriptor_t *descriptors;
|
|
|
|
unsigned num_descriptors;
|
|
|
|
} rarch_memory_map_t;
|
|
|
|
|
2016-09-06 04:11:44 +00:00
|
|
|
typedef struct rarch_system_info
|
|
|
|
{
|
|
|
|
struct retro_system_info info;
|
|
|
|
|
|
|
|
unsigned rotation;
|
|
|
|
unsigned performance_level;
|
2017-05-28 15:21:57 +00:00
|
|
|
bool load_no_content;
|
2016-09-06 04:11:44 +00:00
|
|
|
|
|
|
|
const char *input_desc_btn[MAX_USERS][RARCH_FIRST_META_KEY];
|
2016-10-27 07:21:03 +00:00
|
|
|
char valid_extensions[255];
|
2016-09-06 04:11:44 +00:00
|
|
|
|
2019-01-14 20:30:20 +00:00
|
|
|
bool supports_vfs;
|
|
|
|
|
2017-12-12 07:55:31 +00:00
|
|
|
struct retro_disk_control_callback disk_control_cb;
|
2016-09-06 04:11:44 +00:00
|
|
|
struct retro_location_callback location_cb;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct retro_subsystem_info *data;
|
|
|
|
unsigned size;
|
|
|
|
} subsystem;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct retro_controller_info *data;
|
|
|
|
unsigned size;
|
|
|
|
} ports;
|
2017-12-12 07:55:31 +00:00
|
|
|
|
2016-11-13 20:58:09 +00:00
|
|
|
rarch_memory_map_t mmaps;
|
2016-09-06 04:11:44 +00:00
|
|
|
} rarch_system_info_t;
|
|
|
|
|
2016-01-28 03:39:38 +00:00
|
|
|
typedef struct retro_ctx_input_state_info
|
|
|
|
{
|
|
|
|
retro_input_state_t cb;
|
|
|
|
} retro_ctx_input_state_info_t;
|
|
|
|
|
2016-01-28 03:34:39 +00:00
|
|
|
typedef struct retro_ctx_cheat_info
|
|
|
|
{
|
|
|
|
unsigned index;
|
|
|
|
bool enabled;
|
|
|
|
const char *code;
|
|
|
|
} retro_ctx_cheat_info_t;
|
|
|
|
|
2016-01-28 03:26:17 +00:00
|
|
|
typedef struct retro_ctx_api_info
|
|
|
|
{
|
|
|
|
unsigned version;
|
|
|
|
} retro_ctx_api_info_t;
|
|
|
|
|
2016-09-03 16:50:04 +00:00
|
|
|
typedef struct retro_ctx_region_info
|
|
|
|
{
|
|
|
|
unsigned region;
|
|
|
|
} retro_ctx_region_info_t;
|
|
|
|
|
2016-01-27 18:13:15 +00:00
|
|
|
typedef struct retro_ctx_controller_info
|
|
|
|
{
|
2016-01-28 03:13:31 +00:00
|
|
|
unsigned port;
|
2016-01-27 18:13:15 +00:00
|
|
|
unsigned device;
|
|
|
|
} retro_ctx_controller_info_t;
|
|
|
|
|
2016-01-27 08:29:18 +00:00
|
|
|
typedef struct retro_ctx_memory_info
|
|
|
|
{
|
|
|
|
void *data;
|
|
|
|
size_t size;
|
2016-01-28 01:53:43 +00:00
|
|
|
unsigned id;
|
2016-01-27 08:29:18 +00:00
|
|
|
} retro_ctx_memory_info_t;
|
|
|
|
|
2016-01-27 08:13:26 +00:00
|
|
|
typedef struct retro_ctx_load_content_info
|
|
|
|
{
|
|
|
|
struct retro_game_info *info;
|
|
|
|
const struct string_list *content;
|
|
|
|
const struct retro_subsystem_info *special;
|
|
|
|
} retro_ctx_load_content_info_t;
|
|
|
|
|
2016-01-27 06:14:06 +00:00
|
|
|
typedef struct retro_ctx_serialize_info
|
|
|
|
{
|
|
|
|
const void *data_const;
|
|
|
|
void *data;
|
|
|
|
size_t size;
|
|
|
|
} retro_ctx_serialize_info_t;
|
|
|
|
|
2016-01-27 05:46:59 +00:00
|
|
|
typedef struct retro_ctx_size_info
|
|
|
|
{
|
|
|
|
size_t size;
|
|
|
|
} retro_ctx_size_info_t;
|
|
|
|
|
2016-01-27 04:19:15 +00:00
|
|
|
typedef struct retro_ctx_environ_info
|
|
|
|
{
|
|
|
|
retro_environment_t env;
|
|
|
|
} retro_ctx_environ_info_t;
|
|
|
|
|
2014-09-23 02:42:49 +00:00
|
|
|
typedef struct retro_callbacks
|
2014-09-23 01:03:56 +00:00
|
|
|
{
|
|
|
|
retro_video_refresh_t frame_cb;
|
|
|
|
retro_audio_sample_t sample_cb;
|
|
|
|
retro_audio_sample_batch_t sample_batch_cb;
|
|
|
|
retro_input_state_t state_cb;
|
2014-09-24 07:52:01 +00:00
|
|
|
retro_input_poll_t poll_cb;
|
2014-09-23 02:42:49 +00:00
|
|
|
} retro_callbacks_t;
|
2014-09-23 01:03:56 +00:00
|
|
|
|
2017-01-23 13:50:00 +00:00
|
|
|
bool core_load(unsigned poll_type_behavior);
|
2016-05-07 23:33:57 +00:00
|
|
|
|
|
|
|
bool core_unload(void);
|
|
|
|
|
2017-05-21 08:34:50 +00:00
|
|
|
bool core_set_default_callbacks(struct retro_callbacks *cbs);
|
2016-05-07 23:33:57 +00:00
|
|
|
|
|
|
|
bool core_set_rewind_callbacks(void);
|
|
|
|
|
2016-12-18 04:08:59 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
2016-09-29 02:45:31 +00:00
|
|
|
bool core_set_netplay_callbacks(void);
|
|
|
|
|
2016-12-18 04:08:59 +00:00
|
|
|
bool core_unset_netplay_callbacks(void);
|
|
|
|
#endif
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_set_poll_type(unsigned *type);
|
|
|
|
|
|
|
|
/* Runs the core for one frame. */
|
|
|
|
bool core_run(void);
|
|
|
|
|
2018-03-28 19:22:07 +00:00
|
|
|
/* Runs the core for one frame, but does not trigger any input polling */
|
|
|
|
bool core_run_no_input_polling(void);
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_init(void);
|
|
|
|
|
|
|
|
bool core_deinit(void *data);
|
|
|
|
|
|
|
|
bool core_unload_game(void);
|
|
|
|
|
|
|
|
bool core_reset(void);
|
|
|
|
|
|
|
|
bool core_set_environment(retro_ctx_environ_info_t *info);
|
|
|
|
|
|
|
|
bool core_serialize_size(retro_ctx_size_info_t *info);
|
|
|
|
|
2016-09-30 19:37:02 +00:00
|
|
|
uint64_t core_serialization_quirks(void);
|
2016-09-30 18:16:48 +00:00
|
|
|
|
2016-09-30 19:37:02 +00:00
|
|
|
void core_set_serialization_quirks(uint64_t quirks);
|
2016-09-30 17:29:27 +00:00
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_serialize(retro_ctx_serialize_info_t *info);
|
|
|
|
|
|
|
|
bool core_unserialize(retro_ctx_serialize_info_t *info);
|
|
|
|
|
|
|
|
bool core_init_symbols(enum rarch_core_type *type);
|
|
|
|
|
|
|
|
bool core_set_cheat(retro_ctx_cheat_info_t *info);
|
|
|
|
|
|
|
|
bool core_reset_cheat(void);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2016-09-03 16:50:04 +00:00
|
|
|
bool core_get_region(retro_ctx_region_info_t *info);
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
bool core_get_memory(retro_ctx_memory_info_t *info);
|
|
|
|
|
|
|
|
/* Initialize system A/V information. */
|
|
|
|
bool core_get_system_av_info(struct retro_system_av_info *av_info);
|
|
|
|
|
|
|
|
/* Get system A/V information. */
|
|
|
|
bool core_get_system_info(struct retro_system_info *system);
|
|
|
|
|
|
|
|
bool core_load_game(retro_ctx_load_content_info_t *load_info);
|
|
|
|
|
|
|
|
bool core_set_controller_port_device(retro_ctx_controller_info_t *pad);
|
|
|
|
|
|
|
|
bool core_has_set_input_descriptor(void);
|
|
|
|
|
|
|
|
void core_set_input_descriptors(void);
|
|
|
|
|
|
|
|
void core_unset_input_descriptors(void);
|
|
|
|
|
|
|
|
bool core_uninit_libretro_callbacks(void);
|
|
|
|
|
2016-07-23 05:06:32 +00:00
|
|
|
void core_uninit_symbols(void);
|
|
|
|
|
2016-05-07 23:33:57 +00:00
|
|
|
void core_set_input_state(retro_ctx_input_state_info_t *info);
|
2016-01-27 02:08:49 +00:00
|
|
|
|
2016-09-06 01:52:29 +00:00
|
|
|
bool core_is_symbols_inited(void);
|
|
|
|
|
|
|
|
bool core_is_inited(void);
|
|
|
|
|
2016-09-03 16:50:04 +00:00
|
|
|
bool core_is_game_loaded(void);
|
|
|
|
|
2017-05-21 07:30:32 +00:00
|
|
|
extern struct retro_callbacks retro_ctx;
|
|
|
|
|
2016-06-03 01:22:35 +00:00
|
|
|
RETRO_END_DECLS
|
2014-11-29 20:18:45 +00:00
|
|
|
|
2014-09-23 01:03:56 +00:00
|
|
|
#endif
|