Merge pull request #3078 from lioncash/titleid
DiscIO: Do swapping in GetTitleID implementations
This commit is contained in:
commit
c1ee0e7829
|
@ -115,8 +115,7 @@ void CWII_IPC_HLE_Device_es::OpenInternal()
|
||||||
{
|
{
|
||||||
// blindly grab the titleID from the disc - it's unencrypted at:
|
// blindly grab the titleID from the disc - it's unencrypted at:
|
||||||
// offset 0x0F8001DC and 0x0F80044C
|
// offset 0x0F8001DC and 0x0F80044C
|
||||||
DVDInterface::GetVolume().GetTitleID((u8*)&m_TitleID);
|
DVDInterface::GetVolume().GetTitleID(&m_TitleID);
|
||||||
m_TitleID = Common::swap64(m_TitleID);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1100,8 +1099,8 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz)
|
||||||
{
|
{
|
||||||
u64 titleID = 0xDEADBEEFDEADBEEFull;
|
u64 titleID = 0xDEADBEEFDEADBEEFull;
|
||||||
u64 tmdTitleID = Common::swap64(*(u64*)(_pTMD+0x18c));
|
u64 tmdTitleID = Common::swap64(*(u64*)(_pTMD+0x18c));
|
||||||
DVDInterface::GetVolume().GetTitleID((u8*)&titleID);
|
DVDInterface::GetVolume().GetTitleID(&titleID);
|
||||||
if (Common::swap64(titleID) != tmdTitleID)
|
if (titleID != tmdTitleID)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
return Common::swap32(temp);
|
return Common::swap32(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool GetTitleID(u8*) const { return false; }
|
virtual bool GetTitleID(u64*) const { return false; }
|
||||||
virtual std::unique_ptr<u8[]> GetTMD(u32 *_sz) const
|
virtual std::unique_ptr<u8[]> GetTMD(u32 *_sz) const
|
||||||
{
|
{
|
||||||
*_sz = 0;
|
*_sz = 0;
|
||||||
|
|
|
@ -29,12 +29,11 @@ std::vector<u32> IVolume::GetBanner(int* width, int* height) const
|
||||||
*width = 0;
|
*width = 0;
|
||||||
*height = 0;
|
*height = 0;
|
||||||
|
|
||||||
u64 TitleID = 0;
|
u64 title_id = 0;
|
||||||
GetTitleID((u8*)&TitleID);
|
GetTitleID(&title_id);
|
||||||
TitleID = Common::swap64(TitleID);
|
|
||||||
|
|
||||||
std::string file_name = StringFromFormat("%s/title/%08x/%08x/data/banner.bin",
|
std::string file_name = StringFromFormat("%s/title/%08x/%08x/data/banner.bin",
|
||||||
File::GetUserPath(D_WIIROOT_IDX).c_str(), (u32)(TitleID >> 32), (u32)TitleID);
|
File::GetUserPath(D_WIIROOT_IDX).c_str(), (u32)(title_id >> 32), (u32)title_id);
|
||||||
if (!File::Exists(file_name))
|
if (!File::Exists(file_name))
|
||||||
return std::vector<u32>();
|
return std::vector<u32>();
|
||||||
|
|
||||||
|
|
|
@ -93,11 +93,12 @@ std::string CVolumeWAD::GetMakerID() const
|
||||||
return DecodeString(temp);
|
return DecodeString(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeWAD::GetTitleID(u8* _pBuffer) const
|
bool CVolumeWAD::GetTitleID(u64* buffer) const
|
||||||
{
|
{
|
||||||
if (!Read(m_offset + 0x01DC, 8, _pBuffer))
|
if (!Read(m_offset + 0x01DC, sizeof(u64), reinterpret_cast<u8*>(buffer)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
*buffer = Common::swap64(*buffer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
CVolumeWAD(std::unique_ptr<IBlobReader> reader);
|
CVolumeWAD(std::unique_ptr<IBlobReader> reader);
|
||||||
~CVolumeWAD();
|
~CVolumeWAD();
|
||||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt = false) const override;
|
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt = false) const override;
|
||||||
bool GetTitleID(u8* _pBuffer) const override;
|
bool GetTitleID(u64* buffer) const override;
|
||||||
std::string GetUniqueID() const override;
|
std::string GetUniqueID() const override;
|
||||||
std::string GetMakerID() const override;
|
std::string GetMakerID() const override;
|
||||||
u16 GetRevision() const override;
|
u16 GetRevision() const override;
|
||||||
|
|
|
@ -107,11 +107,15 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer, bool de
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVolumeWiiCrypted::GetTitleID(u8* _pBuffer) const
|
bool CVolumeWiiCrypted::GetTitleID(u64* buffer) const
|
||||||
{
|
{
|
||||||
// Tik is at m_VolumeOffset size 0x2A4
|
// Tik is at m_VolumeOffset size 0x2A4
|
||||||
// TitleID offset in tik is 0x1DC
|
// TitleID offset in tik is 0x1DC
|
||||||
return Read(m_VolumeOffset + 0x1DC, 8, _pBuffer, false);
|
if (!Read(m_VolumeOffset + 0x1DC, sizeof(u64), reinterpret_cast<u8*>(buffer), false))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
*buffer = Common::swap64(*buffer);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const
|
std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
CVolumeWiiCrypted(std::unique_ptr<IBlobReader> reader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
|
CVolumeWiiCrypted(std::unique_ptr<IBlobReader> reader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
|
||||||
~CVolumeWiiCrypted();
|
~CVolumeWiiCrypted();
|
||||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const override;
|
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const override;
|
||||||
bool GetTitleID(u8* _pBuffer) const override;
|
bool GetTitleID(u64* buffer) const override;
|
||||||
std::unique_ptr<u8[]> GetTMD(u32 *_sz) const override;
|
std::unique_ptr<u8[]> GetTMD(u32 *_sz) const override;
|
||||||
std::string GetUniqueID() const override;
|
std::string GetUniqueID() const override;
|
||||||
std::string GetMakerID() const override;
|
std::string GetMakerID() const override;
|
||||||
|
|
|
@ -377,13 +377,11 @@ const QString GameFile::GetWiiFSPath() const
|
||||||
|
|
||||||
if (volume->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC)
|
if (volume->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC)
|
||||||
{
|
{
|
||||||
std::string path;
|
u64 title_id;
|
||||||
u64 title;
|
volume->GetTitleID(&title_id);
|
||||||
|
|
||||||
volume->GetTitleID((u8*)&title);
|
std::string path = StringFromFormat("%s/title/%08x/%08x/data/",
|
||||||
title = Common::swap64(title);
|
File::GetUserPath(D_WIIROOT_IDX).c_str(), (u32)(title_id >> 32), (u32)title_id);
|
||||||
|
|
||||||
path = StringFromFormat("%s/title/%08x/%08x/data/", File::GetUserPath(D_WIIROOT_IDX).c_str(), (u32)(title >> 32), (u32)title);
|
|
||||||
|
|
||||||
if (!File::Exists(path))
|
if (!File::Exists(path))
|
||||||
File::CreateFullPath(path);
|
File::CreateFullPath(path);
|
||||||
|
|
|
@ -947,12 +947,11 @@ void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED (event))
|
||||||
if (!iso)
|
if (!iso)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u64 title;
|
u64 title_id;
|
||||||
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(iso->GetFileName()));
|
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(iso->GetFileName()));
|
||||||
if (volume && volume->GetTitleID((u8*)&title))
|
if (volume && volume->GetTitleID(&title_id))
|
||||||
{
|
{
|
||||||
title = Common::swap64(title);
|
CWiiSaveCrypted::ExportWiiSave(title_id);
|
||||||
CWiiSaveCrypted::ExportWiiSave(title);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -340,13 +340,11 @@ const std::string GameListItem::GetWiiFSPath() const
|
||||||
|
|
||||||
if (iso->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC)
|
if (iso->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC)
|
||||||
{
|
{
|
||||||
u64 title = 0;
|
u64 title_id = 0;
|
||||||
|
iso->GetTitleID(&title_id);
|
||||||
iso->GetTitleID((u8*)&title);
|
|
||||||
title = Common::swap64(title);
|
|
||||||
|
|
||||||
const std::string path = StringFromFormat("%s/title/%08x/%08x/data/",
|
const std::string path = StringFromFormat("%s/title/%08x/%08x/data/",
|
||||||
File::GetUserPath(D_WIIROOT_IDX).c_str(), (u32)(title>>32), (u32)title);
|
File::GetUserPath(D_WIIROOT_IDX).c_str(), (u32)(title_id >> 32), (u32)title_id);
|
||||||
|
|
||||||
if (!File::Exists(path))
|
if (!File::Exists(path))
|
||||||
File::CreateFullPath(path);
|
File::CreateFullPath(path);
|
||||||
|
|
Loading…
Reference in New Issue