content.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. #ifndef __RARCH_FILE_H
  18. #define __RARCH_FILE_H
  19. #include <stdio.h>
  20. #include <stdint.h>
  21. #include <stddef.h>
  22. #include <sys/types.h>
  23. #include <boolean.h>
  24. #include <retro_common_api.h>
  25. #include <retro_miscellaneous.h>
  26. #include "frontend/frontend_driver.h"
  27. RETRO_BEGIN_DECLS
  28. typedef struct content_ctx_info
  29. {
  30. char **argv; /* Argument variable list. */
  31. void *args; /* Arguments passed from callee */
  32. environment_get_t environ_get; /* Function passed for environment_get function */
  33. int argc; /* Argument count. */
  34. } content_ctx_info_t;
  35. /* Load a RAM state from disk to memory. */
  36. bool content_load_ram_file(unsigned slot);
  37. /* Save a RAM state from memory to disk. */
  38. bool content_save_ram_file(unsigned slot, bool compress);
  39. /* Load a state from memory. */
  40. bool content_load_state_from_ram(void);
  41. /* Save a state to memory. */
  42. bool content_save_state_to_ram(void);
  43. /* Save a ram state from memory to disk. */
  44. bool content_ram_state_to_file(const char *path);
  45. /* Load a state from disk to memory. */
  46. bool content_load_state(const char* path, bool load_to_backup_buffer, bool autoload);
  47. /* Save a state from memory to disk. */
  48. bool content_save_state(const char *path, bool save_to_disk, bool autosave);
  49. /* Check a ram state write to disk. */
  50. bool content_ram_state_pending(void);
  51. /* Gets the number of bytes required to serialize the state. */
  52. size_t content_get_serialized_size(void);
  53. /* Gets the number of bytes required to serialize the state for rewind. */
  54. size_t content_get_serialized_size_rewind(void);
  55. /* Serializes the current state for rewinding. buffer must be at least content_get_serialized_size bytes */
  56. bool content_serialize_state_rewind(void* buffer, size_t buffer_size);
  57. /* Deserializes the current state. */
  58. bool content_deserialize_state(const void* serialized_data, size_t serialized_size);
  59. /* Waits for any in-progress save state tasks to finish */
  60. void content_wait_for_save_state_task(void);
  61. /* Waits for any in-progress load state tasks to finish */
  62. void content_wait_for_load_state_task(void);
  63. /* Copy a save state. */
  64. bool content_rename_state(const char *origin, const char *dest);
  65. /* Undoes the last load state operation that was done */
  66. bool content_undo_load_state(void);
  67. /* Restores the last savestate file which was overwritten */
  68. bool content_undo_save_state(void);
  69. uint8_t content_get_flags(void);
  70. void content_set_does_not_need_content(void);
  71. void content_unset_does_not_need_content(void);
  72. uint32_t content_get_crc(void);
  73. void content_deinit(void);
  74. /* Initializes and loads a content file for the currently
  75. * selected libretro core. */
  76. bool content_init(void);
  77. /* Resets the state and savefile backup buffers */
  78. void content_reset_savestate_backups(void);
  79. /* Checks if the buffers are empty */
  80. bool content_undo_load_buf_is_empty(void);
  81. bool content_undo_save_buf_is_empty(void);
  82. /* Clears the pending subsystem rom buffer */
  83. bool content_is_subsystem_pending_load(void);
  84. /* Clears the pending subsystem rom buffer */
  85. void content_clear_subsystem(void);
  86. /* Set the current subsystem*/
  87. void content_set_subsystem(unsigned subsystem);
  88. /* Get the current subsystem*/
  89. int content_get_subsystem(void);
  90. /* Add a rom to the subsystem rom buffer */
  91. void content_add_subsystem(const char* path);
  92. /* Get the current subsystem rom id */
  93. unsigned content_get_subsystem_rom_id(void);
  94. /* Set environment variables before a subsystem load */
  95. void content_set_subsystem_info(void);
  96. /* Get the path to the last selected subsystem rom */
  97. char* content_get_subsystem_rom(unsigned index);
  98. /* Sets the subsystem by name */
  99. bool content_set_subsystem_by_name(const char* subsystem_name);
  100. /* Get the current subsystem "friendly name" */
  101. void content_get_subsystem_friendly_name(const char* subsystem_name, char* subsystem_friendly_name, size_t len);
  102. /* Sets overrides which modify frontend handling of
  103. * specific content file types */
  104. bool content_file_override_set(const struct retro_system_content_info_override *overrides);
  105. RETRO_END_DECLS
  106. #endif