mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-16 03:53:26 +01:00
Merge pull request #4759 from B3n30/load_cia_ticket
FileSys: Load the ticket when the CIAContainer is loaded
This commit is contained in:
commit
59879366a6
@ -30,6 +30,16 @@ Loader::ResultStatus CIAContainer::Load(const FileBackend& backend) {
|
||||
if (result != Loader::ResultStatus::Success)
|
||||
return result;
|
||||
|
||||
// Load Ticket
|
||||
std::vector<u8> ticket_data(cia_header.tik_size);
|
||||
read_result = backend.Read(GetTicketOffset(), cia_header.tik_size, ticket_data.data());
|
||||
if (read_result.Failed() || *read_result != cia_header.tik_size)
|
||||
return Loader::ResultStatus::Error;
|
||||
|
||||
result = LoadTicket(ticket_data);
|
||||
if (result != Loader::ResultStatus::Success)
|
||||
return result;
|
||||
|
||||
// Load Title Metadata
|
||||
std::vector<u8> tmd_data(cia_header.tmd_size);
|
||||
read_result = backend.Read(GetTitleMetadataOffset(), cia_header.tmd_size, tmd_data.data());
|
||||
@ -69,6 +79,16 @@ Loader::ResultStatus CIAContainer::Load(const std::string& filepath) {
|
||||
if (result != Loader::ResultStatus::Success)
|
||||
return result;
|
||||
|
||||
// Load Ticket
|
||||
std::vector<u8> ticket_data(cia_header.tik_size);
|
||||
file.Seek(GetTicketOffset(), SEEK_SET);
|
||||
if (file.ReadBytes(ticket_data.data(), cia_header.tik_size) != cia_header.tik_size)
|
||||
return Loader::ResultStatus::Error;
|
||||
|
||||
result = LoadTicket(ticket_data);
|
||||
if (result != Loader::ResultStatus::Success)
|
||||
return result;
|
||||
|
||||
// Load Title Metadata
|
||||
std::vector<u8> tmd_data(cia_header.tmd_size);
|
||||
file.Seek(GetTitleMetadataOffset(), SEEK_SET);
|
||||
@ -99,6 +119,11 @@ Loader::ResultStatus CIAContainer::Load(const std::vector<u8>& file_data) {
|
||||
if (result != Loader::ResultStatus::Success)
|
||||
return result;
|
||||
|
||||
// Load Ticket
|
||||
result = LoadTicket(file_data, GetTicketOffset());
|
||||
if (result != Loader::ResultStatus::Success)
|
||||
return result;
|
||||
|
||||
// Load Title Metadata
|
||||
result = LoadTitleMetadata(file_data, GetTitleMetadataOffset());
|
||||
if (result != Loader::ResultStatus::Success)
|
||||
|
Loading…
Reference in New Issue
Block a user