Fix of issue 408, the game still can't boot.

Implement DVDLowUnencryptedRead, Medal Of Honor Heroes 2 use it to get DVD PartitionsInfo (disk offset 0x40000).
and the game try to use IOCtlV, code 0x8b, bushing point out, IOCtlV 0x8b is DVDLowOpenPartition too, so I just return 0 for success.
need further work on this.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2367 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hyperiris 2009-02-22 13:59:06 +00:00
parent 03a950a1e5
commit 42a7d2fc85
10 changed files with 82 additions and 5 deletions

View File

@ -98,10 +98,28 @@ bool CWII_IPC_HLE_Device_di::IOCtl(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress)
{
PanicAlert("CWII_IPC_HLE_Device_di::IOCtlV() unknown");
// PanicAlert("CWII_IPC_HLE_Device_di::IOCtlV() unknown");
// DumpCommands(_CommandAddress);
u32 ReturnValue = 0;
DumpCommands(_CommandAddress);
SIOCtlVBuffer CommandBuffer(_CommandAddress);
switch (CommandBuffer.Parameter)
{
// DVDLowOpenPartition???
case 0x8b:
{
LOG(WII_IPC_DVD, "DVD IOCtlV: DVDLowOpenPartition");
_dbg_assert_msg_(WII_IPC_DVD, 0, "DVD IOCtlV: DVDLowOpenPartition");
}
break;
default:
LOG(WII_IPC_DVD, "DVD IOCtlV: %i", CommandBuffer.Parameter);
_dbg_assert_msg_(WII_IPC_DVD, 0, "DVD: %i", CommandBuffer.Parameter);
break;
}
Memory::Write_U32(ReturnValue, _CommandAddress+4);
return true;
}
@ -281,12 +299,32 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
// DVDLowUnencryptedRead
case 0x8d:
PanicAlert("DVDLowUnencryptedRead");
//PanicAlert("DVDLowUnencryptedRead");
{
if (_BufferOut == 0)
{
PanicAlert("DVDLowRead : _BufferOut == 0");
return 0;
}
u32 Size = Memory::Read_U32(_BufferIn + 0x04);
u64 DVDAddress = (u64)Memory::Read_U32(_BufferIn + 0x08) << 2;
if (Size > _BufferOutSize)
{
PanicAlert("Detected attempt to read more data from the DVD than fit inside the out buffer. Clamp.");
Size = _BufferOutSize;
}
if (VolumeHandler::RAWReadToPtr(Memory::GetPointer(_BufferOut), DVDAddress, Size) != true)
{
PanicAlert("Cant read from DVD_Plugin - DVD-Interface: Fatal Error");
}
}
break;
// DVDLowSeek
case 0xab:
// PanicAlert("DVDLowSeek");
//PanicAlert("DVDLowSeek");
break;
case 0xe0:

View File

@ -77,6 +77,17 @@ bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength)
return false;
}
bool RAWReadToPtr( u8* ptr, u64 _dwOffset, u64 _dwLength )
{
if (g_pVolume != NULL && ptr)
{
g_pVolume->RAWRead(_dwOffset, _dwLength, ptr);
return true;
}
return false;
}
bool IsValid()
{
return g_pVolume != NULL;

View File

@ -33,6 +33,7 @@ void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii);
u32 Read32(u64 _Offset);
bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength);
bool RAWReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength);
bool IsValid();
bool IsWii();

View File

@ -38,6 +38,7 @@ class IVolume
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
virtual bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
virtual std::string GetUniqueID() const = 0;
virtual std::string GetMakerID() const = 0;
virtual std::string GetName() const = 0;

View File

@ -69,6 +69,11 @@ bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory)
return File::IsDirectory(directoryName.c_str());
}
bool CVolumeDirectory::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
{
return false;
}
bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
{
if(_Offset < FST_ADDRESS)

View File

@ -42,6 +42,7 @@ class CVolumeDirectory
static bool IsValidDirectory(const std::string& _rDirectory);
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
void SetUniqueID(std::string _ID);

View File

@ -55,6 +55,11 @@ bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
return m_pReader->Read(_Offset, _Length, _pBuffer);
}
bool CVolumeGC::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
{
return false;
}
std::string CVolumeGC::GetUniqueID() const
{
static const std::string NO_UID("NO_UID");

View File

@ -30,6 +30,7 @@ public:
CVolumeGC(IBlobReader* _pReader);
~CVolumeGC();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
std::string GetMakerID() const;
std::string GetName() const;

View File

@ -41,6 +41,17 @@ CVolumeWiiCrypted::~CVolumeWiiCrypted()
m_pBuffer = NULL;
}
bool CVolumeWiiCrypted::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
{
// HyperIris: hack for DVDLowUnencryptedRead
// Medal Of Honor Heroes 2 read this DVD offset for PartitionsInfo
// and, PartitionsInfo is not encrypted, let's read it directly.
if (!m_pReader->Read(_Offset, _Length, _pBuffer))
{
return(false);
}
return true;
}
bool
CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
@ -255,4 +266,6 @@ CVolumeWiiCrypted::GetSize() const
return(0);
}
}
} // namespace

View File

@ -32,6 +32,7 @@ public:
CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
~CVolumeWiiCrypted();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
std::string GetMakerID() const;
std::string GetName() const;