early-access version 3513

This commit is contained in:
pineappleEA 2023-04-19 19:41:33 +02:00
parent 59516ad377
commit 0c8bed734b
4 changed files with 66 additions and 51 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access
=============
This is the source code for early-access 3512.
This is the source code for early-access 3513.
## Legal Notice

View file

@ -156,6 +156,10 @@ u64 GetSignatureTypePaddingSize(SignatureType type) {
UNREACHABLE();
}
bool Ticket::IsValid() const {
return !std::holds_alternative<std::monostate>(data);
}
SignatureType Ticket::GetSignatureType() const {
if (const auto* ticket = std::get_if<RSA4096Ticket>(&data)) {
return ticket->sig_type;
@ -236,6 +240,7 @@ bool Ticket::Read(Ticket& ticket_out, const FileSys::VirtualFile& file) {
return true;
}
default:
ticket_out.data.emplace<std::monostate>();
return false;
}
}
@ -535,6 +540,12 @@ static std::optional<u64> FindTicketOffset(const std::array<u8, size>& data) {
std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket,
const RSAKeyPair<2048>& key) {
if (!ticket.IsValid()) {
return std::nullopt;
}
// Dirty hack, figure out why ticket.data variant is invalid
try {
const auto issuer = ticket.GetData().issuer;
if (IsAllZeroArray(issuer)) {
return std::nullopt;
@ -549,8 +560,7 @@ std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket,
return std::nullopt;
}
if (!std::any_of(ticket.GetData().title_key_common_pad.begin(),
ticket.GetData().title_key_common_pad.end(), [](u8 b) { return b != 0; })) {
if (ticket.GetData().type == TitleKeyType::Common) {
return std::make_pair(rights_id, ticket.GetData().title_key_common);
}
@ -596,6 +606,9 @@ std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket,
std::memcpy(key_temp.data(), m_2.data() + *offset, key_temp.size());
return std::make_pair(rights_id, key_temp);
} catch (const std::bad_variant_access&) {
return std::nullopt;
}
}
KeyManager::KeyManager() {

View file

@ -96,8 +96,9 @@ struct ECDSATicket {
};
struct Ticket {
std::variant<RSA4096Ticket, RSA2048Ticket, ECDSATicket> data;
std::variant<std::monostate, RSA4096Ticket, RSA2048Ticket, ECDSATicket> data;
bool IsValid() const;
SignatureType GetSignatureType() const;
TicketData& GetData();
const TicketData& GetData() const;

View file

@ -284,6 +284,7 @@ void AudOutU::OpenAudioOut(HLERequestContext& ctx) {
result = audio_out->GetImpl()->GetSystem().Initialize(device_name, in_params, handle,
applet_resource_user_id);
if (result.IsError()) {
LOG_ERROR(Service_Audio, "Failed to initialize the AudioOut System!");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(result);
return;