1 /*  RetroArch - A frontend for libretro.
2  *  Copyright (C) 2010-2014 - Hans-Kristian Arntzen
3  *  Copyright (C) 2011-2017 - Daniel De Matteis
4  *  Copyright (C) 2016-2019 - Brad Parker
5  *
6  *  RetroArch is free software: you can redistribute it and/or modify it under the terms
7  *  of the GNU General Public License as published by the Free Software Found-
8  *  ation, either version 3 of the License, or (at your option) any later version.
9  *
10  *  RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11  *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  *  PURPOSE.  See the GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License along with RetroArch.
15  *  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __DYNAMIC_H
19 #define __DYNAMIC_H
20 
21 #include <boolean.h>
22 #include <retro_common_api.h>
23 #include <libretro.h>
24 
25 #include "core_type.h"
26 
27 RETRO_BEGIN_DECLS
28 
29 /**
30  * libretro_free_system_info:
31  * @info                         : Pointer to system info information.
32  *
33  * Frees system information.
34  **/
35 void libretro_free_system_info(struct retro_system_info *info);
36 
37 const struct retro_subsystem_info *libretro_find_subsystem_info(
38       const struct retro_subsystem_info *info,
39       unsigned num_info, const char *ident);
40 
41 /**
42  * libretro_find_controller_description:
43  * @info                         : Pointer to controller info handle.
44  * @id                           : Identifier of controller to search
45  *                                 for.
46  *
47  * Search for a controller of type @id in @info.
48  *
49  * Returns: controller description of found controller on success,
50  * otherwise NULL.
51  **/
52 const struct retro_controller_description *
53    libretro_find_controller_description(
54          const struct retro_controller_info *info, unsigned id);
55 
56 struct retro_core_t
57 {
58    uint64_t serialization_quirks_v;
59    void (*retro_init)(void);
60    void (*retro_deinit)(void);
61    unsigned (*retro_api_version)(void);
62    void (*retro_get_system_info)(struct retro_system_info*);
63    void (*retro_get_system_av_info)(struct retro_system_av_info*);
64    void (*retro_set_environment)(retro_environment_t);
65    void (*retro_set_video_refresh)(retro_video_refresh_t);
66    void (*retro_set_audio_sample)(retro_audio_sample_t);
67    void (*retro_set_audio_sample_batch)(retro_audio_sample_batch_t);
68    void (*retro_set_input_poll)(retro_input_poll_t);
69    void (*retro_set_input_state)(retro_input_state_t);
70    void (*retro_set_controller_port_device)(unsigned, unsigned);
71    void (*retro_reset)(void);
72    void (*retro_run)(void);
73    size_t (*retro_serialize_size)(void);
74    bool (*retro_serialize)(void*, size_t);
75    bool (*retro_unserialize)(const void*, size_t);
76    void (*retro_cheat_reset)(void);
77    void (*retro_cheat_set)(unsigned, bool, const char*);
78    bool (*retro_load_game)(const struct retro_game_info*);
79    bool (*retro_load_game_special)(unsigned,
80          const struct retro_game_info*, size_t);
81    void (*retro_unload_game)(void);
82    unsigned (*retro_get_region)(void);
83    void *(*retro_get_memory_data)(unsigned);
84    size_t (*retro_get_memory_size)(unsigned);
85 
86    unsigned poll_type;
87    bool inited;
88    bool symbols_inited;
89    bool game_loaded;
90    bool input_polled;
91    bool has_set_subsystems;
92    bool has_set_input_descriptors;
93 };
94 
95 bool libretro_get_shared_context(void);
96 
97 /* Arbitrary twenty subsystems limite */
98 #define SUBSYSTEM_MAX_SUBSYSTEMS 20
99 /* Arbitrary 10 roms for each subsystem limit */
100 #define SUBSYSTEM_MAX_SUBSYSTEM_ROMS 10
101 
102 /* TODO/FIXME - globals */
103 extern struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS];
104 extern unsigned subsystem_current_count;
105 
106 RETRO_END_DECLS
107 
108 #endif
109