archive.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "common/common_types.h"
  6. #include "core/file_sys/archive.h"
  7. #include "core/hle/kernel/kernel.h"
  8. #include "core/hle/result.h"
  9. ////////////////////////////////////////////////////////////////////////////////////////////////////
  10. // Kernel namespace
  11. namespace Kernel {
  12. /**
  13. * Opens an archive
  14. * @param id_code IdCode of the archive to open
  15. * @return Handle to the opened archive
  16. */
  17. ResultVal<Handle> OpenArchive(FileSys::Archive::IdCode id_code);
  18. /**
  19. * Closes an archive
  20. * @param id_code IdCode of the archive to open
  21. */
  22. ResultCode CloseArchive(FileSys::Archive::IdCode id_code);
  23. /**
  24. * Creates an Archive
  25. * @param backend File system backend interface to the archive
  26. * @param name Name of Archive
  27. */
  28. ResultCode CreateArchive(FileSys::Archive* backend, const std::string& name);
  29. /**
  30. * Open a File from an Archive
  31. * @param archive_handle Handle to an open Archive object
  32. * @param path Path to the File inside of the Archive
  33. * @param mode Mode under which to open the File
  34. * @return Handle to the opened File object
  35. */
  36. ResultVal<Handle> OpenFileFromArchive(Handle archive_handle, const FileSys::Path& path, const FileSys::Mode mode);
  37. /**
  38. * Delete a File from an Archive
  39. * @param archive_handle Handle to an open Archive object
  40. * @param path Path to the File inside of the Archive
  41. * @return Whether deletion succeeded
  42. */
  43. Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path);
  44. /**
  45. * Rename a File between two Archives
  46. * @param src_archive_handle Handle to the source Archive object
  47. * @param src_path Path to the File inside of the source Archive
  48. * @param dest_archive_handle Handle to the destination Archive object
  49. * @param dest_path Path to the File inside of the destination Archive
  50. * @return Whether rename succeeded
  51. */
  52. Result RenameFileBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path,
  53. Handle dest_archive_handle, const FileSys::Path& dest_path);
  54. /**
  55. * Delete a Directory from an Archive
  56. * @param archive_handle Handle to an open Archive object
  57. * @param path Path to the Directory inside of the Archive
  58. * @return Whether deletion succeeded
  59. */
  60. Result DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
  61. /**
  62. * Create a Directory from an Archive
  63. * @param archive_handle Handle to an open Archive object
  64. * @param path Path to the Directory inside of the Archive
  65. * @return Whether creation of directory succeeded
  66. */
  67. Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
  68. /**
  69. * Open a Directory from an Archive
  70. * @param archive_handle Handle to an open Archive object
  71. * @param path Path to the Directory inside of the Archive
  72. * @return Handle to the opened File object
  73. */
  74. ResultVal<Handle> OpenDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
  75. /// Initialize archives
  76. void ArchiveInit();
  77. /// Shutdown archives
  78. void ArchiveShutdown();
  79. } // namespace FileSys