summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/archive.cpp36
-rw-r--r--src/core/hle/kernel/archive.h7
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:
96 backend->SetSize(cmd_buff[1] | ((u64)cmd_buff[2] << 32)); 96 backend->SetSize(cmd_buff[1] | ((u64)cmd_buff[2] << 32));
97 break; 97 break;
98 } 98 }
99 case FileCommand::Close:
100 {
101 DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
102 Kernel::g_object_pool.Destroy<Archive>(GetHandle());
103 CloseArchive(backend->GetIdCode());
104 break;
105 }
99 // Unknown command... 106 // Unknown command...
100 default: 107 default:
101 { 108 {
@@ -174,6 +181,13 @@ public:
174 break; 181 break;
175 } 182 }
176 183
184 case FileCommand::Close:
185 {
186 DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
187 Kernel::g_object_pool.Destroy<File>(GetHandle());
188 break;
189 }
190
177 // Unknown command... 191 // Unknown command...
178 default: 192 default:
179 ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); 193 ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd);
@@ -230,6 +244,13 @@ public:
230 break; 244 break;
231 } 245 }
232 246
247 case DirectoryCommand::Close:
248 {
249 DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
250 Kernel::g_object_pool.Destroy<Directory>(GetHandle());
251 break;
252 }
253
233 // Unknown command... 254 // Unknown command...
234 default: 255 default:
235 ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); 256 ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd);
@@ -270,6 +291,21 @@ Handle OpenArchive(FileSys::Archive::IdCode id_code) {
270} 291}
271 292
272/** 293/**
294 * Closes an archive
295 * @param id_code IdCode of the archive to open
296 * @return Result of operation, 0 on success, otherwise error code
297 */
298Result CloseArchive(FileSys::Archive::IdCode id_code) {
299 if (1 != g_archive_map.erase(id_code)) {
300 ERROR_LOG(KERNEL, "Cannot close archive %d", (int) id_code);
301 return -1;
302 }
303
304 INFO_LOG(KERNEL, "Closed archive %d", (int) id_code);
305 return 0;
306}
307
308/**
273 * Mounts an archive 309 * Mounts an archive
274 * @param archive Pointer to the archive to mount 310 * @param archive Pointer to the archive to mount
275 * @return Result of operation, 0 on success, otherwise error code 311 * @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 {
22Handle OpenArchive(FileSys::Archive::IdCode id_code); 22Handle OpenArchive(FileSys::Archive::IdCode id_code);
23 23
24/** 24/**
25 * Closes an archive
26 * @param id_code IdCode of the archive to open
27 * @return true if it worked fine
28 */
29Result CloseArchive(FileSys::Archive::IdCode id_code);
30
31/**
25 * Creates an Archive 32 * Creates an Archive
26 * @param backend File system backend interface to the archive 33 * @param backend File system backend interface to the archive
27 * @param name Optional name of Archive 34 * @param name Optional name of Archive