diff options
| author | 2014-12-20 03:21:23 -0200 | |
|---|---|---|
| committer | 2014-12-20 03:45:02 -0200 | |
| commit | 82528ba7df7bb8b2a6d89c416a66aee5c39f7f66 (patch) | |
| tree | 98e535bae4b71d89614a0e75b7d83b4de0fa1c5b /src/core/hle | |
| parent | Merge pull request #306 from Subv/even_more_savedata (diff) | |
| download | yuzu-82528ba7df7bb8b2a6d89c416a66aee5c39f7f66.tar.gz yuzu-82528ba7df7bb8b2a6d89c416a66aee5c39f7f66.tar.xz yuzu-82528ba7df7bb8b2a6d89c416a66aee5c39f7f66.zip | |
Common: Add a clone of std::make_unique
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/fs/archive.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 5ab82729c..510d7320c 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "common/file_util.h" | 9 | #include "common/file_util.h" |
| 10 | #include "common/make_unique.h" | ||
| 10 | #include "common/math_util.h" | 11 | #include "common/math_util.h" |
| 11 | 12 | ||
| 12 | #include "core/file_sys/archive_savedata.h" | 13 | #include "core/file_sys/archive_savedata.h" |
| @@ -260,7 +261,7 @@ ResultCode CloseArchive(ArchiveHandle handle) { | |||
| 260 | // TODO(yuriks): This might be what the fs:REG service is for. See the Register/Unregister calls in | 261 | // TODO(yuriks): This might be what the fs:REG service is for. See the Register/Unregister calls in |
| 261 | // http://3dbrew.org/wiki/Filesystem_services#ProgramRegistry_service_.22fs:REG.22 | 262 | // http://3dbrew.org/wiki/Filesystem_services#ProgramRegistry_service_.22fs:REG.22 |
| 262 | ResultCode CreateArchive(std::unique_ptr<FileSys::ArchiveBackend>&& backend, ArchiveIdCode id_code) { | 263 | ResultCode CreateArchive(std::unique_ptr<FileSys::ArchiveBackend>&& backend, ArchiveIdCode id_code) { |
| 263 | auto result = id_code_map.emplace(id_code, std::make_unique<Archive>(std::move(backend), id_code)); | 264 | auto result = id_code_map.emplace(id_code, Common::make_unique<Archive>(std::move(backend), id_code)); |
| 264 | 265 | ||
| 265 | bool inserted = result.second; | 266 | bool inserted = result.second; |
| 266 | _dbg_assert_msg_(Service_FS, inserted, "Tried to register more than one archive with same id code"); | 267 | _dbg_assert_msg_(Service_FS, inserted, "Tried to register more than one archive with same id code"); |
| @@ -281,7 +282,7 @@ ResultVal<Handle> OpenFileFromArchive(ArchiveHandle archive_handle, const FileSy | |||
| 281 | ErrorSummary::NotFound, ErrorLevel::Status); | 282 | ErrorSummary::NotFound, ErrorLevel::Status); |
| 282 | } | 283 | } |
| 283 | 284 | ||
| 284 | auto file = std::make_unique<File>(std::move(backend), path); | 285 | auto file = Common::make_unique<File>(std::move(backend), path); |
| 285 | Handle handle = Kernel::g_object_pool.Create(file.release()); | 286 | Handle handle = Kernel::g_object_pool.Create(file.release()); |
| 286 | return MakeResult<Handle>(handle); | 287 | return MakeResult<Handle>(handle); |
| 287 | } | 288 | } |
| @@ -378,7 +379,7 @@ ResultVal<Handle> OpenDirectoryFromArchive(ArchiveHandle archive_handle, const F | |||
| 378 | ErrorSummary::NotFound, ErrorLevel::Permanent); | 379 | ErrorSummary::NotFound, ErrorLevel::Permanent); |
| 379 | } | 380 | } |
| 380 | 381 | ||
| 381 | auto directory = std::make_unique<Directory>(std::move(backend), path); | 382 | auto directory = Common::make_unique<Directory>(std::move(backend), path); |
| 382 | Handle handle = Kernel::g_object_pool.Create(directory.release()); | 383 | Handle handle = Kernel::g_object_pool.Create(directory.release()); |
| 383 | return MakeResult<Handle>(handle); | 384 | return MakeResult<Handle>(handle); |
| 384 | } | 385 | } |
| @@ -392,7 +393,7 @@ ResultCode FormatSaveData() { | |||
| 392 | 393 | ||
| 393 | // Create the SaveData archive | 394 | // Create the SaveData archive |
| 394 | std::string savedata_directory = FileUtil::GetUserPath(D_SAVEDATA_IDX); | 395 | std::string savedata_directory = FileUtil::GetUserPath(D_SAVEDATA_IDX); |
| 395 | auto savedata_archive = std::make_unique<FileSys::Archive_SaveData>(savedata_directory, | 396 | auto savedata_archive = Common::make_unique<FileSys::Archive_SaveData>(savedata_directory, |
| 396 | Kernel::g_program_id); | 397 | Kernel::g_program_id); |
| 397 | 398 | ||
| 398 | if (savedata_archive->Initialize()) { | 399 | if (savedata_archive->Initialize()) { |
| @@ -414,14 +415,14 @@ void ArchiveInit() { | |||
| 414 | // archive type is SDMC, so it is the only one getting exposed. | 415 | // archive type is SDMC, so it is the only one getting exposed. |
| 415 | 416 | ||
| 416 | std::string sdmc_directory = FileUtil::GetUserPath(D_SDMC_IDX); | 417 | std::string sdmc_directory = FileUtil::GetUserPath(D_SDMC_IDX); |
| 417 | auto sdmc_archive = std::make_unique<FileSys::Archive_SDMC>(sdmc_directory); | 418 | auto sdmc_archive = Common::make_unique<FileSys::Archive_SDMC>(sdmc_directory); |
| 418 | if (sdmc_archive->Initialize()) | 419 | if (sdmc_archive->Initialize()) |
| 419 | CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SDMC); | 420 | CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SDMC); |
| 420 | else | 421 | else |
| 421 | LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); | 422 | LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); |
| 422 | 423 | ||
| 423 | std::string systemsavedata_directory = FileUtil::GetUserPath(D_SYSSAVEDATA_IDX); | 424 | std::string systemsavedata_directory = FileUtil::GetUserPath(D_SYSSAVEDATA_IDX); |
| 424 | auto systemsavedata_archive = std::make_unique<FileSys::Archive_SDMC>(systemsavedata_directory); | 425 | auto systemsavedata_archive = Common::make_unique<FileSys::Archive_SDMC>(systemsavedata_directory); |
| 425 | if (systemsavedata_archive->Initialize()) { | 426 | if (systemsavedata_archive->Initialize()) { |
| 426 | CreateArchive(std::move(systemsavedata_archive), ArchiveIdCode::SystemSaveData); | 427 | CreateArchive(std::move(systemsavedata_archive), ArchiveIdCode::SystemSaveData); |
| 427 | } else { | 428 | } else { |