add mtp install, fix es ticket being the wrong size, fix yati not returning the read fail result, updated haze, updated translations

see #132
This commit is contained in:
ITotalJustice
2025-06-17 10:48:07 +01:00
parent 4ef15f8b81
commit 1c72350d4a
29 changed files with 676 additions and 798 deletions

View File

@@ -166,12 +166,19 @@ Result GetTicketDataOffset(std::span<const u8> ticket, u64& out) {
Result GetTicketData(std::span<const u8> ticket, es::TicketData* out) {
u64 data_off;
R_TRY(GetTicketDataOffset(ticket, data_off));
if (ticket.size() < data_off + sizeof(*out)) {
log_write("[ES] invalid ticket size: %zu vs %zu\n", ticket.size(), data_off + sizeof(*out));
R_THROW(Result_EsBadTicketSize);
}
std::memcpy(out, ticket.data() + data_off, sizeof(*out));
// validate ticket data.
log_write("[ES] validating ticket data\n");
R_UNLESS(out->ticket_version1 == 0x2, Result_InvalidTicketVersion); // must be version 2.
R_UNLESS(out->title_key_type == es::TicketTitleKeyType_Common || out->title_key_type == es::TicketTitleKeyType_Personalized, Result_InvalidTicketKeyType);
R_UNLESS(out->master_key_revision <= 0x20, Result_InvalidTicketKeyRevision);
log_write("[ES] valid ticket data\n");
R_SUCCEED();
}

View File

@@ -307,8 +307,10 @@ void ThreadData::WakeAllThreads() {
Result ThreadData::Read(void* buf, s64 size, u64* bytes_read) {
size = std::min<s64>(size, nca->size - read_offset);
const auto rc = yati->source->Read(buf, nca->offset + read_offset, size, bytes_read);
read_offset += *bytes_read;
R_TRY(rc);
R_UNLESS(size == *bytes_read, Result_YatiInvalidNcaReadSize);
read_offset += *bytes_read;
return rc;
}