summaryrefslogtreecommitdiff
path: root/src/core/hle
diff options
context:
space:
mode:
authorGravatar Subv2014-12-31 19:36:50 -0500
committerGravatar Subv2015-01-02 21:13:53 -0500
commit13efbdc2014177b84cae82e522b191e2f2f022df (patch)
tree836870810adfc1e5a5ae574c59cb446ce7ae1880 /src/core/hle
parentMerge pull request #391 from lioncash/pedantic (diff)
downloadyuzu-13efbdc2014177b84cae82e522b191e2f2f022df.tar.gz
yuzu-13efbdc2014177b84cae82e522b191e2f2f022df.tar.xz
yuzu-13efbdc2014177b84cae82e522b191e2f2f022df.zip
SaveDataCheck: Preliminary work in this archive.
This allows Steel Diver to boot further, some files are needed. This is still not ready and needs a big cleanup, this will possibly be delayed until the way we handle archives is fixed (with factory classes instead of ahead-of-time creation of archives)
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/fs/archive.cpp37
-rw-r--r--src/core/hle/service/fs/archive.h1
2 files changed, 35 insertions, 3 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 9a91bcb8b..a8383d4e5 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -10,9 +10,10 @@
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"
16#include "core/file_sys/archive_sdmc.h" 17#include "core/file_sys/archive_sdmc.h"
17#include "core/file_sys/directory_backend.h" 18#include "core/file_sys/directory_backend.h"
18#include "core/hle/service/fs/archive.h" 19#include "core/hle/service/fs/archive.h"
@@ -50,6 +51,9 @@ enum class FileCommand : u32 {
50 SetAttributes = 0x08070040, 51 SetAttributes = 0x08070040,
51 Close = 0x08080000, 52 Close = 0x08080000,
52 Flush = 0x08090000, 53 Flush = 0x08090000,
54 SetPriority = 0x080A0040,
55 GetPriority = 0x080B0000,
56 OpenLinkFile = 0x080C0000,
53}; 57};
54 58
55// Command to access directory 59// Command to access directory
@@ -75,12 +79,13 @@ public:
75class File : public Kernel::Session { 79class File : public Kernel::Session {
76public: 80public:
77 File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path& path) 81 File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path& path)
78 : path(path), backend(std::move(backend)) { 82 : path(path), backend(std::move(backend)), priority(0) {
79 } 83 }
80 84
81 std::string GetName() const override { return "Path: " + path.DebugStr(); } 85 std::string GetName() const override { return "Path: " + path.DebugStr(); }
82 86
83 FileSys::Path path; ///< Path of the file 87 FileSys::Path path; ///< Path of the file
88 u32 priority; ///< Priority of the file. TODO(Subv): Find out what this means
84 std::unique_ptr<FileSys::FileBackend> backend; ///< File backend interface 89 std::unique_ptr<FileSys::FileBackend> backend; ///< File backend interface
85 90
86 ResultVal<bool> SyncRequest() override { 91 ResultVal<bool> SyncRequest() override {
@@ -145,6 +150,27 @@ public:
145 break; 150 break;
146 } 151 }
147 152
153 case FileCommand::OpenLinkFile:
154 {
155 LOG_WARNING(Service_FS, "(STUBBED) File command OpenLinkFile %s", GetName().c_str());
156 cmd_buff[3] = GetHandle();
157 break;
158 }
159
160 case FileCommand::SetPriority:
161 {
162 priority = cmd_buff[1];
163 LOG_TRACE(Service_FS, "SetPriority %u", priority);
164 break;
165 }
166
167 case FileCommand::GetPriority:
168 {
169 cmd_buff[2] = priority;
170 LOG_TRACE(Service_FS, "GetPriority");
171 break;
172 }
173
148 // Unknown command... 174 // Unknown command...
149 default: 175 default:
150 LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd); 176 LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
@@ -435,6 +461,11 @@ void ArchiveInit() {
435 else 461 else
436 LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s", 462 LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s",
437 sharedextsavedata_directory.c_str()); 463 sharedextsavedata_directory.c_str());
464
465 // Create the SaveDataCheck archive, basically a small variation of the RomFS archive
466 std::string savedatacheck_directory = FileUtil::GetUserPath(D_SAVEDATA_IDX) + "../savedatacheck/";
467 auto savedatacheck_archive = Common::make_unique<FileSys::Archive_RomFS>(savedatacheck_directory);
468 CreateArchive(std::move(savedatacheck_archive), ArchiveIdCode::SaveDataCheck);
438} 469}
439 470
440/// Shutdown archives 471/// Shutdown archives
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index c23b8cc46..f2e4e4a53 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;