rc_libretro.h (4254B)
1 #ifndef RC_LIBRETRO_H 2 #define RC_LIBRETRO_H 3 4 #include "rc_export.h" 5 6 /* this file comes from the libretro repository, which is not an explicit submodule. 7 * the integration must set up paths appropriately to find it. */ 8 #include <libretro.h> 9 10 #include <stddef.h> 11 #include <stdint.h> 12 13 RC_BEGIN_C_DECLS 14 15 /*****************************************************************************\ 16 | Disallowed Settings | 17 \*****************************************************************************/ 18 19 typedef struct rc_disallowed_setting_t 20 { 21 const char* setting; 22 const char* value; 23 } rc_disallowed_setting_t; 24 25 RC_EXPORT const rc_disallowed_setting_t* RC_CCONV rc_libretro_get_disallowed_settings(const char* library_name); 26 RC_EXPORT int RC_CCONV rc_libretro_is_setting_allowed(const rc_disallowed_setting_t* disallowed_settings, const char* setting, const char* value); 27 RC_EXPORT int RC_CCONV rc_libretro_is_system_allowed(const char* library_name, uint32_t console_id); 28 29 /*****************************************************************************\ 30 | Memory Mapping | 31 \*****************************************************************************/ 32 33 /* specifies a function to call for verbose logging */ 34 typedef void (RC_CCONV *rc_libretro_message_callback)(const char*); 35 RC_EXPORT void RC_CCONV rc_libretro_init_verbose_message_callback(rc_libretro_message_callback callback); 36 37 #define RC_LIBRETRO_MAX_MEMORY_REGIONS 32 38 typedef struct rc_libretro_memory_regions_t 39 { 40 uint8_t* data[RC_LIBRETRO_MAX_MEMORY_REGIONS]; 41 size_t size[RC_LIBRETRO_MAX_MEMORY_REGIONS]; 42 size_t total_size; 43 uint32_t count; 44 } rc_libretro_memory_regions_t; 45 46 typedef struct rc_libretro_core_memory_info_t 47 { 48 uint8_t* data; 49 size_t size; 50 } rc_libretro_core_memory_info_t; 51 52 typedef void (RC_CCONV *rc_libretro_get_core_memory_info_func)(uint32_t id, rc_libretro_core_memory_info_t* info); 53 54 RC_EXPORT int RC_CCONV rc_libretro_memory_init(rc_libretro_memory_regions_t* regions, const struct retro_memory_map* mmap, 55 rc_libretro_get_core_memory_info_func get_core_memory_info, uint32_t console_id); 56 RC_EXPORT void RC_CCONV rc_libretro_memory_destroy(rc_libretro_memory_regions_t* regions); 57 58 RC_EXPORT uint8_t* RC_CCONV rc_libretro_memory_find(const rc_libretro_memory_regions_t* regions, uint32_t address); 59 RC_EXPORT uint8_t* RC_CCONV rc_libretro_memory_find_avail(const rc_libretro_memory_regions_t* regions, uint32_t address, uint32_t* avail); 60 RC_EXPORT uint32_t RC_CCONV rc_libretro_memory_read(const rc_libretro_memory_regions_t* regions, uint32_t address, uint8_t* buffer, uint32_t num_bytes); 61 62 /*****************************************************************************\ 63 | Disk Identification | 64 \*****************************************************************************/ 65 66 typedef struct rc_libretro_hash_entry_t 67 { 68 uint32_t path_djb2; 69 uint32_t game_id; 70 char hash[33]; 71 } rc_libretro_hash_entry_t; 72 73 typedef struct rc_libretro_hash_set_t 74 { 75 struct rc_libretro_hash_entry_t* entries; 76 uint16_t entries_count; 77 uint16_t entries_size; 78 } rc_libretro_hash_set_t; 79 80 typedef int (RC_CCONV *rc_libretro_get_image_path_func)(uint32_t index, char* buffer, size_t buffer_size); 81 82 RC_EXPORT void RC_CCONV rc_libretro_hash_set_init(struct rc_libretro_hash_set_t* hash_set, 83 const char* m3u_path, rc_libretro_get_image_path_func get_image_path); 84 RC_EXPORT void RC_CCONV rc_libretro_hash_set_destroy(struct rc_libretro_hash_set_t* hash_set); 85 86 RC_EXPORT void RC_CCONV rc_libretro_hash_set_add(struct rc_libretro_hash_set_t* hash_set, 87 const char* path, uint32_t game_id, const char hash[33]); 88 RC_EXPORT const char* RC_CCONV rc_libretro_hash_set_get_hash(const struct rc_libretro_hash_set_t* hash_set, const char* path); 89 RC_EXPORT int RC_CCONV rc_libretro_hash_set_get_game_id(const struct rc_libretro_hash_set_t* hash_set, const char* hash); 90 91 RC_END_C_DECLS 92 93 #endif /* RC_LIBRETRO_H */