Skip to content
LeviMC
English
AutoLightDark
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::PathView const& packRelativePath, bool trustedContentOnly, bool caseSensative) const
52 /*override*/;
53
54 virtual bool
55 getAsset(::Core::PathView const& packRelativePath, ::std::string& result, bool trustedContentOnly) const
56 /*override*/;
57
58 virtual ::std::unique_ptr<::PackAccessStrategy> createSubPack(::Core::Path const& subPath) const /*override*/;
59
60 virtual bool isAssetExtractionViable() const /*override*/;
61
62 virtual ::Bedrock::Result<::StreamableAssetSource>
63 getStreamableSource(::Core::Path const& packRelativePath, ::std::optional<::Core::PathView> tempDirectory) const
64 /*override*/;
65
66 virtual ::PackAccessStrategyType getStrategyType() const /*override*/;
67
68 virtual ::ContentIdentity readContentIdentity() const /*override*/;
69
70 virtual ::std::string _getContentsFile();
71
72 virtual ::std::string _getRawContentsFile() const;
73
74 virtual void _getEncryptedAssetStream(::Core::PathView const& packRelativePath, ::std::string& result) const;
75
76 virtual bool _getArchiveAssetFallback(
77 ::Core::PathView const& packRelativePath,
78 ::Core::PathView const& packRelativeArchivePath,
79 ::EncryptedAssetInfo const& entryInfo,
80 ::std::string& result
81 ) const;
82
83 virtual ::std::unique_ptr<::Bedrock::Resources::Archive::Reader>
84 _loadArchive(::Core::Path const& packRelativePath) const /*override*/;
85 // NOLINTEND
86
87public:
88 // member functions
89 // NOLINTBEGIN
91 ::ResourceLocation const& resourceLocation,
92 ::ContentIdentity const& contentIdentity,
93 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> const& keyProvider,
94 bool canRecurse,
95 ::IPackIOProvider const& io,
96 ::std::optional<::std::unordered_map<::Core::Path, ::EncryptedAssetInfo>> assetSet
97 );
98
99 MCNAPI ::std::string _decryptContentsFile(::std::string contents);
100
101 MCNAPI ::std::unique_ptr<::Bedrock::Resources::Archive::Reader>
102 _loadArchive(::Core::PathView packRelativeArchiveFile, ::std::string const& key) const;
103 // NOLINTEND
104
105public:
106 // static functions
107 // NOLINTBEGIN
108 MCNAPI static bool
109 _getContentIdentityFromEncryptedStream(::std::string& stream, ::ContentIdentity& contentIdentity);
110
111 MCNAPI static bool _transformStream(
112 ::gsl::span<char const> input,
113 ::gsl::span<char> output,
114 ::std::string const& key,
115 uint64& bytesWritten,
116 ::AssetEncryptionMode mode
117 );
118
119 MCNAPI static bool _transformStream(
120 ::std::string& stream,
121 ::std::string const& key,
122 ::ContentIdentity const& contentIdentity,
123 ::AssetEncryptionMode mode,
124 uint64 offset
125 );
126
127#ifdef LL_PLAT_C
128 MCNAPI static bool contentFileExists(::Core::Path const& pathToPack);
129#endif
130
131 MCNAPI static bool isValidEncryptedPack(::Core::Path const& pathToPack, ::ContentIdentity& contentIdentity);
132 // NOLINTEND
133
134public:
135 // constructor thunks
136 // NOLINTBEGIN
137 MCNAPI void* $ctor(
138 ::ResourceLocation const& resourceLocation,
139 ::ContentIdentity const& contentIdentity,
140 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> const& keyProvider,
141 bool canRecurse,
142 ::IPackIOProvider const& io,
143 ::std::optional<::std::unordered_map<::Core::Path, ::EncryptedAssetInfo>> assetSet
144 );
145 // NOLINTEND
146
147public:
148 // virtual function thunks
149 // NOLINTBEGIN
150 MCNAPI ::PackAccessAssetGenerationResult $generateAssetSet();
151
152 MCNAPI bool $isTrusted() const;
153
154 MCNAPI bool $isWritable() const;
155
156 MCNAPI bool $hasAsset(::Core::PathView const& packRelativePath, bool trustedContentOnly, bool caseSensative) const;
157
158 MCNAPI bool
159 $getAsset(::Core::PathView const& packRelativePath, ::std::string& result, bool trustedContentOnly) const;
160
161 MCNAPI ::std::unique_ptr<::PackAccessStrategy> $createSubPack(::Core::Path const& subPath) const;
162
163 MCNAPI bool $isAssetExtractionViable() const;
164
165 MCNAPI ::Bedrock::Result<::StreamableAssetSource>
166 $getStreamableSource(::Core::Path const& packRelativePath, ::std::optional<::Core::PathView> tempDirectory) const;
167
168 MCNAPI ::PackAccessStrategyType $getStrategyType() const;
169
170 MCNAPI ::ContentIdentity $readContentIdentity() const;
171
172 MCNAPI ::std::string $_getContentsFile();
173
174 MCNAPI ::std::string $_getRawContentsFile() const;
175
176 MCNAPI void $_getEncryptedAssetStream(::Core::PathView const& packRelativePath, ::std::string& result) const;
177
179 ::Core::PathView const& packRelativePath,
180 ::Core::PathView const& packRelativeArchivePath,
181 ::EncryptedAssetInfo const& entryInfo,
182 ::std::string& result
183 ) const;
184
185 MCNAPI ::std::unique_ptr<::Bedrock::Resources::Archive::Reader>
186 $_loadArchive(::Core::Path const& packRelativePath) const;
187
188
189 // NOLINTEND
190
191public:
192 // vftables
193 // NOLINTBEGIN
194 MCNAPI static void** $vftable();
195 // NOLINTEND
196};
Definition ContentIdentity.h:8
Definition PathView.h:19
Definition Path.h:10
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)
static MCAPI bool _getContentIdentityFromEncryptedStream(::std::string &stream, ::ContentIdentity &contentIdentity)
MCAPI bool $hasAsset(::Core::PathView const &packRelativePath, bool trustedContentOnly, bool caseSensative) const
MCAPI void $_getEncryptedAssetStream(::Core::PathView const &packRelativePath, ::std::string &result) 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 bool $getAsset(::Core::PathView const &packRelativePath, ::std::string &result, bool trustedContentOnly) const
MCAPI::PackAccessAssetGenerationResult $generateAssetSet()
MCAPI ::std::unique_ptr<::Bedrock::Resources::Archive::Reader > _loadArchive(::Core::PathView packRelativeArchiveFile, ::std::string const &key) const
MCAPI bool $_getArchiveAssetFallback(::Core::PathView const &packRelativePath, ::Core::PathView const &packRelativeArchivePath, ::EncryptedAssetInfo const &entryInfo, ::std::string &result) const
static MCAPI bool _transformStream(::gsl::span< char const > input, ::gsl::span< char > output, ::std::string const &key, uint64 &bytesWritten, ::AssetEncryptionMode mode)
Definition IContentKeyProvider.h:13
Definition IPackIOProvider.h:19
Definition PackAccessStrategy.h:25
Definition ResourceLocation.h:15
Definition EncryptedAssetInfo.h:5
Definition StreamableAssetSource.h:5
Definition Alias.h:14