diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2014-09-14 13:52:52 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2014-09-17 16:35:46 +0200 |
commit | 3a570a9fee57d77923eb1e71dbadcd08bb39aa25 (patch) | |
tree | 258010943e989fc61a2a439ff15ead7ed3d11a6f /src/core/hle/kernel | |
parent | FS: Implement OpenArchive, OpenDirectory, OpenFile and OpenFileDirectly calls. (diff) | |
download | yuzu-3a570a9fee57d77923eb1e71dbadcd08bb39aa25.tar yuzu-3a570a9fee57d77923eb1e71dbadcd08bb39aa25.tar.gz yuzu-3a570a9fee57d77923eb1e71dbadcd08bb39aa25.tar.bz2 yuzu-3a570a9fee57d77923eb1e71dbadcd08bb39aa25.tar.lz yuzu-3a570a9fee57d77923eb1e71dbadcd08bb39aa25.tar.xz yuzu-3a570a9fee57d77923eb1e71dbadcd08bb39aa25.tar.zst yuzu-3a570a9fee57d77923eb1e71dbadcd08bb39aa25.zip |
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/archive.cpp | 36 | ||||
-rw-r--r-- | src/core/hle/kernel/archive.h | 7 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp index 6161f4d00..a7fa661d6 100644 --- a/src/core/hle/kernel/archive.cpp +++ b/src/core/hle/kernel/archive.cpp @@ -96,6 +96,13 @@ public: backend->SetSize(cmd_buff[1] | ((u64)cmd_buff[2] << 32)); break; } + case FileCommand::Close: + { + DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); + Kernel::g_object_pool.Destroy<Archive>(GetHandle()); + CloseArchive(backend->GetIdCode()); + break; + } // Unknown command... default: { @@ -174,6 +181,13 @@ public: break; } + case FileCommand::Close: + { + DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); + Kernel::g_object_pool.Destroy<File>(GetHandle()); + break; + } + // Unknown command... default: ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); @@ -230,6 +244,13 @@ public: break; } + case DirectoryCommand::Close: + { + DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); + Kernel::g_object_pool.Destroy<Directory>(GetHandle()); + break; + } + // Unknown command... default: ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); @@ -270,6 +291,21 @@ Handle OpenArchive(FileSys::Archive::IdCode id_code) { } /** + * Closes an archive + * @param id_code IdCode of the archive to open + * @return Result of operation, 0 on success, otherwise error code + */ +Result CloseArchive(FileSys::Archive::IdCode id_code) { + if (1 != g_archive_map.erase(id_code)) { + ERROR_LOG(KERNEL, "Cannot close archive %d", (int) id_code); + return -1; + } + + INFO_LOG(KERNEL, "Closed archive %d", (int) id_code); + return 0; +} + +/** * Mounts an archive * @param archive Pointer to the archive to mount * @return Result of operation, 0 on success, otherwise error code diff --git a/src/core/hle/kernel/archive.h b/src/core/hle/kernel/archive.h index f647aa213..593861f8e 100644 --- a/src/core/hle/kernel/archive.h +++ b/src/core/hle/kernel/archive.h @@ -22,6 +22,13 @@ namespace Kernel { Handle OpenArchive(FileSys::Archive::IdCode id_code); /** + * Closes an archive + * @param id_code IdCode of the archive to open + * @return true if it worked fine + */ +Result CloseArchive(FileSys::Archive::IdCode id_code); + +/** * Creates an Archive * @param backend File system backend interface to the archive * @param name Optional name of Archive |