FileSys/cia: add ticket parsing
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
#include "common/alignment.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/file_sys/cia_common.h"
|
||||
#include "core/file_sys/title_metadata.h"
|
||||
#include "core/loader/loader.h"
|
||||
|
||||
@ -15,24 +16,6 @@
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
static u32 GetSignatureSize(u32 signature_type) {
|
||||
switch (signature_type) {
|
||||
case Rsa4096Sha1:
|
||||
case Rsa4096Sha256:
|
||||
return 0x200;
|
||||
|
||||
case Rsa2048Sha1:
|
||||
case Rsa2048Sha256:
|
||||
return 0x100;
|
||||
|
||||
case EllipticSha1:
|
||||
case EcdsaSha256:
|
||||
return 0x3C;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loader::ResultStatus TitleMetadata::Load(const std::string& file_path) {
|
||||
FileUtil::IOFile file(file_path, "rb");
|
||||
if (!file.IsOpen())
|
||||
@ -188,6 +171,12 @@ u64 TitleMetadata::GetContentSizeByIndex(u16 index) const {
|
||||
return tmd_chunks[index].size;
|
||||
}
|
||||
|
||||
std::array<u8, 16> TitleMetadata::GetContentCTRByIndex(u16 index) const {
|
||||
std::array<u8, 16> ctr{};
|
||||
std::memcpy(ctr.data(), &tmd_chunks[index].index, sizeof(u16));
|
||||
return ctr;
|
||||
}
|
||||
|
||||
void TitleMetadata::SetTitleID(u64 title_id) {
|
||||
tmd_body.title_id = title_id;
|
||||
}
|
||||
|
Reference in New Issue
Block a user