mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -06:00
added VolumeDirectory and modified ELF boot code to allow a directory on the user's computer to appear as the DVD drive. Linux support needs to be added. Added functionality to the Wii DI. Clicking on a data symbol in the code window sets the memory list to that address.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@624 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -393,6 +393,33 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
|
||||
return true;
|
||||
}
|
||||
|
||||
void CBoot::Load_FST(bool _bIsWii)
|
||||
{
|
||||
if(VolumeHandler::IsValid())
|
||||
{
|
||||
// copy first 20 bytes of disc to start of Mem 1
|
||||
VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20);
|
||||
|
||||
// copy of game id
|
||||
Memory::Write_U32(Memory::Read_U32(0x80000000), 0x80003180);
|
||||
|
||||
u32 shift = 0;
|
||||
if(_bIsWii)
|
||||
shift = 2;
|
||||
|
||||
u32 fstOffset = VolumeHandler::Read32(0x0424) << shift;
|
||||
u32 fstSize = VolumeHandler::Read32(0x0428) << shift;
|
||||
u32 maxFstSize = VolumeHandler::Read32(0x042c) << shift;
|
||||
|
||||
u32 arenaHigh = 0x817FFFF4 - maxFstSize;
|
||||
Memory::Write_U32(arenaHigh, 0x00000034);
|
||||
|
||||
// load FST
|
||||
VolumeHandler::ReadToPtr(Memory::GetPointer(arenaHigh), fstOffset, fstSize);
|
||||
Memory::Write_U32(arenaHigh, 0x00000038);
|
||||
Memory::Write_U32(maxFstSize, 0x0000003c);
|
||||
}
|
||||
}
|
||||
|
||||
void CBoot::UpdateDebugger_MapLoaded(const char *_gameID)
|
||||
{
|
||||
@ -546,12 +573,11 @@ bool CBoot::BootUp(const SCoreStartupParameter& _StartupPara)
|
||||
PanicAlert("Warning - starting ELF in wrong console mode!");
|
||||
}
|
||||
|
||||
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM);
|
||||
// stop apploader from running when BIOS boots
|
||||
VolumeHandler::SetVolumeName("");
|
||||
|
||||
if (elfWii)
|
||||
{
|
||||
if (VolumeHandler::IsWii() && (!_StartupPara.m_strDefaultGCM.empty()))
|
||||
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
|
||||
|
||||
EmulatedBIOS_Wii(false);
|
||||
}
|
||||
else
|
||||
@ -562,6 +588,24 @@ bool CBoot::BootUp(const SCoreStartupParameter& _StartupPara)
|
||||
EmulatedBIOS(false);
|
||||
}
|
||||
}
|
||||
|
||||
// load image or create virtual drive from directory
|
||||
if(!_StartupPara.m_strDVDRoot.empty())
|
||||
{
|
||||
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, elfWii);
|
||||
}
|
||||
else if(!_StartupPara.m_strDefaultGCM.empty())
|
||||
{
|
||||
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM);
|
||||
}
|
||||
else
|
||||
{
|
||||
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strFilename, elfWii);
|
||||
}
|
||||
|
||||
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
|
||||
|
||||
Load_FST(elfWii);
|
||||
|
||||
Boot_ELF(_StartupPara.m_strFilename.c_str());
|
||||
UpdateDebugger_MapLoaded();
|
||||
|
@ -57,6 +57,8 @@ private:
|
||||
static void EmulatedBIOS(bool _bDebug);
|
||||
static bool EmulatedBIOS_Wii(bool _bDebug);
|
||||
static bool Load_BIOS(const std::string& _rBiosFilename);
|
||||
|
||||
static void Load_FST(bool _bIsWii);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -80,6 +80,7 @@ struct SCoreStartupParameter
|
||||
std::string m_strMemoryCardB;
|
||||
std::string m_strSRAM;
|
||||
std::string m_strDefaultGCM;
|
||||
std::string m_strDVDRoot;
|
||||
std::string m_strUniqueID;
|
||||
|
||||
//
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "VolumeCreator.h"
|
||||
#include "Filesystem.h"
|
||||
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
//
|
||||
CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName )
|
||||
@ -36,7 +37,7 @@ CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string&
|
||||
, m_pFileSystem(NULL)
|
||||
{
|
||||
|
||||
m_pVolume = DiscIO::CreateVolumeFromFilename(Core::GetStartupParameter().m_strFilename);
|
||||
m_pVolume = VolumeHandler::GetVolume();
|
||||
if (m_pVolume)
|
||||
m_pFileSystem = DiscIO::CreateFileSystem(m_pVolume);
|
||||
}
|
||||
@ -103,6 +104,9 @@ bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Hack
|
||||
u8 coverByte = 0;
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
//
|
||||
u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize)
|
||||
@ -114,13 +118,46 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
|
||||
case 0x12:
|
||||
{
|
||||
Memory::Memset(_BufferOut, 0, _BufferOutSize);
|
||||
LOG(WII_IPC_HLE, "%s executes DVDLowInquiry (Buffer 0x%08x, 0x%x)", GetDeviceName().c_str(), _BufferOut, _BufferOutSize);
|
||||
|
||||
u8* buffer = Memory::GetPointer(_BufferOut);
|
||||
|
||||
// rev
|
||||
buffer[0] = 0x01;
|
||||
buffer[1] = 0x02;
|
||||
|
||||
// dev code
|
||||
buffer[2] = 0x03;
|
||||
buffer[3] = 0x04;
|
||||
|
||||
// firmware date
|
||||
buffer[4] = 0x20;
|
||||
buffer[5] = 0x08;
|
||||
buffer[6] = 0x08;
|
||||
buffer[7] = 0x29;
|
||||
|
||||
LOG(WII_IPC_HLE, "%s executes DVDLowInquiry (Buffer 0x%08x, 0x%x)", GetDeviceName().c_str(), _BufferOut, _BufferOutSize);
|
||||
|
||||
return 0x1;
|
||||
}
|
||||
break;
|
||||
|
||||
// DVDLowReadDiskID
|
||||
case 0x70:
|
||||
{
|
||||
// TODO - verify that this is correct
|
||||
VolumeHandler::ReadToPtr(Memory::GetPointer(_BufferOut), 0, _BufferOutSize);
|
||||
|
||||
LOG(WII_IPC_HLE, "%s executes DVDLowReadDiskID (Buffer 0x%08x, 0x%x)", GetDeviceName().c_str(), _BufferOut, _BufferOutSize);
|
||||
|
||||
return 0x1;
|
||||
}
|
||||
break;
|
||||
|
||||
// DVDLowRead
|
||||
// TODO - find out if 80, 8d, or and d0 need to do something specific
|
||||
case 0x80:
|
||||
case 0x8d:
|
||||
case 0xd0:
|
||||
case 0x71:
|
||||
{
|
||||
u32 Size = Memory::Read_U32(_BufferIn+0x04);
|
||||
@ -151,10 +188,30 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
|
||||
}
|
||||
break;
|
||||
|
||||
// DVDLowGetCoverReg - called by "Legend of Spyro"
|
||||
case 0x7a:
|
||||
// DVDLowWaitForCoverClose
|
||||
case 0x79:
|
||||
{
|
||||
Memory::Memset(_BufferOut, 0, _BufferOutSize);
|
||||
LOG(WII_IPC_HLE, "%s executes DVDLowWaitForCoverClose (Buffer 0x%08x, 0x%x)", GetDeviceName().c_str(), _BufferOut, _BufferOutSize);
|
||||
return 4;
|
||||
}
|
||||
break;
|
||||
|
||||
// DVDLowGetCoverReg - called by "Legend of Spyro"
|
||||
case 0x7a:
|
||||
{
|
||||
// HACK - swiching the 4th byte between 0 and 1 gets through this check
|
||||
Memory::Memset(_BufferOut, 0, _BufferOutSize);
|
||||
|
||||
u8* buffer = Memory::GetPointer(_BufferOut);
|
||||
buffer[3] = coverByte;
|
||||
|
||||
if(coverByte)
|
||||
coverByte = 0;
|
||||
else
|
||||
coverByte = 0x01;
|
||||
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -166,6 +223,25 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
|
||||
}
|
||||
break;
|
||||
|
||||
// DVDLowGetCoverStatus
|
||||
case 0x88:
|
||||
{
|
||||
Memory::Memset(_BufferOut, 0, _BufferOutSize);
|
||||
LOG(WII_IPC_HLE, "%s executes DVDLowGetCoverStatus (Buffer 0x%08x, 0x%x)", GetDeviceName().c_str(), _BufferOut, _BufferOutSize);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
// DVDLowReset
|
||||
case 0x8a:
|
||||
{
|
||||
Memory::Memset(_BufferOut, 0, _BufferOutSize);
|
||||
LOG(WII_IPC_HLE, "%s executes DVDLowReset (Buffer 0x%08x, 0x%x)", GetDeviceName().c_str(), _BufferOut, _BufferOutSize);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// DVDLowSeek
|
||||
case 0xab:
|
||||
{}
|
||||
@ -175,8 +251,15 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
|
||||
case 0xe3:
|
||||
{
|
||||
Memory::Memset(_BufferOut, 0, _BufferOutSize);
|
||||
u32 eject = Memory::Read_U32(_BufferIn + 0x04);
|
||||
|
||||
LOG(WII_IPC_HLE, "%s executes DVDLowStopMotor (Buffer 0x%08x, 0x%x)", GetDeviceName().c_str(), _BufferOut, _BufferOutSize);
|
||||
PanicAlert("Weird. Nobody should call DVDLowStopMotor.");
|
||||
|
||||
if(eject)
|
||||
{
|
||||
LOG(WII_IPC_HLE, "Eject disc", GetDeviceName().c_str(), _BufferOut, _BufferOutSize);
|
||||
// TODO: eject the disc
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -103,6 +103,7 @@ void SymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const char *name, int typ
|
||||
Symbol tf;
|
||||
tf.name = name;
|
||||
tf.type = type;
|
||||
tf.address = startAddr;
|
||||
if (tf.type == Symbol::SYMBOL_FUNCTION) {
|
||||
PPCAnalyst::AnalyzeFunction(startAddr, tf, size);
|
||||
checksumToFunction[tf.hash] = &(functions[startAddr]);
|
||||
|
@ -38,6 +38,16 @@ void SetVolumeName(const std::string& _rFullPath)
|
||||
g_pVolume = DiscIO::CreateVolumeFromFilename(_rFullPath);
|
||||
}
|
||||
|
||||
void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii)
|
||||
{
|
||||
if (g_pVolume)
|
||||
{
|
||||
delete g_pVolume;
|
||||
g_pVolume = NULL;
|
||||
}
|
||||
|
||||
g_pVolume = DiscIO::CreateVolumeFromDirectory(_rFullPath, _bIsWii);
|
||||
}
|
||||
|
||||
u32 Read32(u64 _Offset)
|
||||
{
|
||||
@ -52,7 +62,7 @@ u32 Read32(u64 _Offset)
|
||||
|
||||
bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength)
|
||||
{
|
||||
if (g_pVolume != NULL)
|
||||
if (g_pVolume != NULL && ptr)
|
||||
{
|
||||
g_pVolume->Read(_dwOffset, _dwLength, ptr);
|
||||
return true;
|
||||
|
@ -28,6 +28,8 @@ namespace VolumeHandler
|
||||
|
||||
void SetVolumeName(const std::string& _rFullPath);
|
||||
|
||||
void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii);
|
||||
|
||||
u32 Read32(u64 _Offset);
|
||||
|
||||
bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength);
|
||||
|
Reference in New Issue
Block a user