This commit is contained in:
zilmar 2020-10-22 12:41:36 +10:30
commit f3fc84b569
17 changed files with 223 additions and 170 deletions

View File

@ -5872,6 +5872,9 @@ SMM-TLB=0
Self Texture=1 Self Texture=1
RDRAM Size=8 RDRAM Size=8
[THE LEGEND OF ZELDA-C:45]
Alt Identifier=EC7011B7-7616D72B-C:45
[EC7011B7-7616D72B-C:45] [EC7011B7-7616D72B-C:45]
Good Name=The Legend of Zelda - Ocarina of Time (U) (V1.0) Good Name=The Legend of Zelda - Ocarina of Time (U) (V1.0)
Internal Name=THE LEGEND OF ZELDA Internal Name=THE LEGEND OF ZELDA

View File

@ -869,7 +869,7 @@ void CIniFileBase::GetVectorOfSections(SectionList & sections)
for (FILELOC::const_iterator iter = m_SectionsPos.begin(); iter != m_SectionsPos.end(); iter++) for (FILELOC::const_iterator iter = m_SectionsPos.begin(); iter != m_SectionsPos.end(); iter++)
{ {
sections.push_back(iter->first); sections.insert(iter->first);
} }
} }

View File

@ -10,13 +10,14 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <list> #include <list>
#include <set>
#include <memory> #include <memory>
class CIniFileBase class CIniFileBase
{ {
public: public:
typedef std::map<std::string, std::string> KeyValueData; typedef std::map<std::string, std::string> KeyValueData;
typedef std::vector<std::string> SectionList; typedef std::set<std::string> SectionList;
typedef std::list<std::string> strlist; typedef std::list<std::string> strlist;
typedef std::pair<const std::string *, const std::string *> KeyValueItem; typedef std::pair<const std::string *, const std::string *> KeyValueItem;
typedef std::vector<KeyValueItem> KeyValueVector; typedef std::vector<KeyValueItem> KeyValueVector;

View File

@ -70,9 +70,9 @@ void SplitFile(const char * FileName, const char * Target)
CIniFile CheatIniFile(FileName); CIniFile CheatIniFile(FileName);
CheatIniFile.GetVectorOfSections(Sections); CheatIniFile.GetVectorOfSections(Sections);
for (size_t i = 0, n = Sections.size(); i < n; i++) for (CIniFile::SectionList::const_iterator SectionItr = Sections.begin(); SectionItr != Sections.end(); SectionItr++)
{ {
const char * Section = Sections[i].c_str(); const char * Section = SectionItr->c_str();
CIniFile::KeyValueData data; CIniFile::KeyValueData data;
CheatIniFile.GetKeyValueData(Section, data); CheatIniFile.GetKeyValueData(Section, data);
@ -136,9 +136,9 @@ void RegionSection(CFile &TargetIniFile, Files &files, const char * Region, cons
bool found = false; bool found = false;
stdstr_f searchStr(":%s", RegionCode); stdstr_f searchStr(":%s", RegionCode);
for (size_t i = 0, n = Sections.size(); i < n; i++) for (CIniFile::SectionList::const_iterator SectionItr = Sections.begin(); SectionItr != Sections.end(); SectionItr++)
{ {
const char * Section = Sections[i].c_str(); const char * Section = SectionItr->c_str();
const char * pos = strstr(Section, searchStr.c_str()); const char * pos = strstr(Section, searchStr.c_str());
if (pos == NULL) if (pos == NULL)
{ {
@ -153,9 +153,9 @@ void RegionSection(CFile &TargetIniFile, Files &files, const char * Region, cons
continue; continue;
} }
for (size_t i = 0, n = Sections.size(); i < n; i++) for (CIniFile::SectionList::const_iterator SectionItr = Sections.begin(); SectionItr != Sections.end(); SectionItr++)
{ {
const char * Section = Sections[i].c_str(); const char * Section = SectionItr->c_str();
CIniFile::KeyValueData data; CIniFile::KeyValueData data;
GameIniFile.GetKeyValueData(Section, data); GameIniFile.GetKeyValueData(Section, data);
@ -200,9 +200,9 @@ void JoinFile(const char * Directory, const char * Target)
CIniFile::SectionList Sections; CIniFile::SectionList Sections;
GameIniFile.GetVectorOfSections(Sections); GameIniFile.GetVectorOfSections(Sections);
for (size_t i = 0, n = Sections.size(); i < n; i++) for (CIniFile::SectionList::const_iterator SectionItr = Sections.begin(); SectionItr != Sections.end(); SectionItr++)
{ {
const char * Section = Sections[i].c_str(); const char * Section = SectionItr->c_str();
stdstr Name = GameIniFile.GetString(Section, "Name", Section); stdstr Name = GameIniFile.GetString(Section, "Name", Section);
Name.Trim("\t ="); Name.Trim("\t =");
if (Name.size() > 0) if (Name.size() > 0)
@ -282,9 +282,9 @@ void UpdateNames(const char* Directory, const char* RdbFile)
CIniFile::SectionList Sections; CIniFile::SectionList Sections;
CheatFile.GetVectorOfSections(Sections); CheatFile.GetVectorOfSections(Sections);
CheatFile.SetCustomSort(CustomSortData); CheatFile.SetCustomSort(CustomSortData);
for (size_t i = 0, n = Sections.size(); i < n; i++) for (CIniFile::SectionList::const_iterator SectionItr = Sections.begin(); SectionItr != Sections.end(); SectionItr++)
{ {
const char * Section = Sections[i].c_str(); const char * Section = SectionItr->c_str();
std::string Name = RdbIni.GetString(Section, "Good Name", ""); std::string Name = RdbIni.GetString(Section, "Good Name", "");
if (Name.empty()) if (Name.empty())
{ {
@ -616,9 +616,9 @@ void convertGS(const char* Directory)
CIniFile::SectionList Sections; CIniFile::SectionList Sections;
CheatFile.GetVectorOfSections(Sections); CheatFile.GetVectorOfSections(Sections);
CheatFile.SetCustomSort(CustomSortData); CheatFile.SetCustomSort(CustomSortData);
for (size_t i = 0, n = Sections.size(); i < n; i++) for (CIniFile::SectionList::const_iterator SectionItr = Sections.begin(); SectionItr != Sections.end(); SectionItr++)
{ {
const char * Section = Sections[i].c_str(); const char * Section = SectionItr->c_str();
for (uint32_t cheat = 0; cheat < MaxCheats; cheat++) for (uint32_t cheat = 0; cheat < MaxCheats; cheat++)
{ {
std::string CheatEntry = CheatFile.GetString(Section, stdstr_f("Cheat%d", cheat).c_str(), ""); std::string CheatEntry = CheatFile.GetString(Section, stdstr_f("Cheat%d", cheat).c_str(), "");
@ -846,9 +846,9 @@ void ConvertNew(const char * Src, const char * Dest)
MaxCheats = 50000, MaxCheats = 50000,
}; };
for (size_t i = 0, n = Sections.size(); i < n; i++) for (CIniFile::SectionList::const_iterator SectionItr = Sections.begin(); SectionItr != Sections.end(); SectionItr++)
{ {
const char * Section = Sections[i].c_str(); const char * Section = SectionItr->c_str();
std::string GameName = SrcIniFile.GetString(Section, "Name", ""); std::string GameName = SrcIniFile.GetString(Section, "Name", "");
DstCheatFile.SetName(Section, GameName.c_str()); DstCheatFile.SetName(Section, GameName.c_str());
for (uint32_t cheat = 0; cheat < MaxCheats; cheat++) for (uint32_t cheat = 0; cheat < MaxCheats; cheat++)

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

@ -221,9 +221,14 @@ void CN64Disk::SaveDiskSettingID(bool temp)
switch (GetCountry()) switch (GetCountry())
{ {
case Germany: case french: case Italian: case Country_Germany:
case Europe: case Spanish: case Australia: case Country_French:
case X_PAL: case Y_PAL: case Country_Italian:
case Country_Europe:
case Country_Spanish:
case Country_Australia:
case Country_EuropeanX_PAL:
case Country_EuropeanY_PAL:
g_Settings->SaveDword(Game_SystemType, SYSTEM_PAL); g_Settings->SaveDword(Game_SystemType, SYSTEM_PAL);
break; break;
default: default:
@ -811,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

@ -16,6 +16,7 @@
#include <Common/Platform.h> #include <Common/Platform.h>
#include <Common/MemoryManagement.h> #include <Common/MemoryManagement.h>
#include <Common/SmartPointer.h> #include <Common/SmartPointer.h>
#include <Common/IniFileClass.h>
#include <memory> #include <memory>
#ifdef _WIN32 #ifdef _WIN32
@ -27,7 +28,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)
{ {
} }
@ -654,6 +655,25 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
} }
m_RomIdent = stdstr_f("%08X-%08X-C:%X", CRC1, CRC2, m_ROMImage[0x3D]); m_RomIdent = stdstr_f("%08X-%08X-C:%X", CRC1, CRC2, m_ROMImage[0x3D]);
{
CIniFileBase::SectionList GameIdentifiers;
CIniFile RomDatabase(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
RomDatabase.GetVectorOfSections(GameIdentifiers);
if (GameIdentifiers.find(m_RomIdent.c_str()) == GameIdentifiers.end())
{
char InternalName[22] = { 0 };
memcpy(InternalName, (void *)(m_ROMImage + 0x20), 20);
CN64Rom::CleanRomName(InternalName);
std::string AltIdentifier = stdstr_f("%s-C:%X", stdstr(InternalName).Trim().ToUpper().c_str(), m_Country);
AltIdentifier = RomDatabase.GetString(AltIdentifier.c_str(), "Alt Identifier", "");
if (!AltIdentifier.empty())
{
m_RomIdent = AltIdentifier;
}
}
}
WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str()); WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str());
if (!LoadBootCodeOnly && g_Rom == this) if (!LoadBootCodeOnly && g_Rom == this)
@ -849,18 +869,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 +883,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

@ -30,10 +30,11 @@ public:
CICChip CicChipID(); CICChip CicChipID();
uint8_t * GetRomAddress() { return m_ROMImage; } uint8_t * GetRomAddress() { return m_ROMImage; }
uint32_t GetRomSize() const { return m_RomFileSize; } uint32_t GetRomSize() const { return m_RomFileSize; }
stdstr GetRomMD5() const { return m_MD5; } const std::string & GetRomMD5() const { return m_MD5; }
stdstr GetRomName() const { return m_RomName; } const std::string & GetRomName() const { return m_RomName; }
stdstr 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
@ -47,10 +48,11 @@ private:
bool AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnly); bool AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnly);
void ByteSwapRom(); void ByteSwapRom();
void SetError(LanguageStringID ErrorMsg); void SetError(LanguageStringID ErrorMsg);
static void NotificationCB(const char * Status, CN64Rom * _this);
void CalculateCicChip(); void CalculateCicChip();
void CalculateRomCrc(); void CalculateRomCrc();
static void NotificationCB(const char * Status, CN64Rom * _this);
//constant values //constant values
enum { ReadFromRomSection = 0x400000 }; enum { ReadFromRomSection = 0x400000 };

View File

@ -77,9 +77,27 @@ enum CICChip
enum Country enum Country
{ {
NTSC_BETA = 0x37, X_NTSC = 0x41, Germany = 0x44, USA = 0x45, french = 0x46, Italian = 0x49, Country_NTSC_BETA = 0x37,
Japan = 0x4A, Europe = 0x50, Spanish = 0x53, Australia = 0x55, X_PAL = 0x58, Y_PAL = 0x59, Country_Asian_NTSC = 0x41,
UnknownCountry = 0 Country_Brazilian = 0x42,
Country_Chinese = 0x43,
Country_Germany = 0x44,
Country_NorthAmerica = 0x45,
Country_French = 0x46,
Country_Gateway64_NTSC = 0x47,
Country_Dutch = 0x48,
Country_Italian = 0x49,
Country_Japan = 0x4A,
Country_Korean = 0x4B,
Country_Gateway64_PAL = 0x4C,
Country_Canadian = 0x4E,
Country_Europe = 0x50,
Country_Spanish = 0x53,
Country_Australia = 0x55,
Country_Scandinavian = 0x57,
Country_EuropeanX_PAL = 0x58,
Country_EuropeanY_PAL = 0x59,
Country_Unknown = 0
}; };
enum PROFILE_TIMERS enum PROFILE_TIMERS

View File

@ -59,6 +59,10 @@ CRomList::CRomList() :
#endif #endif
g_Settings->RegisterChangeCB(RomList_GameDir, this, (CSettings::SettingChangedFunc)RefreshSettings); g_Settings->RegisterChangeCB(RomList_GameDir, this, (CSettings::SettingChangedFunc)RefreshSettings);
} }
if (m_RomIniFile)
{
m_RomIniFile->GetVectorOfSections(m_GameIdentifiers);
}
WriteTrace(TraceRomList, TraceVerbose, "Done"); WriteTrace(TraceRomList, TraceVerbose, "Done");
} }
@ -148,11 +152,11 @@ void CRomList::AddRomToList(const char * RomLocation)
void CRomList::FillRomList(strlist & FileList, const char * Directory) void CRomList::FillRomList(strlist & FileList, const char * Directory)
{ {
WriteTrace(TraceRomList, TraceDebug, "Start (m_GameDir = %s, Directory: %s)", (const char *)m_GameDir, Directory); WriteTrace(TraceRomList, TraceDebug, "Start (m_GameDir = %s, Directory: %s)", (const char *)m_GameDir, Directory);
CPath SearchPath((const char *)m_GameDir, "*"); CPath SearchDir((const char *)m_GameDir, "*");
SearchPath.AppendDirectory(Directory); SearchDir.AppendDirectory(Directory);
WriteTrace(TraceRomList, TraceVerbose, "SearchPath: %s", (const char *)SearchPath); WriteTrace(TraceRomList, TraceVerbose, "SearchPath: %s", (const char *)SearchPath);
if (!SearchPath.FindFirst(CPath::FIND_ATTRIBUTE_ALLFILES)) if (!SearchDir.FindFirst(CPath::FIND_ATTRIBUTE_ALLFILES))
{ {
WriteTrace(TraceRomList, TraceVerbose, "No files found"); WriteTrace(TraceRomList, TraceVerbose, "No files found");
WriteTrace(TraceRomList, TraceDebug, "Done (Directory: %s)", Directory); WriteTrace(TraceRomList, TraceDebug, "Done (Directory: %s)", Directory);
@ -168,20 +172,20 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
break; break;
} }
if (SearchPath.IsDirectory()) if (SearchDir.IsDirectory())
{ {
if (g_Settings->LoadBool(RomList_GameDirRecursive)) if (g_Settings->LoadBool(RomList_GameDirRecursive))
{ {
CPath CurrentDir(Directory); CPath CurrentDir(Directory);
CurrentDir.AppendDirectory(SearchPath.GetLastDirectory().c_str()); CurrentDir.AppendDirectory(SearchDir.GetLastDirectory().c_str());
FillRomList(FileList, CurrentDir); FillRomList(FileList, CurrentDir);
} }
continue; continue;
} }
AddFileNameToList(FileList, Directory, SearchPath); AddFileNameToList(FileList, Directory, SearchDir);
stdstr Extension = stdstr(SearchPath.GetExtension()).ToLower(); stdstr Extension = stdstr(SearchDir.GetExtension()).ToLower();
for (uint8_t i = 0; i < sizeof(ROM_extensions) / sizeof(ROM_extensions[0]); i++) for (uint8_t i = 0; i < sizeof(ROM_extensions) / sizeof(ROM_extensions[0]); i++)
{ {
if (Extension != ROM_extensions[i]) if (Extension != ROM_extensions[i])
@ -191,7 +195,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
WriteTrace(TraceRomList, TraceVerbose, "File has matching extension: \"%s\"", ROM_extensions[i]); WriteTrace(TraceRomList, TraceVerbose, "File has matching extension: \"%s\"", ROM_extensions[i]);
if (Extension != "7z") if (Extension != "7z")
{ {
AddRomToList(SearchPath); AddRomToList(SearchDir);
} }
#ifdef _WIN32 #ifdef _WIN32
else else
@ -199,7 +203,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
WriteTrace(TraceRomList, TraceVerbose, "Looking at contents of 7z file"); WriteTrace(TraceRomList, TraceVerbose, "Looking at contents of 7z file");
try try
{ {
C7zip ZipFile(SearchPath); C7zip ZipFile(SearchDir);
if (!ZipFile.OpenSuccess()) if (!ZipFile.OpenSuccess())
{ {
continue; continue;
@ -322,7 +326,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
#endif #endif
break; break;
} }
} while (SearchPath.FindNext()); } while (SearchDir.FindNext());
#ifdef _WIN32 #ifdef _WIN32
m_ZipIniFile->FlushChanges(); m_ZipIniFile->FlushChanges();
#endif #endif
@ -582,9 +586,17 @@ void CRomList::FillRomExtensionInfo(ROM_INFO * pRomInfo)
strcpy(pRomInfo->Name, "#321#"); strcpy(pRomInfo->Name, "#321#");
strcpy(pRomInfo->Status, "Unknown"); strcpy(pRomInfo->Status, "Unknown");
//Get File Identifier
char Identifier[100]; char Identifier[100];
sprintf(Identifier, "%08X-%08X-C:%X", pRomInfo->CRC1, pRomInfo->CRC2, pRomInfo->Country); sprintf(Identifier, "%08X-%08X-C:%X", pRomInfo->CRC1, pRomInfo->CRC2, pRomInfo->Country);
if (m_GameIdentifiers.find(Identifier) == m_GameIdentifiers.end())
{
std::string AltIdentifier = stdstr_f("%s-C:%X", stdstr(pRomInfo->InternalName).Trim().ToUpper().c_str(), pRomInfo->Country);
AltIdentifier = m_RomIniFile->GetString(AltIdentifier.c_str(), "Alt Identifier", "");
if (!AltIdentifier.empty())
{
strcpy(Identifier, AltIdentifier.c_str());
}
}
//Rom Notes //Rom Notes
strncpy(pRomInfo->UserNotes, m_NotesIniFile->GetString(Identifier, "Note", "").c_str(), sizeof(pRomInfo->UserNotes) / sizeof(char)); strncpy(pRomInfo->UserNotes, m_NotesIniFile->GetString(Identifier, "Note", "").c_str(), sizeof(pRomInfo->UserNotes) / sizeof(char));

View File

@ -95,6 +95,7 @@ private:
CIniFile * m_ZipIniFile; CIniFile * m_ZipIniFile;
#endif #endif
CThread m_RefreshThread; CThread m_RefreshThread;
CIniFileBase::SectionList m_GameIdentifiers;
#define DISKSIZE_MAME 0x0435B0C0 #define DISKSIZE_MAME 0x0435B0C0
#define DISKSIZE_SDK 0x03DEC800 #define DISKSIZE_SDK 0x03DEC800

View File

@ -121,9 +121,9 @@ void CSettingTypeApplication::ResetAll()
} }
CIniFile::SectionList sections; CIniFile::SectionList sections;
m_SettingsIniFile->GetVectorOfSections(sections); m_SettingsIniFile->GetVectorOfSections(sections);
for (size_t i = 0; i < sections.size(); i++) for (CIniFile::SectionList::const_iterator itr = sections.begin(); itr != sections.end(); itr++)
{ {
m_SettingsIniFile->DeleteSection(sections[i].c_str()); m_SettingsIniFile->DeleteSection(itr->c_str());
} }
} }

View File

@ -119,10 +119,8 @@
<ClCompile Include="UserInterface\WTLControls\wtl-BitmapPicture.cpp" /> <ClCompile Include="UserInterface\WTLControls\wtl-BitmapPicture.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="DiscordRPC.h" />
<ClInclude Include="UserInterface\Debugger\CPULog.h" /> <ClInclude Include="UserInterface\Debugger\CPULog.h" />
<ClInclude Include="UserInterface\Debugger\Debugger-CPULogView.h" /> <ClInclude Include="UserInterface\Debugger\Debugger-CPULogView.h" />
<ClInclude Include="N64System\Debugger\OpInfo.h" />
<ClInclude Include="N64System.h" /> <ClInclude Include="N64System.h" />
<ClInclude Include="Settings\GuiSettings.h" /> <ClInclude Include="Settings\GuiSettings.h" />
<ClInclude Include="Settings\NotificationSettings.h" /> <ClInclude Include="Settings\NotificationSettings.h" />
@ -158,7 +156,6 @@
<ClInclude Include="UserInterface\Debugger\ScriptHook.h" /> <ClInclude Include="UserInterface\Debugger\ScriptHook.h" />
<ClInclude Include="UserInterface\Debugger\ScriptInstance.h" /> <ClInclude Include="UserInterface\Debugger\ScriptInstance.h" />
<ClInclude Include="UserInterface\Debugger\ScriptSystem.h" /> <ClInclude Include="UserInterface\Debugger\ScriptSystem.h" />
<ClInclude Include="UserInterface\Debugger\stdafx.h" />
<ClInclude Include="UserInterface\Debugger\Symbols.h" /> <ClInclude Include="UserInterface\Debugger\Symbols.h" />
<ClInclude Include="UserInterface\EnhancementConfig.h" /> <ClInclude Include="UserInterface\EnhancementConfig.h" />
<ClInclude Include="UserInterface\MainWindow.h" /> <ClInclude Include="UserInterface\MainWindow.h" />

View File

@ -356,9 +356,6 @@
<ClInclude Include="UserInterface\SupportWindow.h"> <ClInclude Include="UserInterface\SupportWindow.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="N64System\Debugger\OpInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UserInterface\WTLControls\TooltipDialog.h"> <ClInclude Include="UserInterface\WTLControls\TooltipDialog.h">
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter> <Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
</ClInclude> </ClInclude>
@ -431,9 +428,6 @@
<ClInclude Include="UserInterface\Debugger\ScriptSystem.h"> <ClInclude Include="UserInterface\Debugger\ScriptSystem.h">
<Filter>Header Files\User Interface Headers\Debugger Headers</Filter> <Filter>Header Files\User Interface Headers\Debugger Headers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="UserInterface\Debugger\stdafx.h">
<Filter>Header Files\User Interface Headers\Debugger Headers</Filter>
</ClInclude>
<ClInclude Include="UserInterface\Debugger\Symbols.h"> <ClInclude Include="UserInterface\Debugger\Symbols.h">
<Filter>Header Files\User Interface Headers\Debugger Headers</Filter> <Filter>Header Files\User Interface Headers\Debugger Headers</Filter>
</ClInclude> </ClInclude>
@ -464,9 +458,6 @@
<ClInclude Include="UserInterface\Settings\SettingsPage-DiskDrive.h"> <ClInclude Include="UserInterface\Settings\SettingsPage-DiskDrive.h">
<Filter>Header Files\User Interface Headers\Settings Header</Filter> <Filter>Header Files\User Interface Headers\Settings Header</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="DiscordRPC.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UserInterface\WTLControls\HexEditCtrl.h"> <ClInclude Include="UserInterface\WTLControls\HexEditCtrl.h">
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter> <Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
</ClInclude> </ClInclude>

View File

@ -103,12 +103,12 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
SetDlgItemTextW(hDlg, IDC_CIC_CHIP, wGS(INFO_CIC_CHIP_TEXT).c_str()); SetDlgItemTextW(hDlg, IDC_CIC_CHIP, wGS(INFO_CIC_CHIP_TEXT).c_str());
SetDlgItemTextW(hDlg, IDC_CLOSE_BUTTON, wGS(BOTTOM_CLOSE).c_str()); SetDlgItemTextW(hDlg, IDC_CLOSE_BUTTON, wGS(BOTTOM_CLOSE).c_str());
SetDlgItemTextW(hDlg, IDC_INFO_ROMNAME, _this->m_pRomInfo->GetRomName().ToUTF16(stdstr::CODEPAGE_932).c_str()); SetDlgItemTextW(hDlg, IDC_INFO_ROMNAME, stdstr(_this->m_pRomInfo->GetRomName()).ToUTF16(stdstr::CODEPAGE_932).c_str());
SetDlgItemTextW(hDlg, IDC_INFO_FILENAME, stdstr(CPath(_this->m_pRomInfo->GetFileName()).GetNameExtension()).ToUTF16(CP_ACP).c_str()); SetDlgItemTextW(hDlg, IDC_INFO_FILENAME, stdstr(CPath(_this->m_pRomInfo->GetFileName()).GetNameExtension()).ToUTF16(CP_ACP).c_str());
SetDlgItemTextW(hDlg, IDC_INFO_LOCATION, stdstr(CPath(_this->m_pRomInfo->GetFileName()).GetDriveDirectory()).ToUTF16(CP_ACP).c_str()); SetDlgItemTextW(hDlg, IDC_INFO_LOCATION, stdstr(CPath(_this->m_pRomInfo->GetFileName()).GetDriveDirectory()).ToUTF16(CP_ACP).c_str());
SetDlgItemTextW(hDlg, IDC_INFO_MD5, _this->m_pRomInfo->GetRomMD5().ToUTF16().c_str()); SetDlgItemTextW(hDlg, IDC_INFO_MD5, stdstr(_this->m_pRomInfo->GetRomMD5()).ToUTF16().c_str());
SetDlgItemTextW(hDlg, IDC_INFO_ROMSIZE, stdstr_f("%.1f MBit", (float)_this->m_pRomInfo->GetRomSize() / 0x20000).ToUTF16().c_str()); SetDlgItemTextW(hDlg, IDC_INFO_ROMSIZE, stdstr_f("%.1f MBit", (float)_this->m_pRomInfo->GetRomSize() / 0x20000).ToUTF16().c_str());
BYTE * RomHeader = _this->m_pRomInfo->GetRomAddress(); BYTE * RomHeader = _this->m_pRomInfo->GetRomAddress();
@ -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());
} }

View File

@ -103,7 +103,7 @@ LRESULT WelcomeScreen::OnOkCmd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCt
CPath GameDir(GetCWindowText(GetDlgItem(IDC_GAME_DIR)).c_str(), ""); CPath GameDir(GetCWindowText(GetDlgItem(IDC_GAME_DIR)).c_str(), "");
if (GameDir.DirectoryExists()) if (GameDir.DirectoryExists())
{ {
g_Settings->SaveString(RomList_GameDir, GameDir.GetDirectory().c_str()); g_Settings->SaveString(RomList_GameDir, GameDir.GetDriveDirectory().c_str());
Notify().AddRecentDir(GameDir); Notify().AddRecentDir(GameDir);
} }
EndDialog(0); EndDialog(0);