disk_index_file.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Copyright (C) 2010-2020 The RetroArch team
  2. *
  3. * ---------------------------------------------------------------------------------------
  4. * The following license statement only applies to this file (disk_index_file.h).
  5. * ---------------------------------------------------------------------------------------
  6. *
  7. * Permission is hereby granted, free of charge,
  8. * to any person obtaining a copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation the rights to
  10. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
  11. * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  16. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  18. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  19. * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. */
  22. #ifndef __DISK_INDEX_FILE_H
  23. #define __DISK_INDEX_FILE_H
  24. #include <retro_common_api.h>
  25. #include <libretro.h>
  26. #include <retro_miscellaneous.h>
  27. #include <boolean.h>
  28. RETRO_BEGIN_DECLS
  29. /* Holds all parameters required for recording
  30. * the last disk image selected via the disk
  31. * control interface */
  32. typedef struct
  33. {
  34. unsigned image_index;
  35. char image_path[PATH_MAX_LENGTH];
  36. char file_path[PATH_MAX_LENGTH];
  37. bool modified;
  38. } disk_index_file_t;
  39. /******************/
  40. /* Initialisation */
  41. /******************/
  42. /* Initialises existing disk index record, loading
  43. * current parameters if a record file exists.
  44. * Returns false if arguments are invalid. */
  45. bool disk_index_file_init(
  46. disk_index_file_t *disk_index_file,
  47. const char *content_path,
  48. const char *dir_savefile);
  49. /***********/
  50. /* Setters */
  51. /***********/
  52. /* Sets image index and path */
  53. void disk_index_file_set(
  54. disk_index_file_t *disk_index_file,
  55. unsigned image_index,
  56. const char *image_path);
  57. /**********/
  58. /* Saving */
  59. /**********/
  60. /* Saves specified disk index file to disk */
  61. bool disk_index_file_save(disk_index_file_t *disk_index_file);
  62. RETRO_END_DECLS
  63. #endif