mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-01 10:20:33 +00:00
fixed problem with decrypting so the real size of an content was wrong
changed some panic alerts to asserts so you get them in debug only git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2431 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b7c398574f
commit
04e54f92d2
@ -112,14 +112,15 @@ bool ParseTMD(u8* pDataApp, u32 pDataAppSize, u8* pTicket, u8* pTMD)
|
|||||||
rContent.m_ContentID = Common::swap32(pTMD + 0x01e4 + 0x24*i);
|
rContent.m_ContentID = Common::swap32(pTMD + 0x01e4 + 0x24*i);
|
||||||
rContent.m_Index = Common::swap16(pTMD + 0x01e8 + 0x24*i);
|
rContent.m_Index = Common::swap16(pTMD + 0x01e8 + 0x24*i);
|
||||||
rContent.m_Type = Common::swap16(pTMD + 0x01ea + 0x24*i);
|
rContent.m_Type = Common::swap16(pTMD + 0x01ea + 0x24*i);
|
||||||
rContent.m_Size= (u32)ROUND_UP(Common::swap64(pTMD + 0x01ec + 0x24*i), 0x40);
|
rContent.m_Size= (u32)Common::swap64(pTMD + 0x01ec + 0x24*i);
|
||||||
rContent.m_pData = new u8[rContent.m_Size];
|
rContent.m_RoundedSize= ROUND_UP(rContent.m_Size, 0x40);
|
||||||
|
rContent.m_pData = new u8[rContent.m_RoundedSize];
|
||||||
|
|
||||||
memset(IV, 0, sizeof IV);
|
memset(IV, 0, sizeof IV);
|
||||||
memcpy(IV, pTMD + 0x01e8 + 0x24*i, 2);
|
memcpy(IV, pTMD + 0x01e8 + 0x24*i, 2);
|
||||||
AESDecode(DecryptTitleKey, IV, p, rContent.m_Size, rContent.m_pData);
|
AESDecode(DecryptTitleKey, IV, p, rContent.m_RoundedSize, rContent.m_pData);
|
||||||
|
|
||||||
p += rContent.m_Size;
|
p += rContent.m_RoundedSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -291,7 +292,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
|
|||||||
|
|
||||||
// DOL
|
// DOL
|
||||||
STileMetaContent& rContent = m_TileMetaContent[m_BootIndex];
|
STileMetaContent& rContent = m_TileMetaContent[m_BootIndex];
|
||||||
CDolLoader DolLoader(rContent.m_pData, rContent.m_Size);
|
CDolLoader DolLoader(rContent.m_pData, rContent.m_RoundedSize);
|
||||||
|
|
||||||
PC = DolLoader.GetEntryPoint() | 0x80000000;
|
PC = DolLoader.GetEntryPoint() | 0x80000000;
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ struct STileMetaContent
|
|||||||
u32 m_ContentID;
|
u32 m_ContentID;
|
||||||
u16 m_Index;
|
u16 m_Index;
|
||||||
u16 m_Type;
|
u16 m_Type;
|
||||||
u32 m_Size;
|
u32 m_Size;
|
||||||
|
u32 m_RoundedSize;
|
||||||
|
|
||||||
u8* m_pData;
|
u8* m_pData;
|
||||||
};
|
};
|
||||||
|
@ -45,7 +45,6 @@ void HLE_OSReport()
|
|||||||
std::string ReportMessage;
|
std::string ReportMessage;
|
||||||
GetStringVA(ReportMessage);
|
GetStringVA(ReportMessage);
|
||||||
|
|
||||||
|
|
||||||
// PanicAlert("(PC=%08x) OSReport: %s", LR, ReportMessage.c_str());
|
// PanicAlert("(PC=%08x) OSReport: %s", LR, ReportMessage.c_str());
|
||||||
|
|
||||||
LOG(OSREPORT,"(PC=%08x) OSReport: %s", LR, ReportMessage.c_str());
|
LOG(OSREPORT,"(PC=%08x) OSReport: %s", LR, ReportMessage.c_str());
|
||||||
|
@ -68,7 +68,6 @@
|
|||||||
namespace WII_IPC_HLE_Interface
|
namespace WII_IPC_HLE_Interface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
typedef std::map<u32, IWII_IPC_HLE_Device*> TDeviceMap;
|
typedef std::map<u32, IWII_IPC_HLE_Device*> TDeviceMap;
|
||||||
TDeviceMap g_DeviceMap;
|
TDeviceMap g_DeviceMap;
|
||||||
|
|
||||||
|
@ -46,8 +46,6 @@
|
|||||||
*/
|
*/
|
||||||
// =============
|
// =============
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WII_IPC_HLE_DEVICE_ES_H_
|
#ifndef _WII_IPC_HLE_DEVICE_ES_H_
|
||||||
#define _WII_IPC_HLE_DEVICE_ES_H_
|
#define _WII_IPC_HLE_DEVICE_ES_H_
|
||||||
|
|
||||||
@ -149,25 +147,6 @@ public:
|
|||||||
|
|
||||||
switch(Buffer.Parameter)
|
switch(Buffer.Parameter)
|
||||||
{
|
{
|
||||||
case IOCTL_ES_LAUNCH: // 0x08
|
|
||||||
{
|
|
||||||
_dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 2);
|
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
|
|
||||||
|
|
||||||
u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address);
|
|
||||||
u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4);
|
|
||||||
u32 devicetype =Memory::Read_U32(Buffer.InBuffer[1].m_Address+12);
|
|
||||||
u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16);
|
|
||||||
u16 access = Memory::Read_U16(Buffer.InBuffer[1].m_Address+24);
|
|
||||||
|
|
||||||
PanicAlert("IOCTL_ES_LAUNCH: src titleID %08x/%08x -> start %08x/%08x", TitleID>>32, TitleID, titleid>>32, titleid );
|
|
||||||
|
|
||||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IOCTL_ES_OPENCONTENT: // 0x09
|
case IOCTL_ES_OPENCONTENT: // 0x09
|
||||||
{
|
{
|
||||||
u32 CFD = AccessIdentID++;
|
u32 CFD = AccessIdentID++;
|
||||||
@ -262,11 +241,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_ES_GETTITLEDIR: // 0x1d
|
case IOCTL_ES_GETTITLEDIR: // 0x1d
|
||||||
{
|
{
|
||||||
/* I changed reading the TitleID from disc to reading from the
|
|
||||||
InBuffer, if it fails it's because of some kind of memory error
|
|
||||||
that we would want to fix anyway */
|
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
|
u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
|
||||||
_dbg_assert_msg_(WII_IPC_HLE, TitleID == GetCurrentTitleID(), "Get Dir from unkw title dir?? this can be okay...");
|
_dbg_assert_msg_(WII_IPC_HLE, TitleID == GetCurrentTitleID(), "Get Dir from unkw title dir?? this can be okay...");
|
||||||
|
|
||||||
@ -318,6 +293,47 @@ public:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case IOCTL_ES_GETTITLECOUNT:
|
||||||
|
{
|
||||||
|
_dbg_assert_msg_(WII_IPC_HLE, Buffer.NumberInBuffer == 0, "IOCTL_ES_GETTITLECOUNT has an in buffer");
|
||||||
|
_dbg_assert_msg_(WII_IPC_HLE, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTITLECOUNT has no out buffer");
|
||||||
|
_dbg_assert_msg_(WII_IPC_HLE, Buffer.PayloadBuffer[0].m_Size == 4, "IOCTL_ES_GETTITLECOUNT payload[0].size != 4");
|
||||||
|
|
||||||
|
Memory::Write_U64(0, Buffer.PayloadBuffer[0].m_Address);
|
||||||
|
|
||||||
|
LOGV(WII_IPC_ES, 0, "IOCTL_ES_GETTITLECOUNT: TODO - hardcoded to 0 !!!!");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
// ===============================================================================================
|
||||||
|
// unsupported functions
|
||||||
|
// ===============================================================================================
|
||||||
|
|
||||||
|
case IOCTL_ES_LAUNCH: // 0x08
|
||||||
|
{
|
||||||
|
_dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 2);
|
||||||
|
|
||||||
|
u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
|
||||||
|
|
||||||
|
u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address);
|
||||||
|
u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4);
|
||||||
|
u32 devicetype =Memory::Read_U32(Buffer.InBuffer[1].m_Address+12);
|
||||||
|
u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16);
|
||||||
|
u16 access = Memory::Read_U16(Buffer.InBuffer[1].m_Address+24);
|
||||||
|
|
||||||
|
PanicAlert("IOCTL_ES_LAUNCH: src titleID %08x/%08x -> start %08x/%08x \n"
|
||||||
|
"This means that dolphin tries to relaunch the WiiMenu or"
|
||||||
|
"launches code from the an URL. Both wont work and dolphin will prolly hang...",
|
||||||
|
TitleID>>32, TitleID, titleid>>32, titleid );
|
||||||
|
|
||||||
|
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IOCTL_ES_GETVIEWS:
|
case IOCTL_ES_GETVIEWS:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_HLE, Buffer.NumberInBuffer == 2, "IOCTL_ES_GETVIEWS no in buffer");
|
_dbg_assert_msg_(WII_IPC_HLE, Buffer.NumberInBuffer == 2, "IOCTL_ES_GETVIEWS no in buffer");
|
||||||
@ -327,18 +343,18 @@ public:
|
|||||||
u32 Count = Memory::Read_U32(Buffer.InBuffer[1].m_Address);
|
u32 Count = Memory::Read_U32(Buffer.InBuffer[1].m_Address);
|
||||||
|
|
||||||
_dbg_assert_msg_(WII_IPC_HLE, TitleID==0x0000000100000002, "IOCTL_ES_GETVIEWS: TitleID != 00000001/00000002");
|
_dbg_assert_msg_(WII_IPC_HLE, TitleID==0x0000000100000002, "IOCTL_ES_GETVIEWS: TitleID != 00000001/00000002");
|
||||||
|
|
||||||
/* write ticket data... hmmm
|
/* write ticket data... hmmm
|
||||||
typedef struct _tikview {
|
typedef struct _tikview {
|
||||||
u32 view;
|
u32 view;
|
||||||
u64 ticketid;
|
u64 ticketid;
|
||||||
u32 devicetype;
|
u32 devicetype;
|
||||||
u64 titleid;
|
u64 titleid;
|
||||||
u16 access_mask;
|
u16 access_mask;
|
||||||
u8 reserved[0x3c];
|
u8 reserved[0x3c];
|
||||||
u8 cidx_mask[0x40];
|
u8 cidx_mask[0x40];
|
||||||
u16 padding;
|
u16 padding;
|
||||||
tiklimit limits[8];
|
tiklimit limits[8];
|
||||||
} __attribute__((packed)) tikview;
|
} __attribute__((packed)) tikview;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -348,61 +364,41 @@ public:
|
|||||||
Memory::Write_U64(m_TitleID, Buffer.PayloadBuffer[0].m_Address+16);
|
Memory::Write_U64(m_TitleID, Buffer.PayloadBuffer[0].m_Address+16);
|
||||||
Memory::Write_U16(0x777, Buffer.PayloadBuffer[0].m_Address+24);
|
Memory::Write_U16(0x777, Buffer.PayloadBuffer[0].m_Address+24);
|
||||||
|
|
||||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||||
|
|
||||||
|
_dbg_assert_msg_(WII_IPC_HLE, 0, "IOCTL_ES_GETVIEWS: this looks really wrong...");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case IOCTL_ES_GETTMDVIEWCNT: // 0x14
|
|
||||||
{
|
|
||||||
PanicAlert("IOCTL_ES_GETTMDVIEWCNT: this looks really wrong...");
|
|
||||||
if(Buffer.NumberInBuffer)
|
|
||||||
u32 InBuffer = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
|
|
||||||
|
|
||||||
// Should we write something here?
|
|
||||||
//Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IOCTL_ES_GETCONSUMPTION: // (Input: 8 bytes, Output: 0 bytes, 4 bytes)
|
|
||||||
PanicAlert("IOCTL_ES_GETCONSUMPTION: this looks really wrong...");
|
|
||||||
//DumpCommands(Buffer.InBuffer[0].m_Address, Buffer.InBuffer[0].m_Size / 4,
|
|
||||||
// LogTypes::WII_IPC_NET);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes)
|
|
||||||
PanicAlert("IOCTL_ES_DIGETTICKETVIEW: this looks really wrong...");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IOCTL_ES_GETTITLECOUNT:
|
|
||||||
{
|
|
||||||
PanicAlert("IOCTL_ES_GETTITLECOUNT: this looks really wrong...");
|
|
||||||
|
|
||||||
u32 OutBuffer = Memory::Read_U32(Buffer.PayloadBuffer[0].m_Address);
|
|
||||||
|
|
||||||
Memory::Write_U32(0, OutBuffer);
|
|
||||||
|
|
||||||
LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es command:"
|
|
||||||
" IOCTL_ES_GETTITLECOUNT: 0x%x", OutBuffer);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IOCTL_ES_GETSTOREDTMDSIZE:
|
case IOCTL_ES_GETSTOREDTMDSIZE:
|
||||||
{
|
{
|
||||||
PanicAlert("IOCTL_ES_GETSTOREDTMDSIZE: this looks really wrong...");
|
_dbg_assert_msg_(WII_IPC_HLE, 0, "IOCTL_ES_GETSTOREDTMDSIZE: this looks really wrong...");
|
||||||
|
|
||||||
|
/* u64 TitleId = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
|
||||||
u64 TitleId = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
|
|
||||||
u32 OutBuffer = Memory::Read_U32(Buffer.PayloadBuffer[0].m_Address);
|
u32 OutBuffer = Memory::Read_U32(Buffer.PayloadBuffer[0].m_Address);
|
||||||
|
|
||||||
Memory::Write_U32(0, OutBuffer);
|
Memory::Write_U32(0, OutBuffer);
|
||||||
printf("ES_GetStoredTmdSize(%llx)\n", TitleId);
|
printf("ES_GetStoredTmdSize(%llx)\n", TitleId);
|
||||||
LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es command:"
|
LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es command:"
|
||||||
" IOCTL_ES_GETSTOREDTMDSIZE: 0x%x", OutBuffer);
|
" IOCTL_ES_GETSTOREDTMDSIZE: 0x%x", OutBuffer);*/
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IOCTL_ES_GETTMDVIEWCNT: // 0x14
|
||||||
|
_dbg_assert_msg_(WII_IPC_HLE, 0, "IOCTL_ES_GETTMDVIEWCNT: this looks really wrong...");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IOCTL_ES_GETCONSUMPTION: // (Input: 8 bytes, Output: 0 bytes, 4 bytes)
|
||||||
|
_dbg_assert_msg_(WII_IPC_HLE, 0, "IOCTL_ES_GETCONSUMPTION: this looks really wrong...");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes)
|
||||||
|
_dbg_assert_msg_(WII_IPC_HLE, 0, "IOCTL_ES_DIGETTICKETVIEW: this looks really wrong...");
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
_dbg_assert_msg_(WII_IPC_HLE, 0, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter);
|
_dbg_assert_msg_(WII_IPC_HLE, 0, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user