call DIVerify when a wii game is launched directly by dolphin (adds tmd+uid)

after this revision, wii save manager (< 3.0) should show any saves on the emulated nand

fixes an old issue with GetTitleID
fixes issue 1716.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6190 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2010-09-08 00:20:19 +00:00
parent e0383634d3
commit d422039f0a
6 changed files with 34 additions and 4 deletions

View File

@ -31,6 +31,7 @@
#include "../HW/DVDInterface.h"
#include "../HW/VideoInterface.h"
#include "../HW/CPU.h"
#include "../IPC_HLE/WII_IPC_HLE.h"
#include "../Debugger/Debugger_SymbolMap.h" // Debugger
@ -191,6 +192,16 @@ bool CBoot::BootUp()
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
u32 _TMDsz = 0x208;
u8* _pTMD = new u8[_TMDsz];
pVolume->GetTMD(_pTMD, &_TMDsz);
if (_TMDsz)
{
WII_IPC_HLE_Interface::ES_DIVerify(_pTMD, _TMDsz);
}
delete []_pTMD;
_StartupPara.bWii = VolumeHandler::IsWii();
// HLE BS2 or not

View File

@ -123,7 +123,7 @@ bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress)
INFO_LOG(WII_IPC_DVD, "DVDLowOpenPartition: TMDOffset 0x%016llx", TMDOffset);
u32 TMDsz = CommandBuffer.PayloadBuffer[0].m_Size;
u32 TMDsz = 0x208; //CommandBuffer.PayloadBuffer[0].m_Size;
u8 *pTMD = new u8[TMDsz];
if (pTMD)
{

View File

@ -34,6 +34,7 @@ public:
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
virtual bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
virtual bool GetTitleID(u8*) const { return false; }
virtual void GetTMD(u8*, u32 *_sz) const { *_sz=0; }
virtual std::string GetUniqueID() const = 0;
virtual std::string GetMakerID() const = 0;
virtual std::string GetName() const = 0;

View File

@ -204,7 +204,7 @@ IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _PartitionGr
// -1 means the caller just wanted the partition with matching type
if ((int)_VolumeNum == -1 || i == _VolumeNum)
return new CVolumeWiiCrypted(&_rReader, rPartition.Offset + 0x20000, VolumeKey);
return new CVolumeWiiCrypted(&_rReader, rPartition.Offset, VolumeKey);
}
}

View File

@ -28,6 +28,7 @@ CVolumeWiiCrypted::CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset,
: m_pReader(_pReader),
m_pBuffer(0),
m_VolumeOffset(_VolumeOffset),
dataOffset(0x20000),
m_LastDecryptedBlockOffset(-1)
{
AES_set_decrypt_key(_pVolumeKey, 128, &m_AES_KEY);
@ -71,7 +72,7 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
u64 Offset = _ReadOffset % 0x7C00;
// read current block
if (!m_pReader->Read(m_VolumeOffset + Block * 0x8000, 0x8000, m_pBuffer))
if (!m_pReader->Read(m_VolumeOffset + dataOffset + Block * 0x8000, 0x8000, m_pBuffer))
{
return(false);
}
@ -100,7 +101,22 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
bool CVolumeWiiCrypted::GetTitleID(u8* _pBuffer) const
{
return RAWRead((u64)0x0F8001DC, 8, _pBuffer);
// Tik is at m_VolumeOffset size 0x2A4
// TitleID offset in tik is 0x1DC
return RAWRead(m_VolumeOffset + 0x1DC, 8, _pBuffer);
}
void CVolumeWiiCrypted::GetTMD(u8* _pBuffer, u32 * _sz) const
{
*_sz = 0;
u32 tmdSz,
tmdAddr;
RAWRead(m_VolumeOffset + 0x2a4, sizeof(u32), (u8*)&tmdSz);
RAWRead(m_VolumeOffset + 0x2a8, sizeof(u32), (u8*)&tmdAddr);
tmdSz = Common::swap32(tmdSz);
tmdAddr = Common::swap32(tmdAddr) << 2;
RAWRead(m_VolumeOffset + tmdAddr, tmdSz, _pBuffer);
*_sz = tmdSz;
}
std::string CVolumeWiiCrypted::GetUniqueID() const

View File

@ -34,6 +34,7 @@ public:
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const;
bool GetTitleID(u8* _pBuffer) const;
void GetTMD(u8* _pBuffer, u32* _sz) const;
std::string GetUniqueID() const;
std::string GetMakerID() const;
std::string GetName() const;
@ -49,6 +50,7 @@ private:
AES_KEY m_AES_KEY;
u64 m_VolumeOffset;
u64 dataOffset;
mutable u64 m_LastDecryptedBlockOffset;
mutable unsigned char m_LastDecryptedBlock[0x8000];