summaryrefslogtreecommitdiff
path: root/src/core/hle
diff options
context:
space:
mode:
authorGravatar bunnei2015-01-02 21:50:57 -0500
committerGravatar bunnei2015-01-02 21:50:57 -0500
commit031237e52cb1a32eb2a3ba37115170913e33e5dc (patch)
tree1d46509e07d20e2be2c25157b89b1061a7f75ba7 /src/core/hle
parentMerge pull request #392 from lioncash/sm (diff)
parentIVFCArchive: Use a critical log to notify of invalid operations. (diff)
downloadyuzu-031237e52cb1a32eb2a3ba37115170913e33e5dc.tar.gz
yuzu-031237e52cb1a32eb2a3ba37115170913e33e5dc.tar.xz
yuzu-031237e52cb1a32eb2a3ba37115170913e33e5dc.zip
Merge pull request #381 from Subv/savedatacheck
Implemented the SaveDataCheck archive
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/fs/archive.cpp40
-rw-r--r--src/core/hle/service/fs/archive.h3
2 files changed, 38 insertions, 5 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 9a91bcb8b..f761c6ab9 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -10,9 +10,11 @@
10#include "common/make_unique.h" 10#include "common/make_unique.h"
11#include "common/math_util.h" 11#include "common/math_util.h"
12 12
13#include "core/file_sys/archive_savedata.h"
14#include "core/file_sys/archive_extsavedata.h"
15#include "core/file_sys/archive_backend.h" 13#include "core/file_sys/archive_backend.h"
14#include "core/file_sys/archive_extsavedata.h"
15#include "core/file_sys/archive_romfs.h"
16#include "core/file_sys/archive_savedata.h"
17#include "core/file_sys/archive_savedatacheck.h"
16#include "core/file_sys/archive_sdmc.h" 18#include "core/file_sys/archive_sdmc.h"
17#include "core/file_sys/directory_backend.h" 19#include "core/file_sys/directory_backend.h"
18#include "core/hle/service/fs/archive.h" 20#include "core/hle/service/fs/archive.h"
@@ -50,6 +52,9 @@ enum class FileCommand : u32 {
50 SetAttributes = 0x08070040, 52 SetAttributes = 0x08070040,
51 Close = 0x08080000, 53 Close = 0x08080000,
52 Flush = 0x08090000, 54 Flush = 0x08090000,
55 SetPriority = 0x080A0040,
56 GetPriority = 0x080B0000,
57 OpenLinkFile = 0x080C0000,
53}; 58};
54 59
55// Command to access directory 60// Command to access directory
@@ -75,12 +80,13 @@ public:
75class File : public Kernel::Session { 80class File : public Kernel::Session {
76public: 81public:
77 File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path& path) 82 File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path& path)
78 : path(path), backend(std::move(backend)) { 83 : path(path), backend(std::move(backend)), priority(0) {
79 } 84 }
80 85
81 std::string GetName() const override { return "Path: " + path.DebugStr(); } 86 std::string GetName() const override { return "Path: " + path.DebugStr(); }
82 87
83 FileSys::Path path; ///< Path of the file 88 FileSys::Path path; ///< Path of the file
89 u32 priority; ///< Priority of the file. TODO(Subv): Find out what this means
84 std::unique_ptr<FileSys::FileBackend> backend; ///< File backend interface 90 std::unique_ptr<FileSys::FileBackend> backend; ///< File backend interface
85 91
86 ResultVal<bool> SyncRequest() override { 92 ResultVal<bool> SyncRequest() override {
@@ -145,6 +151,27 @@ public:
145 break; 151 break;
146 } 152 }
147 153
154 case FileCommand::OpenLinkFile:
155 {
156 LOG_WARNING(Service_FS, "(STUBBED) File command OpenLinkFile %s", GetName().c_str());
157 cmd_buff[3] = GetHandle();
158 break;
159 }
160
161 case FileCommand::SetPriority:
162 {
163 priority = cmd_buff[1];
164 LOG_TRACE(Service_FS, "SetPriority %u", priority);
165 break;
166 }
167
168 case FileCommand::GetPriority:
169 {
170 cmd_buff[2] = priority;
171 LOG_TRACE(Service_FS, "GetPriority");
172 break;
173 }
174
148 // Unknown command... 175 // Unknown command...
149 default: 176 default:
150 LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd); 177 LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
@@ -327,7 +354,7 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy
327 ErrorSummary::Canceled, ErrorLevel::Status); 354 ErrorSummary::Canceled, ErrorLevel::Status);
328} 355}
329 356
330ResultCode CreateFileInArchive(Handle archive_handle, const FileSys::Path& path, u32 file_size) { 357ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, u32 file_size) {
331 Archive* archive = GetArchive(archive_handle); 358 Archive* archive = GetArchive(archive_handle);
332 if (archive == nullptr) 359 if (archive == nullptr)
333 return InvalidHandle(ErrorModule::FS); 360 return InvalidHandle(ErrorModule::FS);
@@ -435,6 +462,11 @@ void ArchiveInit() {
435 else 462 else
436 LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s", 463 LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s",
437 sharedextsavedata_directory.c_str()); 464 sharedextsavedata_directory.c_str());
465
466 // Create the SaveDataCheck archive, basically a small variation of the RomFS archive
467 std::string savedatacheck_directory = FileUtil::GetUserPath(D_SAVEDATACHECK_IDX);
468 auto savedatacheck_archive = Common::make_unique<FileSys::Archive_SaveDataCheck>(savedatacheck_directory);
469 CreateArchive(std::move(savedatacheck_archive), ArchiveIdCode::SaveDataCheck);
438} 470}
439 471
440/// Shutdown archives 472/// Shutdown archives
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index c23b8cc46..9e9efa019 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -22,6 +22,7 @@ enum class ArchiveIdCode : u32 {
22 SystemSaveData = 0x00000008, 22 SystemSaveData = 0x00000008,
23 SDMC = 0x00000009, 23 SDMC = 0x00000009,
24 SDMCWriteOnly = 0x0000000A, 24 SDMCWriteOnly = 0x0000000A,
25 SaveDataCheck = 0x2345678A,
25}; 26};
26 27
27typedef u64 ArchiveHandle; 28typedef u64 ArchiveHandle;
@@ -90,7 +91,7 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy
90 * @param file_size The size of the new file, filled with zeroes 91 * @param file_size The size of the new file, filled with zeroes
91 * @return File creation result code 92 * @return File creation result code
92 */ 93 */
93ResultCode CreateFileInArchive(Handle archive_handle, const FileSys::Path& path, u32 file_size); 94ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, u32 file_size);
94 95
95/** 96/**
96 * Create a Directory from an Archive 97 * Create a Directory from an Archive