summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/bcat/backend/backend.h
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2019-04-29 00:46:46 +0200
committerZach Hilman <zachhilman@gmail.com>2019-09-30 23:21:53 +0200
commit2c0b75a7448ab3878d159548858b397e1bcc305b (patch)
tree75dcee9d42250068541f9a448a1a255a7c7e025a /src/core/hle/service/bcat/backend/backend.h
parentsettings: Add option to set BCAT backend (diff)
downloadyuzu-2c0b75a7448ab3878d159548858b397e1bcc305b.tar
yuzu-2c0b75a7448ab3878d159548858b397e1bcc305b.tar.gz
yuzu-2c0b75a7448ab3878d159548858b397e1bcc305b.tar.bz2
yuzu-2c0b75a7448ab3878d159548858b397e1bcc305b.tar.lz
yuzu-2c0b75a7448ab3878d159548858b397e1bcc305b.tar.xz
yuzu-2c0b75a7448ab3878d159548858b397e1bcc305b.tar.zst
yuzu-2c0b75a7448ab3878d159548858b397e1bcc305b.zip
Diffstat (limited to 'src/core/hle/service/bcat/backend/backend.h')
-rw-r--r--src/core/hle/service/bcat/backend/backend.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/core/hle/service/bcat/backend/backend.h b/src/core/hle/service/bcat/backend/backend.h
new file mode 100644
index 000000000..2e9511f3f
--- /dev/null
+++ b/src/core/hle/service/bcat/backend/backend.h
@@ -0,0 +1,53 @@
+// Copyright 2019 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <functional>
+#include "common/common_types.h"
+#include "core/file_sys/vfs_types.h"
+
+namespace Service::BCAT {
+
+using CompletionCallback = std::function<void(bool)>;
+using DirectoryGetter = std::function<FileSys::VirtualDir(u64)>;
+using Passphrase = std::array<u8, 0x20>;
+
+struct TitleIDVersion {
+ u64 title_id;
+ u64 build_id;
+};
+
+class Backend {
+public:
+ explicit Backend(DirectoryGetter getter);
+ virtual ~Backend();
+
+ virtual bool Synchronize(TitleIDVersion title, CompletionCallback callback) = 0;
+ virtual bool SynchronizeDirectory(TitleIDVersion title, std::string name,
+ CompletionCallback callback) = 0;
+
+ virtual bool Clear(u64 title_id) = 0;
+
+ virtual void SetPassphrase(u64 title_id, const Passphrase& passphrase) = 0;
+
+protected:
+ DirectoryGetter dir_getter;
+};
+
+class NullBackend : public Backend {
+public:
+ explicit NullBackend(const DirectoryGetter& getter);
+ ~NullBackend() override;
+
+ bool Synchronize(TitleIDVersion title, CompletionCallback callback) override;
+ bool SynchronizeDirectory(TitleIDVersion title, std::string name,
+ CompletionCallback callback) override;
+
+ bool Clear(u64 title_id) override;
+
+ void SetPassphrase(u64 title_id, const Passphrase& passphrase) override;
+};
+
+} // namespace Service::BCAT