Merge pull request #1198 from LuigiBlood/64ddus

[64DD] USA and TOOL IPL support + USA Disk support
This commit is contained in:
zilmar 2016-09-02 10:09:47 +10:00 committed by GitHub
commit b0881e90af
7 changed files with 17 additions and 3 deletions

View File

@ -37,6 +37,7 @@ void CDMA::OnFirstDMA()
case CIC_NUS_6101: offset = +0x0318; break; case CIC_NUS_6101: offset = +0x0318; break;
case CIC_NUS_5167: offset = +0x0318; break; case CIC_NUS_5167: offset = +0x0318; break;
case CIC_NUS_8303: offset = +0x0318; break; case CIC_NUS_8303: offset = +0x0318; break;
case CIC_NUS_DDUS: offset = +0x0318; break;
case CIC_UNKNOWN: case CIC_UNKNOWN:
case CIC_NUS_6102: offset = +0x0318; break; case CIC_NUS_6102: offset = +0x0318; break;
case CIC_NUS_6103: offset = +0x0318; break; case CIC_NUS_6103: offset = +0x0318; break;

View File

@ -271,7 +271,7 @@ bool CN64System::RunFileImage(const char * FileLoc)
WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc); WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc);
if (g_Rom->LoadN64Image(FileLoc)) if (g_Rom->LoadN64Image(FileLoc))
{ {
if (g_Rom->CicChipID() == CIC_NUS_8303) if (g_Rom->CicChipID() == CIC_NUS_8303 || g_Rom->CicChipID() == CIC_NUS_DDUS)
{ {
//64DD IPL //64DD IPL
if (g_DDRom == NULL) if (g_DDRom == NULL)
@ -356,7 +356,7 @@ bool CN64System::RunFileImageIPL(const char * FileLoc)
WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc); WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc);
if (g_DDRom->LoadN64ImageIPL(FileLoc)) if (g_DDRom->LoadN64ImageIPL(FileLoc))
{ {
if (g_DDRom->CicChipID() != CIC_NUS_8303) if (g_DDRom->CicChipID() != CIC_NUS_8303 && g_DDRom->CicChipID() != CIC_NUS_DDUS)
{ {
//If not 64DD IPL then it's wrong //If not 64DD IPL then it's wrong
WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc); WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc);
@ -885,6 +885,9 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
case CIC_NUS_5167: //64DD CONVERSION CIC case CIC_NUS_5167: //64DD CONVERSION CIC
m_Reg.m_GPR[22].DW = 0x00000000000000DD; m_Reg.m_GPR[22].DW = 0x00000000000000DD;
break; break;
case CIC_NUS_DDUS: //64DD US IPL CIC
m_Reg.m_GPR[22].DW = 0x00000000000000DE;
break;
case CIC_UNKNOWN: case CIC_UNKNOWN:
case CIC_NUS_6102: case CIC_NUS_6102:
m_Reg.m_GPR[1].DW = 0x0000000000000001; m_Reg.m_GPR[1].DW = 0x0000000000000001;

View File

@ -115,6 +115,7 @@ void CN64Disk::SwapDiskImage(const char * FileLoc)
bool CN64Disk::IsValidDiskImage(uint8_t Test[4]) bool CN64Disk::IsValidDiskImage(uint8_t Test[4])
{ {
if (*((uint32_t *)&Test[0]) == 0x16D348E8) { return true; } if (*((uint32_t *)&Test[0]) == 0x16D348E8) { return true; }
else if (*((uint32_t *)&Test[0]) == 0x56EE6322) { return true; }
return false; return false;
} }
@ -248,6 +249,7 @@ void CN64Disk::ByteSwapDisk()
switch (*((uint32_t *)&m_DiskImage[0])) switch (*((uint32_t *)&m_DiskImage[0]))
{ {
case 0x16D348E8: case 0x16D348E8:
case 0x56EE6322:
for (count = 0; count < m_DiskFileSize; count += 4) for (count = 0; count < m_DiskFileSize; count += 4)
{ {
m_DiskImage[count] ^= m_DiskImage[count + 3]; m_DiskImage[count] ^= m_DiskImage[count + 3];
@ -259,6 +261,7 @@ void CN64Disk::ByteSwapDisk()
} }
break; break;
case 0xE848D316: break; case 0xE848D316: break;
case 0x2263EE56: break;
default: default:
g_Notify->DisplayError(stdstr_f("ByteSwapDisk: %X", m_DiskImage[0]).c_str()); g_Notify->DisplayError(stdstr_f("ByteSwapDisk: %X", m_DiskImage[0]).c_str());
} }

View File

@ -288,6 +288,8 @@ CICChip CN64Rom::GetCicChipID(uint8_t * RomData, uint64_t * CRC)
case 0x000000D6D5BE5580: return CIC_NUS_6106; case 0x000000D6D5BE5580: return CIC_NUS_6106;
case 0x000001053BC19870: return CIC_NUS_5167; //64DD CONVERSION CIC case 0x000001053BC19870: return CIC_NUS_5167; //64DD CONVERSION CIC
case 0x000000D2E53EF008: return CIC_NUS_8303; //64DD IPL case 0x000000D2E53EF008: return CIC_NUS_8303; //64DD IPL
case 0x000000D2E53EF39F: return CIC_NUS_8303; //64DD IPL TOOL
case 0x000000D2E53E5DDA: return CIC_NUS_DDUS; //64DD IPL US (different CIC)
default: default:
return CIC_UNKNOWN; return CIC_UNKNOWN;
} }

View File

@ -65,7 +65,7 @@ enum CICChip
{ {
CIC_UNKNOWN = -1, CIC_NUS_6101 = 1, CIC_NUS_6102 = 2, CIC_NUS_6103 = 3, CIC_UNKNOWN = -1, CIC_NUS_6101 = 1, CIC_NUS_6102 = 2, CIC_NUS_6103 = 3,
CIC_NUS_6104 = 4, CIC_NUS_6105 = 5, CIC_NUS_6106 = 6, CIC_NUS_5167 = 7, CIC_NUS_6104 = 4, CIC_NUS_6105 = 5, CIC_NUS_6106 = 6, CIC_NUS_5167 = 7,
CIC_NUS_8303 = 8 CIC_NUS_8303 = 8, CIC_NUS_DDUS = 9
}; };
enum Country enum Country

View File

@ -735,6 +735,10 @@ void CRomBrowser::RomList_GetDispInfo(uint32_t pnmh)
{ {
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-5167", pRomInfo->CicChip); swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-5167", pRomInfo->CicChip);
} }
else if (pRomInfo->CicChip == CIC_NUS_DDUS)
{
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-????", pRomInfo->CicChip);
}
else else
{ {
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-610%d", pRomInfo->CicChip); swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-610%d", pRomInfo->CicChip);

View File

@ -117,6 +117,7 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
case CIC_UNKNOWN: CicChip = L"Unknown"; break; case CIC_UNKNOWN: CicChip = L"Unknown"; break;
case CIC_NUS_8303: CicChip = L"CIC-NUS-8303"; break; case CIC_NUS_8303: CicChip = L"CIC-NUS-8303"; break;
case CIC_NUS_5167: CicChip = L"CIC-NUS-5167"; break; case CIC_NUS_5167: CicChip = L"CIC-NUS-5167"; break;
case CIC_NUS_DDUS: CicChip = L"CIC-NUS-????"; break;
default: CicChip = stdstr_f("CIC-NUS-610%d", _this->m_pRomInfo->CicChipID()).ToUTF16(); break; default: CicChip = stdstr_f("CIC-NUS-610%d", _this->m_pRomInfo->CicChipID()).ToUTF16(); break;
} }
SetDlgItemTextW(hDlg, IDC_INFO_CIC, CicChip.c_str()); SetDlgItemTextW(hDlg, IDC_INFO_CIC, CicChip.c_str());