Files
threeSD/src/core/extdata.h
T
Pengfei c81db424bb Refactor InnerFAT into Savegame and Extdata
And derive TitleDB from it too.
2021-07-06 16:11:03 +08:00

50 lines
1.2 KiB
C++

// Copyright 2021 threeSD Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "core/inner_fat.hpp"
namespace Core {
class SDMCDecryptor;
class Extdata final : public Archive<Extdata> {
public:
/**
* Loads an SD extdata folder.
* @param data_path Path to the ENCRYPTED SD extdata folder, relative to decryptor root
* @param decryptor Const reference to the SDMCDecryptor.
*/
explicit Extdata(std::string data_path, const SDMCDecryptor& decryptor);
/**
* Loads an Extdata folder without encryption.
* @param data_path Path to the DECRYPTED extdata folder
*/
explicit Extdata(std::string data_path);
~Extdata();
bool IsGood() const;
bool Extract(std::string path) const;
private:
bool Init();
bool CheckMagic() const;
std::vector<u8> ReadFile(const std::string& path) const;
bool ExtractFile(const std::string& path, std::size_t index) const;
ArchiveFormatInfo GetFormatInfo() const;
bool is_good = false;
std::string data_path;
const SDMCDecryptor* decryptor = nullptr;
bool use_decryptor = true;
friend class Archive<Extdata>;
friend class InnerFAT<Extdata>;
};
} // namespace Core