mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-17 16:44:22 -04:00
fs: add Sha256HashGenerator, LZ4 decompressor
This commit is contained in:
parent
a2aec363d7
commit
01f7f567b9
11 changed files with 165 additions and 8 deletions
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "fssystem_key_slot_cache.hpp"
|
||||
|
||||
namespace ams::fssystem {
|
||||
|
||||
namespace {
|
||||
|
||||
Result DecompressLz4(void *dst, size_t dst_size, const void *src, size_t src_size) {
|
||||
R_UNLESS(util::DecompressLZ4(dst, dst_size, src, src_size) == static_cast<int>(dst_size), fs::ResultUnexpectedInCompressedStorageC());
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
constexpr DecompressorFunction GetNcaDecompressorFunction(CompressionType type) {
|
||||
switch (type) {
|
||||
case CompressionType_Lz4:
|
||||
return DecompressLz4;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr NcaCompressionConfiguration g_nca_compression_configuration {
|
||||
.get_decompressor = GetNcaDecompressorFunction,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
const ::ams::fssystem::NcaCompressionConfiguration *GetNcaCompressionConfiguration() {
|
||||
return std::addressof(g_nca_compression_configuration);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue