Add Aleck64 CIC, rename 64DD IPL Dev CIC (#2120)
* Add CIC-NUS-5101 support (Aleck64) * Rename CIC_NUS_DDTL (64DD IPL Dev) to CIC_NUS_8401 (actual chip ID) And properly support it in the Rom Browser * Forgot to check nullptr before putting Aleck64 CRC info
This commit is contained in:
parent
1606b23ef9
commit
8b90894d0f
|
@ -29,12 +29,13 @@ void CDMA::OnFirstDMA()
|
||||||
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_NUS_DDUS: offset = +0x0318; break;
|
||||||
case CIC_NUS_DDTL: offset = +0x0318; break;
|
case CIC_NUS_8401: 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;
|
||||||
case CIC_NUS_6105: offset = +0x03F0; break;
|
case CIC_NUS_6105: offset = +0x03F0; break;
|
||||||
case CIC_NUS_6106: offset = +0x0318; break;
|
case CIC_NUS_6106: offset = +0x0318; break;
|
||||||
|
case CIC_NUS_5101: offset = +0x0318; break;
|
||||||
default:
|
default:
|
||||||
g_Notify->DisplayError(stdstr_f("Unhandled CicChip(%d) in first DMA", g_Rom->CicChipID()).c_str());
|
g_Notify->DisplayError(stdstr_f("Unhandled CicChip(%d) in first DMA", g_Rom->CicChipID()).c_str());
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -262,10 +262,12 @@ void CN64Rom::ByteSwapRom()
|
||||||
CICChip CN64Rom::GetCicChipID(uint8_t * RomData, uint64_t * CRC)
|
CICChip CN64Rom::GetCicChipID(uint8_t * RomData, uint64_t * CRC)
|
||||||
{
|
{
|
||||||
uint64_t crc = 0;
|
uint64_t crc = 0;
|
||||||
|
uint64_t crcAleck64 = 0;
|
||||||
int32_t count;
|
int32_t count;
|
||||||
|
|
||||||
for (count = 0x40; count < 0x1000; count += 4)
|
for (count = 0x40; count < 0x1000; count += 4)
|
||||||
{
|
{
|
||||||
|
if (count == 0xC00) crcAleck64 = crc; //From 0x40 to 0xC00 (Aleck64)
|
||||||
crc += *(uint32_t *)(RomData + count);
|
crc += *(uint32_t *)(RomData + count);
|
||||||
}
|
}
|
||||||
if (CRC != nullptr) { *CRC = crc; }
|
if (CRC != nullptr) { *CRC = crc; }
|
||||||
|
@ -280,9 +282,15 @@ 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_DDTL; // 64DD IPL tool
|
case 0x000000D2E53EF39F: return CIC_NUS_8401; // 64DD IPL tool
|
||||||
case 0x000000D2E53E5DDA: return CIC_NUS_DDUS; // 64DD IPL US (different CIC)
|
case 0x000000D2E53E5DDA: return CIC_NUS_DDUS; // 64DD IPL US (different CIC)
|
||||||
default:
|
default:
|
||||||
|
//Aleck64 CIC
|
||||||
|
if (crcAleck64 == 0x000000A5F80BF620)
|
||||||
|
{
|
||||||
|
if (CRC != nullptr) { *CRC = crcAleck64; }
|
||||||
|
return CIC_NUS_5101;
|
||||||
|
}
|
||||||
return CIC_UNKNOWN;
|
return CIC_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,6 +332,8 @@ void CN64Rom::CalculateRomCrc()
|
||||||
// 64DD IPL (USA) at=0x02E90EDD , s6=0xde
|
// 64DD IPL (USA) at=0x02E90EDD , s6=0xde
|
||||||
// 64DD TOOL IPL at=0x0260BCD5 , s6=0xdd
|
// 64DD TOOL IPL at=0x0260BCD5 , s6=0xdd
|
||||||
|
|
||||||
|
// CIC_NUS_5101 (Aleck64) at=0x6C078965 , s6=0xac
|
||||||
|
|
||||||
//v0 = 0xFFFFFFFF & (s6 * at) + 1;
|
//v0 = 0xFFFFFFFF & (s6 * at) + 1;
|
||||||
switch (m_CicChip)
|
switch (m_CicChip)
|
||||||
{
|
{
|
||||||
|
@ -334,13 +344,17 @@ void CN64Rom::CalculateRomCrc()
|
||||||
case CIC_NUS_6106: v0 = 0x1FEA617A; break;
|
case CIC_NUS_6106: v0 = 0x1FEA617A; break;
|
||||||
case CIC_NUS_DDUS: length = 0x000A0000; v0 = 0x861AE3A7; break;
|
case CIC_NUS_DDUS: length = 0x000A0000; v0 = 0x861AE3A7; break;
|
||||||
case CIC_NUS_8303: length = 0x000A0000; v0 = 0x8331D4CA; break;
|
case CIC_NUS_8303: length = 0x000A0000; v0 = 0x8331D4CA; break;
|
||||||
case CIC_NUS_DDTL: length = 0x000A0000; v0 = 0x0D8303E2; break;
|
case CIC_NUS_8401: length = 0x000A0000; v0 = 0x0D8303E2; break;
|
||||||
|
case CIC_NUS_5101: v0 = 0x95104FDD; break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProtectMemory(m_ROMImage, m_RomFileSize, MEM_READWRITE);
|
ProtectMemory(m_ROMImage, m_RomFileSize, MEM_READWRITE);
|
||||||
|
|
||||||
|
if (m_CicChip == CIC_NUS_5101 && (*(uint32_t*)(m_ROMImage + 0x8) == 0x80100400))
|
||||||
|
length = 0x003FE000;
|
||||||
|
|
||||||
v1 = 0;
|
v1 = 0;
|
||||||
t0 = 0;
|
t0 = 0;
|
||||||
t5 = 0x20;
|
t5 = 0x20;
|
||||||
|
@ -405,6 +419,11 @@ void CN64Rom::CalculateRomCrc()
|
||||||
a3 = 0xFFFFFFFF & (a3 * t2) + t3;
|
a3 = 0xFFFFFFFF & (a3 * t2) + t3;
|
||||||
s0 = 0xFFFFFFFF & (s0 * a2) + t4;
|
s0 = 0xFFFFFFFF & (s0 * a2) + t4;
|
||||||
}
|
}
|
||||||
|
else if (m_CicChip == CIC_NUS_5101)
|
||||||
|
{
|
||||||
|
a3 = 0xFFFFFFFF & (a3 ^ t2) + t3;
|
||||||
|
s0 = 0xFFFFFFFF & (s0 ^ a2) + t4;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a3 = a3 ^ t2 ^ t3;
|
a3 = a3 ^ t2 ^ t3;
|
||||||
|
@ -437,7 +456,7 @@ bool CN64Rom::IsLoadedRomDDIPL()
|
||||||
{
|
{
|
||||||
case CIC_NUS_8303:
|
case CIC_NUS_8303:
|
||||||
case CIC_NUS_DDUS:
|
case CIC_NUS_DDUS:
|
||||||
case CIC_NUS_DDTL:
|
case CIC_NUS_8401:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -340,7 +340,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
|
||||||
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
|
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
|
||||||
else if (g_DDRom->CicChipID() == CIC_NUS_DDUS)
|
else if (g_DDRom->CicChipID() == CIC_NUS_DDUS)
|
||||||
g_Settings->SaveString(File_DiskIPLUSAPath, FileLoc);
|
g_Settings->SaveString(File_DiskIPLUSAPath, FileLoc);
|
||||||
else if (g_DDRom->CicChipID() == CIC_NUS_DDTL)
|
else if (g_DDRom->CicChipID() == CIC_NUS_8401)
|
||||||
g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc);
|
g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
|
||||||
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
|
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
|
||||||
else if (g_DDRom->CicChipID() == CIC_NUS_DDUS)
|
else if (g_DDRom->CicChipID() == CIC_NUS_DDUS)
|
||||||
g_Settings->SaveString(File_DiskIPLUSAPath, FileLoc);
|
g_Settings->SaveString(File_DiskIPLUSAPath, FileLoc);
|
||||||
else if (g_DDRom->CicChipID() == CIC_NUS_DDTL)
|
else if (g_DDRom->CicChipID() == CIC_NUS_8401)
|
||||||
g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc);
|
g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc);
|
||||||
|
|
||||||
//g_Settings->SaveString(Game_File, FileLoc);
|
//g_Settings->SaveString(Game_File, FileLoc);
|
||||||
|
@ -502,7 +502,7 @@ bool CN64System::RunFileImage(const char * FileLoc)
|
||||||
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
|
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
|
||||||
else if (g_Rom->CicChipID() == CIC_NUS_DDUS)
|
else if (g_Rom->CicChipID() == CIC_NUS_DDUS)
|
||||||
g_Settings->SaveString(File_DiskIPLUSAPath, FileLoc);
|
g_Settings->SaveString(File_DiskIPLUSAPath, FileLoc);
|
||||||
else if (g_Rom->CicChipID() == CIC_NUS_DDTL)
|
else if (g_Rom->CicChipID() == CIC_NUS_8401)
|
||||||
g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc);
|
g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc);
|
||||||
}
|
}
|
||||||
RunLoadedImage();
|
RunLoadedImage();
|
||||||
|
@ -986,7 +986,7 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
|
||||||
// Start N64DD in reset state and motor not spinning
|
// Start N64DD in reset state and motor not spinning
|
||||||
m_Reg.ASIC_STATUS = DD_STATUS_RST_STATE | DD_STATUS_MTR_N_SPIN;
|
m_Reg.ASIC_STATUS = DD_STATUS_RST_STATE | DD_STATUS_MTR_N_SPIN;
|
||||||
m_Reg.ASIC_ID_REG = 0x00030000;
|
m_Reg.ASIC_ID_REG = 0x00030000;
|
||||||
if (g_DDRom && (g_DDRom->CicChipID() == CIC_NUS_DDTL || (g_Disk && g_Disk->GetCountry() == Country_Unknown)))
|
if (g_DDRom && (g_DDRom->CicChipID() == CIC_NUS_8401 || (g_Disk && g_Disk->GetCountry() == Country_Unknown)))
|
||||||
m_Reg.ASIC_ID_REG = 0x00040000;
|
m_Reg.ASIC_ID_REG = 0x00040000;
|
||||||
|
|
||||||
//m_Reg.REVISION_REGISTER = 0x00000511;
|
//m_Reg.REVISION_REGISTER = 0x00000511;
|
||||||
|
@ -1071,7 +1071,8 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
|
||||||
case CIC_NUS_5167:
|
case CIC_NUS_5167:
|
||||||
case CIC_NUS_8303:
|
case CIC_NUS_8303:
|
||||||
case CIC_NUS_DDUS:
|
case CIC_NUS_DDUS:
|
||||||
case CIC_NUS_DDTL:
|
case CIC_NUS_8401:
|
||||||
|
case CIC_NUS_5101:
|
||||||
default:
|
default:
|
||||||
// No specific values
|
// No specific values
|
||||||
break;
|
break;
|
||||||
|
@ -1088,13 +1089,16 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
|
||||||
m_Reg.m_GPR[22].DW = 0x000000000000003F;
|
m_Reg.m_GPR[22].DW = 0x000000000000003F;
|
||||||
break;
|
break;
|
||||||
case CIC_NUS_8303: // 64DD IPL CIC
|
case CIC_NUS_8303: // 64DD IPL CIC
|
||||||
case CIC_NUS_DDTL: // 64DD IPL tool CIC
|
case CIC_NUS_8401: // 64DD IPL tool CIC
|
||||||
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
|
case CIC_NUS_DDUS: // 64DD US IPL CIC
|
||||||
m_Reg.m_GPR[22].DW = 0x00000000000000DE;
|
m_Reg.m_GPR[22].DW = 0x00000000000000DE;
|
||||||
break;
|
break;
|
||||||
|
case CIC_NUS_5101: // Aleck64 CIC
|
||||||
|
m_Reg.m_GPR[22].DW = 0x00000000000000AC;
|
||||||
|
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;
|
||||||
|
|
|
@ -68,7 +68,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_DDUS = 9, CIC_NUS_DDTL = 10
|
CIC_NUS_8303 = 8, CIC_NUS_DDUS = 9, CIC_NUS_8401 = 10, CIC_NUS_5101 = 11
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Country
|
enum Country
|
||||||
|
|
|
@ -530,7 +530,7 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo)
|
||||||
pRomInfo->CRC1 = *(uint32_t *)(RomData + 0x10);
|
pRomInfo->CRC1 = *(uint32_t *)(RomData + 0x10);
|
||||||
pRomInfo->CRC2 = *(uint32_t *)(RomData + 0x14);
|
pRomInfo->CRC2 = *(uint32_t *)(RomData + 0x14);
|
||||||
pRomInfo->CicChip = CN64Rom::GetCicChipID(RomData);
|
pRomInfo->CicChip = CN64Rom::GetCicChipID(RomData);
|
||||||
if (pRomInfo->CicChip == CIC_NUS_8303 || pRomInfo->CicChip == CIC_NUS_DDUS || pRomInfo->CicChip == CIC_NUS_DDTL)
|
if (pRomInfo->CicChip == CIC_NUS_8303 || pRomInfo->CicChip == CIC_NUS_DDUS || pRomInfo->CicChip == CIC_NUS_8401)
|
||||||
{
|
{
|
||||||
pRomInfo->CRC1 = (*(uint16_t *)(RomData + 0x608) << 16) | *(uint16_t *)(RomData + 0x60C);
|
pRomInfo->CRC1 = (*(uint16_t *)(RomData + 0x608) << 16) | *(uint16_t *)(RomData + 0x60C);
|
||||||
pRomInfo->CRC2 = (*(uint16_t *)(RomData + 0x638) << 16) | *(uint16_t *)(RomData + 0x63C);
|
pRomInfo->CRC2 = (*(uint16_t *)(RomData + 0x638) << 16) | *(uint16_t *)(RomData + 0x63C);
|
||||||
|
|
|
@ -750,6 +750,14 @@ void CRomBrowser::RomList_GetDispInfo(uint32_t pnmh)
|
||||||
{
|
{
|
||||||
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-????");
|
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-????");
|
||||||
}
|
}
|
||||||
|
else if (pRomInfo->CicChip == CIC_NUS_8401)
|
||||||
|
{
|
||||||
|
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-8401");
|
||||||
|
}
|
||||||
|
else if (pRomInfo->CicChip == CIC_NUS_5101)
|
||||||
|
{
|
||||||
|
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-5101");
|
||||||
|
}
|
||||||
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);
|
||||||
|
|
|
@ -136,7 +136,7 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
|
||||||
{
|
{
|
||||||
case CIC_NUS_8303:
|
case CIC_NUS_8303:
|
||||||
case CIC_NUS_DDUS:
|
case CIC_NUS_DDUS:
|
||||||
case CIC_NUS_DDTL:
|
case CIC_NUS_8401:
|
||||||
SetDlgItemText(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", (*(uint16_t *)(RomHeader + 0x608) << 16) | *(uint16_t *)(RomHeader + 0x60C)).ToUTF16().c_str());
|
SetDlgItemText(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", (*(uint16_t *)(RomHeader + 0x608) << 16) | *(uint16_t *)(RomHeader + 0x60C)).ToUTF16().c_str());
|
||||||
SetDlgItemText(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", (*(uint16_t *)(RomHeader + 0x638) << 16) | *(uint16_t *)(RomHeader + 0x63C)).ToUTF16().c_str());
|
SetDlgItemText(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", (*(uint16_t *)(RomHeader + 0x638) << 16) | *(uint16_t *)(RomHeader + 0x63C)).ToUTF16().c_str());
|
||||||
break;
|
break;
|
||||||
|
@ -152,8 +152,9 @@ 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_5101: CicChip = L"CIC-NUS-5101"; break;
|
||||||
case CIC_NUS_DDUS: CicChip = L"CIC-NUS-????"; break;
|
case CIC_NUS_DDUS: CicChip = L"CIC-NUS-????"; break;
|
||||||
case CIC_NUS_DDTL: CicChip = L"CIC-NUS-????"; break;
|
case CIC_NUS_8401: CicChip = L"CIC-NUS-8401"; 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;
|
||||||
}
|
}
|
||||||
SetDlgItemText(hDlg, IDC_INFO_CIC, CicChip.c_str());
|
SetDlgItemText(hDlg, IDC_INFO_CIC, CicChip.c_str());
|
||||||
|
|
Loading…
Reference in New Issue