Project64: Add CN64Rom::IsPal

This commit is contained in:
zilmar 2020-10-12 15:01:28 +10:30
parent 0bff53e11c
commit f5c2c33149
6 changed files with 58 additions and 54 deletions

View File

@ -300,7 +300,7 @@ void DiskBMUpdate()
else else
{ {
//Read Data //Read Data
if (((g_Reg->ASIC_CUR_TK >> 16) & 0x1FFF) == 6 && g_Reg->ASIC_CUR_SECTOR == 0 && g_Disk->GetCountry() != Country::UnknownCountry) if (((g_Reg->ASIC_CUR_TK >> 16) & 0x1FFF) == 6 && g_Reg->ASIC_CUR_SECTOR == 0 && g_Disk->GetCountry() != Country_Unknown)
{ {
//Copy Protection if Retail Disk //Copy Protection if Retail Disk
g_Reg->ASIC_STATUS &= ~DD_STATUS_DATA_RQ; g_Reg->ASIC_STATUS &= ~DD_STATUS_DATA_RQ;

View File

@ -601,15 +601,15 @@ bool CN64System::SelectAndLoadFileImageIPL(Country country, bool combo)
LanguageStringID IPLROMError; LanguageStringID IPLROMError;
switch (country) switch (country)
{ {
case Country::Japan: case Country_Japan:
IPLROMPathSetting = File_DiskIPLPath; IPLROMPathSetting = File_DiskIPLPath;
IPLROMError = MSG_IPL_REQUIRED; IPLROMError = MSG_IPL_REQUIRED;
break; break;
case Country::USA: case Country_NorthAmerica:
IPLROMPathSetting = File_DiskIPLUSAPath; IPLROMPathSetting = File_DiskIPLUSAPath;
IPLROMError = MSG_USA_IPL_REQUIRED; IPLROMError = MSG_USA_IPL_REQUIRED;
break; break;
case Country::UnknownCountry: case Country_Unknown:
default: default:
IPLROMPathSetting = File_DiskIPLTOOLPath; IPLROMPathSetting = File_DiskIPLTOOLPath;
IPLROMError = MSG_TOOL_IPL_REQUIRED; IPLROMError = MSG_TOOL_IPL_REQUIRED;
@ -990,7 +990,7 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
//Start 64DD in Reset State and Motor Not Spinning //Start 64DD 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::UnknownCountry))) if (g_DDRom && (g_DDRom->CicChipID() == CIC_NUS_DDTL || (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;
@ -1018,11 +1018,8 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
m_Reg.m_GPR[29].DW = 0xFFFFFFFFA4001FF0; m_Reg.m_GPR[29].DW = 0xFFFFFFFFA4001FF0;
m_Reg.m_GPR[30].DW = 0x0000000000000000; m_Reg.m_GPR[30].DW = 0x0000000000000000;
switch (g_Rom->GetCountry()) if (g_Rom->IsPal())
{ {
case Germany: case french: case Italian:
case Europe: case Spanish: case Australia:
case X_PAL: case Y_PAL:
switch (g_Rom->CicChipID()) switch (g_Rom->CicChipID())
{ {
case CIC_UNKNOWN: case CIC_UNKNOWN:
@ -1051,9 +1048,9 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
m_Reg.m_GPR[20].DW = 0x0000000000000000; m_Reg.m_GPR[20].DW = 0x0000000000000000;
m_Reg.m_GPR[23].DW = 0x0000000000000006; m_Reg.m_GPR[23].DW = 0x0000000000000006;
m_Reg.m_GPR[31].DW = 0xFFFFFFFFA4001554; m_Reg.m_GPR[31].DW = 0xFFFFFFFFA4001554;
break; }
case NTSC_BETA: case X_NTSC: case USA: case Japan: else
default: {
switch (g_Rom->CicChipID()) switch (g_Rom->CicChipID())
{ {
case CIC_UNKNOWN: case CIC_UNKNOWN:

View File

@ -816,12 +816,12 @@ Country CN64Disk::GetDiskCountryCode()
switch (*(uint32_t*)&GetDiskAddressSys()[0]) switch (*(uint32_t*)&GetDiskAddressSys()[0])
{ {
case DISK_COUNTRY_JPN: case DISK_COUNTRY_JPN:
return Japan; return Country_Japan;
case DISK_COUNTRY_USA: case DISK_COUNTRY_USA:
return USA; return Country_NorthAmerica;
case DISK_COUNTRY_DEV: case DISK_COUNTRY_DEV:
default: default:
return UnknownCountry; return Country_Unknown;
} }
} }

View File

@ -27,7 +27,7 @@ CN64Rom::CN64Rom() :
m_ROMImageBase(NULL), m_ROMImageBase(NULL),
m_RomFileSize(0), m_RomFileSize(0),
m_ErrorMsg(EMPTY_STRING), m_ErrorMsg(EMPTY_STRING),
m_Country(UnknownCountry), m_Country(Country_Unknown),
m_CicChip(CIC_UNKNOWN) m_CicChip(CIC_UNKNOWN)
{ {
} }
@ -849,18 +849,7 @@ void CN64Rom::SaveRomSettingID(bool temp)
g_Settings->SaveString(Game_GameName, m_RomName.c_str()); g_Settings->SaveString(Game_GameName, m_RomName.c_str());
g_Settings->SaveString(Game_IniKey, m_RomIdent.c_str()); g_Settings->SaveString(Game_IniKey, m_RomIdent.c_str());
g_Settings->SaveString(Game_UniqueSaveDir, stdstr_f("%s-%s", m_RomName.c_str(), m_MD5.c_str()).c_str()); g_Settings->SaveString(Game_UniqueSaveDir, stdstr_f("%s-%s", m_RomName.c_str(), m_MD5.c_str()).c_str());
g_Settings->SaveDword(Game_SystemType, IsPal() ? SYSTEM_PAL : SYSTEM_NTSC);
switch (GetCountry())
{
case Germany: case french: case Italian:
case Europe: case Spanish: case Australia:
case X_PAL: case Y_PAL:
g_Settings->SaveDword(Game_SystemType, SYSTEM_PAL);
break;
default:
g_Settings->SaveDword(Game_SystemType, SYSTEM_NTSC);
break;
}
} }
void CN64Rom::ClearRomSettingID() void CN64Rom::ClearRomSettingID()
@ -874,6 +863,23 @@ void CN64Rom::SetError(LanguageStringID ErrorMsg)
m_ErrorMsg = ErrorMsg; m_ErrorMsg = ErrorMsg;
} }
bool CN64Rom::IsPal()
{
switch (m_Country)
{
case Country_Germany:
case Country_French:
case Country_Italian:
case Country_Europe:
case Country_Spanish:
case Country_Australia:
case Country_EuropeanX_PAL:
case Country_EuropeanY_PAL:
return true;
}
return false;
}
void CN64Rom::UnallocateRomImage() void CN64Rom::UnallocateRomImage()
{ {
m_RomFile.Close(); m_RomFile.Close();

View File

@ -34,6 +34,7 @@ public:
const std::string & GetRomName() const { return m_RomName; } const std::string & GetRomName() const { return m_RomName; }
const std::string & GetFileName() const { return m_FileName; } const std::string & GetFileName() const { return m_FileName; }
Country GetCountry() const { return m_Country; } Country GetCountry() const { return m_Country; }
bool IsPal();
void UnallocateRomImage(); void UnallocateRomImage();
//Get a message id for the reason that you failed to load the rom //Get a message id for the reason that you failed to load the rom

View File

@ -123,19 +123,19 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
switch (RomHeader[0x3D]) switch (RomHeader[0x3D])
{ {
case NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break; case Country_NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break;
case X_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break; case Country_Asian_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break;
case Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break; case Country_Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break;
case USA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break; case Country_NorthAmerica: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break;
case french: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break; case Country_French: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break;
case Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break; case Country_Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break;
case Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break; case Country_Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break;
case Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break; case Country_Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break;
case Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break; case Country_Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break;
case Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break; case Country_Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break;
case X_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break; case Country_EuropeanX_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case Y_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break; case Country_EuropeanY_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case 0: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break; case Country_Unknown: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break;
default: default:
SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", RomHeader[0x3D], RomHeader[0x3D]).ToUTF16().c_str()); SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", RomHeader[0x3D], RomHeader[0x3D]).ToUTF16().c_str());
} }
@ -203,19 +203,19 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
switch (DiskHeader[0x00]) switch (DiskHeader[0x00])
{ {
case NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break; case Country_NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break;
case X_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break; case Country_Asian_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break;
case Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break; case Country_Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break;
case USA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break; case Country_NorthAmerica: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break;
case french: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break; case Country_French: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break;
case Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break; case Country_Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break;
case Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break; case Country_Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break;
case Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break; case Country_Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break;
case Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break; case Country_Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break;
case Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break; case Country_Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break;
case X_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break; case Country_EuropeanX_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case Y_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break; case Country_EuropeanY_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case 0: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break; case Country_Unknown: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break;
default: default:
SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", DiskHeader[0x03], DiskHeader[0x03]).ToUTF16().c_str()); SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", DiskHeader[0x03], DiskHeader[0x03]).ToUTF16().c_str());
} }