2014-06-25 23:15:35 +01:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
2014-06-27 21:18:56 +01:00
|
|
|
#include "core/file_sys/archive.h"
|
2014-10-23 04:20:01 +01:00
|
|
|
#include "core/hle/kernel/kernel.h"
|
|
|
|
#include "core/hle/result.h"
|
2014-06-25 23:15:35 +01:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Kernel namespace
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
|
|
|
/**
|
2014-06-27 21:18:56 +01:00
|
|
|
* Opens an archive
|
|
|
|
* @param id_code IdCode of the archive to open
|
2014-10-23 04:20:01 +01:00
|
|
|
* @return Handle to the opened archive
|
2014-06-25 23:15:35 +01:00
|
|
|
*/
|
2014-10-23 04:20:01 +01:00
|
|
|
ResultVal<Handle> OpenArchive(FileSys::Archive::IdCode id_code);
|
2014-06-27 21:18:56 +01:00
|
|
|
|
2014-09-14 12:52:52 +01:00
|
|
|
/**
|
|
|
|
* Closes an archive
|
|
|
|
* @param id_code IdCode of the archive to open
|
|
|
|
*/
|
2014-10-23 04:20:01 +01:00
|
|
|
ResultCode CloseArchive(FileSys::Archive::IdCode id_code);
|
2014-09-14 12:52:52 +01:00
|
|
|
|
2014-06-27 21:18:56 +01:00
|
|
|
/**
|
|
|
|
* Creates an Archive
|
|
|
|
* @param backend File system backend interface to the archive
|
2014-10-23 04:20:01 +01:00
|
|
|
* @param name Name of Archive
|
2014-06-27 21:18:56 +01:00
|
|
|
*/
|
2014-10-23 04:20:01 +01:00
|
|
|
ResultCode CreateArchive(FileSys::Archive* backend, const std::string& name);
|
2014-06-25 23:15:35 +01:00
|
|
|
|
2014-09-11 23:45:40 +01:00
|
|
|
/**
|
|
|
|
* Open a File from an Archive
|
|
|
|
* @param archive_handle Handle to an open Archive object
|
|
|
|
* @param path Path to the File inside of the Archive
|
|
|
|
* @param mode Mode under which to open the File
|
2014-10-23 04:20:01 +01:00
|
|
|
* @return Handle to the opened File object
|
2014-09-11 23:45:40 +01:00
|
|
|
*/
|
2014-10-23 04:20:01 +01:00
|
|
|
ResultVal<Handle> OpenFileFromArchive(Handle archive_handle, const FileSys::Path& path, const FileSys::Mode mode);
|
2014-10-29 05:52:56 +00:00
|
|
|
|
2014-11-11 18:37:26 +00:00
|
|
|
/**
|
|
|
|
* Delete a File from an Archive
|
|
|
|
* @param archive_handle Handle to an open Archive object
|
|
|
|
* @param path Path to the File inside of the Archive
|
|
|
|
* @return Whether deletion succeeded
|
|
|
|
*/
|
|
|
|
Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete a Directory from an Archive
|
|
|
|
* @param archive_handle Handle to an open Archive object
|
|
|
|
* @param path Path to the Directory inside of the Archive
|
|
|
|
* @return Whether deletion succeeded
|
|
|
|
*/
|
|
|
|
Result DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
|
|
|
|
|
2014-10-29 05:52:56 +00:00
|
|
|
/**
|
|
|
|
* Create a Directory from an Archive
|
|
|
|
* @param archive_handle Handle to an open Archive object
|
|
|
|
* @param path Path to the Directory inside of the Archive
|
|
|
|
* @return Whether creation of directory succeeded
|
|
|
|
*/
|
2014-11-12 00:27:35 +00:00
|
|
|
Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
|
2014-09-11 23:45:40 +01:00
|
|
|
|
2014-09-11 23:48:04 +01:00
|
|
|
/**
|
|
|
|
* Open a Directory from an Archive
|
|
|
|
* @param archive_handle Handle to an open Archive object
|
|
|
|
* @param path Path to the Directory inside of the Archive
|
2014-10-23 04:20:01 +01:00
|
|
|
* @return Handle to the opened File object
|
2014-09-11 23:48:04 +01:00
|
|
|
*/
|
2014-10-23 04:20:01 +01:00
|
|
|
ResultVal<Handle> OpenDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
|
2014-09-11 23:48:04 +01:00
|
|
|
|
2014-07-04 18:38:12 +01:00
|
|
|
/// Initialize archives
|
|
|
|
void ArchiveInit();
|
|
|
|
|
|
|
|
/// Shutdown archives
|
|
|
|
void ArchiveShutdown();
|
|
|
|
|
2014-06-25 23:15:35 +01:00
|
|
|
} // namespace FileSys
|