encryption_layer.h 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "common/common_types.h"
  6. #include "core/file_sys/vfs.h"
  7. namespace Core::Crypto {
  8. // Basically non-functional class that implements all of the methods that are irrelevant to an
  9. // EncryptionLayer. Reduces duplicate code.
  10. class EncryptionLayer : public FileSys::VfsFile {
  11. public:
  12. explicit EncryptionLayer(FileSys::VirtualFile base);
  13. std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override = 0;
  14. std::string GetName() const override;
  15. std::size_t GetSize() const override;
  16. bool Resize(std::size_t new_size) override;
  17. std::shared_ptr<FileSys::VfsDirectory> GetContainingDirectory() const override;
  18. bool IsWritable() const override;
  19. bool IsReadable() const override;
  20. std::size_t Write(const u8* data, std::size_t length, std::size_t offset) override;
  21. bool Rename(std::string_view name) override;
  22. protected:
  23. FileSys::VirtualFile base;
  24. };
  25. } // namespace Core::Crypto