LeviLamina
Loading...
Searching...
No Matches
EncryptedFileAccessStrategy.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/NonOwnerPointer.h"
7#include "mc/platform/Result.h"
8#include "mc/resources/AssetEncryptionMode.h"
9#include "mc/resources/DirectoryPackAccessStrategy.h"
10#include "mc/resources/PackAccessAssetGenerationResult.h"
11#include "mc/resources/PackAccessStrategyType.h"
12
13// auto generated forward declare list
14// clang-format off
15class ContentIdentity;
17class IPackIOProvider;
22namespace Bedrock::Resources::Archive { class Reader; }
23namespace Core { class Path; }
24namespace Core { class PathView; }
25// clang-format on
26
27class EncryptedFileAccessStrategy : public ::DirectoryPackAccessStrategy {
28public:
29 // member variables
30 // NOLINTBEGIN
34 // NOLINTEND
35
36public:
37 // prevent constructor by default
38 EncryptedFileAccessStrategy& operator=(EncryptedFileAccessStrategy const&);
39 EncryptedFileAccessStrategy(EncryptedFileAccessStrategy const&);
40 EncryptedFileAccessStrategy();
41
42public:
43 // virtual functions
44 // NOLINTBEGIN
45 virtual ::PackAccessAssetGenerationResult generateAssetSet() /*override*/;
46
47 virtual bool isTrusted() const /*override*/;
48
49 virtual bool isWritable() const /*override*/;
50
51 virtual bool hasAsset(::Core::Path const& packRelativePath, bool trustedContentOnly, bool caseSensative) const
52 /*override*/;
53
54 virtual bool getAsset(::Core::Path const& packRelativePath, ::std::string& result, bool trustedContentOnly) const
55 /*override*/;
56
57 virtual ::std::unique_ptr<::PackAccessStrategy> createSubPack(::Core::Path const& subPath) const /*override*/;
58
59 virtual bool isAssetExtractionViable() const /*override*/;
60
61 virtual ::Bedrock::Result<::StreamableAssetSource>
62 getStreamableSource(::Core::Path const& packRelativePath, ::std::optional<::Core::PathView> tempDirectory) const
63 /*override*/;
64
65 virtual ::PackAccessStrategyType getStrategyType() const /*override*/;
66
67 virtual ::ContentIdentity readContentIdentity() const /*override*/;
68
69 virtual ::std::string _getContentsFile();
70
71 virtual ::std::string _getRawContentsFile() const;
72
73 virtual ::std::string _getEncryptedAssetStream(::Core::Path const& packRelativePath) const;
74
75 virtual ::std::unique_ptr<::Bedrock::Resources::Archive::Reader>
76 _loadArchive(::Core::Path const& packRelativePath) const /*override*/;
77 // NOLINTEND
78
79public:
80 // member functions
81 // NOLINTBEGIN
83 ::ResourceLocation const& resourceLocation,
84 ::ContentIdentity const& contentIdentity,
85 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> const& keyProvider,
86 bool canRecurse,
87 ::IPackIOProvider const& io,
88 ::std::optional<::std::unordered_map<::Core::Path, ::EncryptedAssetInfo>> assetSet
89 );
90
91 MCNAPI ::std::string _decryptContentsFile(::std::string contents);
92
93 MCNAPI ::std::unique_ptr<::Bedrock::Resources::Archive::Reader>
94 _loadArchive(::Core::PathView packRelativeArchiveFile, ::std::string const& key) const;
95 // NOLINTEND
96
97public:
98 // static functions
99 // NOLINTBEGIN
100 MCNAPI static bool
101 _getContentIdentityFromEncryptedStream(::std::string& stream, ::ContentIdentity& contentIdentity);
102
103 MCNAPI static bool _transformStream(
104 ::gsl::span<char const> input,
105 ::gsl::span<char> output,
106 ::std::string const& key,
107 uint64& bytesWritten,
108 ::AssetEncryptionMode mode
109 );
110
111 MCNAPI static bool _transformStream(
112 ::std::string& stream,
113 ::std::string const& key,
114 ::ContentIdentity const& contentIdentity,
115 ::AssetEncryptionMode mode,
116 uint64 offset
117 );
118
119#ifdef LL_PLAT_C
120 MCNAPI static bool contentFileExists(::Core::Path const& pathToPack);
121#endif
122
123 MCNAPI static bool isValidEncryptedPack(::Core::Path const& pathToPack, ::ContentIdentity& contentIdentity);
124 // NOLINTEND
125
126public:
127 // constructor thunks
128 // NOLINTBEGIN
129 MCNAPI void* $ctor(
130 ::ResourceLocation const& resourceLocation,
131 ::ContentIdentity const& contentIdentity,
132 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> const& keyProvider,
133 bool canRecurse,
134 ::IPackIOProvider const& io,
135 ::std::optional<::std::unordered_map<::Core::Path, ::EncryptedAssetInfo>> assetSet
136 );
137 // NOLINTEND
138
139public:
140 // virtual function thunks
141 // NOLINTBEGIN
142 MCNAPI ::PackAccessAssetGenerationResult $generateAssetSet();
143
144 MCNAPI bool $isTrusted() const;
145
146 MCNAPI bool $isWritable() const;
147
148 MCNAPI bool $hasAsset(::Core::Path const& packRelativePath, bool trustedContentOnly, bool caseSensative) const;
149
150 MCNAPI bool $getAsset(::Core::Path const& packRelativePath, ::std::string& result, bool trustedContentOnly) const;
151
152 MCNAPI ::std::unique_ptr<::PackAccessStrategy> $createSubPack(::Core::Path const& subPath) const;
153
154 MCNAPI bool $isAssetExtractionViable() const;
155
156 MCNAPI ::Bedrock::Result<::StreamableAssetSource>
157 $getStreamableSource(::Core::Path const& packRelativePath, ::std::optional<::Core::PathView> tempDirectory) const;
158
159 MCNAPI ::PackAccessStrategyType $getStrategyType() const;
160
161 MCNAPI ::ContentIdentity $readContentIdentity() const;
162
163 MCNAPI ::std::string $_getContentsFile();
164
165 MCNAPI ::std::string $_getRawContentsFile() const;
166
167 MCNAPI ::std::string $_getEncryptedAssetStream(::Core::Path const& packRelativePath) const;
168
169 MCNAPI ::std::unique_ptr<::Bedrock::Resources::Archive::Reader>
170 $_loadArchive(::Core::Path const& packRelativePath) const;
171
172
173 // NOLINTEND
174
175public:
176 // vftables
177 // NOLINTBEGIN
178 MCNAPI static void** $vftable();
179 // NOLINTEND
180};
Definition ContentIdentity.h:8
Definition PathView.h:19
Definition Path.h:11
MCAPI bool $isWritable() const
static MCAPI bool _transformStream(::std::string &stream, ::std::string const &key, ::ContentIdentity const &contentIdentity, ::AssetEncryptionMode mode, uint64 offset)
MCAPI::std::string _decryptContentsFile(::std::string contents)
MCAPI::std::string $_getRawContentsFile() const
MCAPI bool $isAssetExtractionViable() const
MCAPI ::Bedrock::Result<::StreamableAssetSource > $getStreamableSource(::Core::Path const &packRelativePath, ::std::optional<::Core::PathView > tempDirectory) const
MCAPI::std::string $_getContentsFile()
MCAPI bool $isTrusted() const
MCAPI::ContentIdentity $readContentIdentity() const
MCAPI void * $ctor(::ResourceLocation const &resourceLocation, ::ContentIdentity const &contentIdentity, ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const > const &keyProvider, bool canRecurse, ::IPackIOProvider const &io, ::std::optional<::std::unordered_map<::Core::Path, ::EncryptedAssetInfo > > assetSet)
MCAPI EncryptedFileAccessStrategy(::ResourceLocation const &resourceLocation, ::ContentIdentity const &contentIdentity, ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const > const &keyProvider, bool canRecurse, ::IPackIOProvider const &io, ::std::optional<::std::unordered_map<::Core::Path, ::EncryptedAssetInfo > > assetSet)
static MCAPI bool isValidEncryptedPack(::Core::Path const &pathToPack, ::ContentIdentity &contentIdentity)
MCAPI bool $hasAsset(::Core::Path const &packRelativePath, bool trustedContentOnly, bool caseSensative) const
static MCAPI bool _getContentIdentityFromEncryptedStream(::std::string &stream, ::ContentIdentity &contentIdentity)
MCAPI::std::string $_getEncryptedAssetStream(::Core::Path const &packRelativePath) const
MCAPI ::std::unique_ptr<::Bedrock::Resources::Archive::Reader > $_loadArchive(::Core::Path const &packRelativePath) const
MCAPI ::std::unique_ptr<::PackAccessStrategy > $createSubPack(::Core::Path const &subPath) const
static MCAPI void ** $vftable()
MCAPI::PackAccessStrategyType $getStrategyType() const
MCAPI::PackAccessAssetGenerationResult $generateAssetSet()
MCAPI ::std::unique_ptr<::Bedrock::Resources::Archive::Reader > _loadArchive(::Core::PathView packRelativeArchiveFile, ::std::string const &key) const
static MCAPI bool _transformStream(::gsl::span< char const > input, ::gsl::span< char > output, ::std::string const &key, uint64 &bytesWritten, ::AssetEncryptionMode mode)
MCAPI bool $getAsset(::Core::Path const &packRelativePath, ::std::string &result, bool trustedContentOnly) const
Definition IContentKeyProvider.h:13
Definition IPackIOProvider.h:17
Definition PackAccessStrategy.h:25
Definition ResourceLocation.h:15
Definition EncryptedAssetInfo.h:5
Definition StreamableAssetSource.h:5
Definition Alias.h:14