From 4d776ffa8ff1dcefb3618297e8971eb59122c869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 26 Feb 2017 17:26:08 +0100 Subject: IOS/ES: Keep track of the active title properly This changes ES to keep track of the active title properly, just like IOS: * It is NOT changed on resource manager open/close. * It is reset on IOS reload. * It is changed by ES_DIVerify and ES_Launch. IOS stores the active title in a structure like this: struct ESTitleContext { Ticket* ticket; TMD* tmd; u32 active; }; With this commit, we also do keep the Ticket and TMD around. This makes some of the DI ioctlvs (which return data about the current active title) trivial to implement in the future. This fixes the System Menu not being able to see update partitions and also allows us to change Dolphin's active game info in the future. --- Source/Core/DiscIO/Volume.h | 1 + Source/Core/DiscIO/VolumeWiiCrypted.cpp | 7 +++++++ Source/Core/DiscIO/VolumeWiiCrypted.h | 1 + 3 files changed, 9 insertions(+) (limited to 'Source/Core/DiscIO') diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h index 1190565004..f3f530e5e4 100644 --- a/Source/Core/DiscIO/Volume.h +++ b/Source/Core/DiscIO/Volume.h @@ -37,6 +37,7 @@ public: } virtual bool GetTitleID(u64*) const { return false; } + virtual IOS::ES::TicketReader GetTicket() const { return {}; } virtual IOS::ES::TMDReader GetTMD() const { return {}; } virtual u64 PartitionOffsetToRawOffset(u64 offset) const { return offset; } virtual std::string GetGameID() const = 0; diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp index ef291fa237..71e50252db 100644 --- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp +++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp @@ -114,6 +114,13 @@ bool CVolumeWiiCrypted::GetTitleID(u64* buffer) const return true; } +IOS::ES::TicketReader CVolumeWiiCrypted::GetTicket() const +{ + std::vector buffer(0x2a4); + Read(m_VolumeOffset, buffer.size(), buffer.data(), false); + return IOS::ES::TicketReader{std::move(buffer)}; +} + IOS::ES::TMDReader CVolumeWiiCrypted::GetTMD() const { u32 tmd_size; diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.h b/Source/Core/DiscIO/VolumeWiiCrypted.h index dfeb74ad66..d7e7c4bddb 100644 --- a/Source/Core/DiscIO/VolumeWiiCrypted.h +++ b/Source/Core/DiscIO/VolumeWiiCrypted.h @@ -33,6 +33,7 @@ public: ~CVolumeWiiCrypted(); bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const override; bool GetTitleID(u64* buffer) const override; + IOS::ES::TicketReader GetTicket() const override; IOS::ES::TMDReader GetTMD() const override; u64 PartitionOffsetToRawOffset(u64 offset) const override; std::string GetGameID() const override; -- cgit v1.2.3