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
RDRAM Size=8
[THE LEGEND OF ZELDA-C:45]
Alt Identifier=EC7011B7-7616D72B-C:45
[EC7011B7-7616D72B-C:45]
Good Name=The Legend of Zelda - Ocarina of Time (U) (V1.0)
Internal Name=THE LEGEND OF ZELDA

View File

@ -497,7 +497,7 @@ bool CIniFileBase::DeleteSection(const char * lpSectionName)
CGuard Guard(m_CS);
if (!m_File.IsOpen()) { return false; }
SaveCurrentSection();
if (!MoveToSectionNameData(lpSectionName, true))
{
@ -517,10 +517,10 @@ bool CIniFileBase::DeleteSection(const char * lpSectionName)
if (result <= 1) { continue; }
if (strlen(CleanLine(Input)) <= 1) { continue; }
if (Input[0] != '[')
{
if (Input[0] != '[')
{
NextLine = (m_File.GetPosition() - DataSize) + ReadPos;
continue;
continue;
}
NextSectionStart = NextLine != 0 ? NextLine : (m_File.GetPosition() - DataSize) + ReadPos;
break;
@ -869,7 +869,7 @@ void CIniFileBase::GetVectorOfSections(SectionList & sections)
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,14 +10,15 @@
#include <map>
#include <vector>
#include <list>
#include <set>
#include <memory>
class CIniFileBase
{
public:
typedef std::map<std::string, std::string> KeyValueData;
typedef std::vector<std::string> SectionList;
typedef std::list<std::string> strlist;
typedef std::set<std::string> SectionList;
typedef std::list<std::string> strlist;
typedef std::pair<const std::string *, const std::string *> KeyValueItem;
typedef std::vector<KeyValueItem> KeyValueVector;
typedef void(*SortData)(KeyValueVector &);
@ -68,7 +69,7 @@ private:
typedef std::map<std::string, long> FILELOC;
typedef FILELOC::iterator FILELOC_ITR;
typedef std::map<std::string, std::string, insensitive_compare> KeyValueList;
std::string m_CurrentSection;
bool m_CurrentSectionDirty;
int m_CurrentSectionFilePos; // Where in the file is the current Section

View File

@ -70,9 +70,9 @@ void SplitFile(const char * FileName, const char * Target)
CIniFile CheatIniFile(FileName);
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;
CheatIniFile.GetKeyValueData(Section, data);
@ -136,9 +136,9 @@ void RegionSection(CFile &TargetIniFile, Files &files, const char * Region, cons
bool found = false;
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());
if (pos == NULL)
{
@ -147,15 +147,15 @@ void RegionSection(CFile &TargetIniFile, Files &files, const char * Region, cons
found = true;
break;
}
if (!found)
{
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;
GameIniFile.GetKeyValueData(Section, data);
@ -200,9 +200,9 @@ void JoinFile(const char * Directory, const char * Target)
CIniFile::SectionList 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);
Name.Trim("\t =");
if (Name.size() > 0)
@ -239,7 +239,7 @@ void JoinFile(const char * Directory, const char * Target)
{
CIniFile::KeyValueData data;
MetaIniFile.GetKeyValueData("Meta", data);
LineData = stdstr_f("[Meta]\r\n");
TargetIniFile.Write(LineData.c_str(), (int)LineData.length());
for (CIniFile::KeyValueData::const_iterator itr = data.begin(); itr != data.end(); itr++)
@ -282,9 +282,9 @@ void UpdateNames(const char* Directory, const char* RdbFile)
CIniFile::SectionList Sections;
CheatFile.GetVectorOfSections(Sections);
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", "");
if (Name.empty())
{
@ -616,9 +616,9 @@ void convertGS(const char* Directory)
CIniFile::SectionList Sections;
CheatFile.GetVectorOfSections(Sections);
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++)
{
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,
};
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", "");
DstCheatFile.SetName(Section, GameName.c_str());
for (uint32_t cheat = 0; cheat < MaxCheats; cheat++)

View File

@ -300,7 +300,7 @@ void DiskBMUpdate()
else
{
//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
g_Reg->ASIC_STATUS &= ~DD_STATUS_DATA_RQ;

View File

@ -601,15 +601,15 @@ bool CN64System::SelectAndLoadFileImageIPL(Country country, bool combo)
LanguageStringID IPLROMError;
switch (country)
{
case Country::Japan:
case Country_Japan:
IPLROMPathSetting = File_DiskIPLPath;
IPLROMError = MSG_IPL_REQUIRED;
break;
case Country::USA:
case Country_NorthAmerica:
IPLROMPathSetting = File_DiskIPLUSAPath;
IPLROMError = MSG_USA_IPL_REQUIRED;
break;
case Country::UnknownCountry:
case Country_Unknown:
default:
IPLROMPathSetting = File_DiskIPLTOOLPath;
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
m_Reg.ASIC_STATUS = DD_STATUS_RST_STATE | DD_STATUS_MTR_N_SPIN;
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.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[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())
{
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[23].DW = 0x0000000000000006;
m_Reg.m_GPR[31].DW = 0xFFFFFFFFA4001554;
break;
case NTSC_BETA: case X_NTSC: case USA: case Japan:
default:
}
else
{
switch (g_Rom->CicChipID())
{
case CIC_UNKNOWN:

View File

@ -19,17 +19,17 @@
#include <memory>
CN64Disk::CN64Disk() :
m_DiskImage(NULL),
m_DiskImageBase(NULL),
m_DiskHeader(NULL),
m_DiskHeaderBase(NULL),
m_ErrorMsg(EMPTY_STRING),
m_DiskBufAddress(0),
m_DiskSysAddress(0),
m_DiskIDAddress(0),
m_DiskRomAddress(0),
m_DiskRamAddress(0),
m_isShadowDisk(false)
m_DiskImage(NULL),
m_DiskImageBase(NULL),
m_DiskHeader(NULL),
m_DiskHeaderBase(NULL),
m_ErrorMsg(EMPTY_STRING),
m_DiskBufAddress(0),
m_DiskSysAddress(0),
m_DiskIDAddress(0),
m_DiskRomAddress(0),
m_DiskRamAddress(0),
m_isShadowDisk(false)
{
}
@ -221,9 +221,14 @@ void CN64Disk::SaveDiskSettingID(bool temp)
switch (GetCountry())
{
case Germany: case french: case Italian:
case Europe: case Spanish: case Australia:
case X_PAL: case Y_PAL:
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:
g_Settings->SaveDword(Game_SystemType, SYSTEM_PAL);
break;
default:
@ -790,7 +795,7 @@ bool CN64Disk::IsSysSectorGood(uint32_t block, uint32_t sectorsize)
//Always 0xFFFFFFFF
if (*(uint32_t*)&m_DiskImage[(block * 0x4D08) + 0x18] != 0xFFFFFFFF)
return false;
uint8_t alt = 0xC; //Retail
if ((block & 2) != 0)
alt = 0xA; //Development
@ -811,12 +816,12 @@ Country CN64Disk::GetDiskCountryCode()
switch (*(uint32_t*)&GetDiskAddressSys()[0])
{
case DISK_COUNTRY_JPN:
return Japan;
return Country_Japan;
case DISK_COUNTRY_USA:
return USA;
return Country_NorthAmerica;
case DISK_COUNTRY_DEV:
default:
return UnknownCountry;
return Country_Unknown;
}
}
@ -945,7 +950,7 @@ uint16_t CN64Disk::LBAToPhys(uint32_t lba)
uint16_t vzone_lba = 0;
if (vzone != 0)
vzone_lba = VZONE_LBA_TBL[m_DiskType][vzone - 1];
//Calculate Physical Track
uint16_t track = (lba - vzone_lba) >> 1;

View File

@ -16,6 +16,7 @@
#include <Common/Platform.h>
#include <Common/MemoryManagement.h>
#include <Common/SmartPointer.h>
#include <Common/IniFileClass.h>
#include <memory>
#ifdef _WIN32
@ -27,7 +28,7 @@ CN64Rom::CN64Rom() :
m_ROMImageBase(NULL),
m_RomFileSize(0),
m_ErrorMsg(EMPTY_STRING),
m_Country(UnknownCountry),
m_Country(Country_Unknown),
m_CicChip(CIC_UNKNOWN)
{
}
@ -324,11 +325,11 @@ void CN64Rom::CalculateRomCrc()
uint32_t v0, v1;
uint32_t length = 0x00100000;
// CIC_NUS_6101 at=0x5D588B65 , s6=0x3F
// CIC_NUS_6102 at=0x5D588B65 , s6=0x3F
// CIC_NUS_6103 at=0x6C078965 , s6=0x78
// CIC_NUS_6105 at=0x5d588b65 , s6=0x91
// CIC_NUS_6106 at=0x6C078965 , s6=0x85
// CIC_NUS_6101 at=0x5D588B65 , s6=0x3F
// CIC_NUS_6102 at=0x5D588B65 , s6=0x3F
// CIC_NUS_6103 at=0x6C078965 , s6=0x78
// CIC_NUS_6105 at=0x5d588b65 , s6=0x91
// CIC_NUS_6106 at=0x6C078965 , s6=0x85
// 64DD IPL (JPN) at=0x02E90EDD , s6=0xdd
// 64DD IPL (USA) at=0x02E90EDD , s6=0xde
@ -445,12 +446,12 @@ bool CN64Rom::IsLoadedRomDDIPL()
{
switch (CicChipID())
{
case CIC_NUS_8303:
case CIC_NUS_DDUS:
case CIC_NUS_DDTL:
return true;
default:
return false;
case CIC_NUS_8303:
case CIC_NUS_DDUS:
case CIC_NUS_DDTL:
return true;
default:
return false;
}
}
@ -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]);
{
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());
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_IniKey, m_RomIdent.c_str());
g_Settings->SaveString(Game_UniqueSaveDir, stdstr_f("%s-%s", m_RomName.c_str(), m_MD5.c_str()).c_str());
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;
}
g_Settings->SaveDword(Game_SystemType, IsPal() ? SYSTEM_PAL : SYSTEM_NTSC);
}
void CN64Rom::ClearRomSettingID()
@ -874,6 +883,23 @@ void CN64Rom::SetError(LanguageStringID 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()
{
m_RomFile.Close();

View File

@ -21,20 +21,21 @@ public:
CN64Rom();
~CN64Rom();
bool LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly = false);
bool LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly = false);
bool LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly = false);
bool LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly = false);
static bool IsValidRomImage(uint8_t Test[4]);
bool IsLoadedRomDDIPL();
void SaveRomSettingID(bool temp);
void ClearRomSettingID();
bool IsLoadedRomDDIPL();
void SaveRomSettingID(bool temp);
void ClearRomSettingID();
CICChip CicChipID();
uint8_t * GetRomAddress() { return m_ROMImage; }
uint32_t GetRomSize() const { return m_RomFileSize; }
stdstr GetRomMD5() const { return m_MD5; }
stdstr GetRomName() const { return m_RomName; }
stdstr GetFileName() const { return m_FileName; }
uint8_t * GetRomAddress() { return m_ROMImage; }
uint32_t GetRomSize() const { return m_RomFileSize; }
const std::string & GetRomMD5() const { return m_MD5; }
const std::string & GetRomName() const { return m_RomName; }
const std::string & GetFileName() const { return m_FileName; }
Country GetCountry() const { return m_Country; }
void UnallocateRomImage();
bool IsPal();
void UnallocateRomImage();
//Get a message id for the reason that you failed to load the rom
LanguageStringID GetError() const { return m_ErrorMsg; }
@ -42,14 +43,15 @@ public:
static void CleanRomName(char * RomName, bool byteswap = true);
private:
bool AllocateRomImage(uint32_t RomFileSize);
bool AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnly);
bool AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnly);
void ByteSwapRom();
void SetError(LanguageStringID ErrorMsg);
bool AllocateRomImage(uint32_t RomFileSize);
bool AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnly);
bool AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnly);
void ByteSwapRom();
void SetError(LanguageStringID ErrorMsg);
void CalculateCicChip();
void CalculateRomCrc();
static void NotificationCB(const char * Status, CN64Rom * _this);
void CalculateCicChip();
void CalculateRomCrc();
//constant values
enum { ReadFromRomSection = 0x400000 };

View File

@ -77,9 +77,27 @@ enum CICChip
enum Country
{
NTSC_BETA = 0x37, X_NTSC = 0x41, Germany = 0x44, USA = 0x45, french = 0x46, Italian = 0x49,
Japan = 0x4A, Europe = 0x50, Spanish = 0x53, Australia = 0x55, X_PAL = 0x58, Y_PAL = 0x59,
UnknownCountry = 0
Country_NTSC_BETA = 0x37,
Country_Asian_NTSC = 0x41,
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

View File

@ -59,6 +59,10 @@ CRomList::CRomList() :
#endif
g_Settings->RegisterChangeCB(RomList_GameDir, this, (CSettings::SettingChangedFunc)RefreshSettings);
}
if (m_RomIniFile)
{
m_RomIniFile->GetVectorOfSections(m_GameIdentifiers);
}
WriteTrace(TraceRomList, TraceVerbose, "Done");
}
@ -148,11 +152,11 @@ void CRomList::AddRomToList(const char * RomLocation)
void CRomList::FillRomList(strlist & FileList, const char * Directory)
{
WriteTrace(TraceRomList, TraceDebug, "Start (m_GameDir = %s, Directory: %s)", (const char *)m_GameDir, Directory);
CPath SearchPath((const char *)m_GameDir, "*");
SearchPath.AppendDirectory(Directory);
CPath SearchDir((const char *)m_GameDir, "*");
SearchDir.AppendDirectory(Directory);
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, TraceDebug, "Done (Directory: %s)", Directory);
@ -168,20 +172,20 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
break;
}
if (SearchPath.IsDirectory())
if (SearchDir.IsDirectory())
{
if (g_Settings->LoadBool(RomList_GameDirRecursive))
{
CPath CurrentDir(Directory);
CurrentDir.AppendDirectory(SearchPath.GetLastDirectory().c_str());
CurrentDir.AppendDirectory(SearchDir.GetLastDirectory().c_str());
FillRomList(FileList, CurrentDir);
}
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++)
{
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]);
if (Extension != "7z")
{
AddRomToList(SearchPath);
AddRomToList(SearchDir);
}
#ifdef _WIN32
else
@ -199,7 +203,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
WriteTrace(TraceRomList, TraceVerbose, "Looking at contents of 7z file");
try
{
C7zip ZipFile(SearchPath);
C7zip ZipFile(SearchDir);
if (!ZipFile.OpenSuccess())
{
continue;
@ -322,7 +326,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
#endif
break;
}
} while (SearchPath.FindNext());
} while (SearchDir.FindNext());
#ifdef _WIN32
m_ZipIniFile->FlushChanges();
#endif
@ -582,9 +586,17 @@ void CRomList::FillRomExtensionInfo(ROM_INFO * pRomInfo)
strcpy(pRomInfo->Name, "#321#");
strcpy(pRomInfo->Status, "Unknown");
//Get File Identifier
char Identifier[100];
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
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;
#endif
CThread m_RefreshThread;
CIniFileBase::SectionList m_GameIdentifiers;
#define DISKSIZE_MAME 0x0435B0C0
#define DISKSIZE_SDK 0x03DEC800

View File

@ -121,9 +121,9 @@ void CSettingTypeApplication::ResetAll()
}
CIniFile::SectionList 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());
}
}
@ -156,14 +156,14 @@ bool CSettingTypeApplication::Load(uint32_t Index, bool & Value) const
}
else
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadBoolIndex(m_DefaultSetting, Index, Value);
}
else
{
g_Settings->LoadBool(m_DefaultSetting, Value);
}
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadBoolIndex(m_DefaultSetting, Index, Value);
}
else
{
g_Settings->LoadBool(m_DefaultSetting, Value);
}
}
}
return bRes;
@ -203,13 +203,13 @@ void CSettingTypeApplication::LoadDefault(uint32_t Index, bool & Value) const
{
Value = m_DefaultValue != 0;
}
else if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadBoolIndex(m_DefaultSetting, Index, Value);
}
else
{
g_Settings->LoadBool(m_DefaultSetting, Value);
else if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadBoolIndex(m_DefaultSetting, Index, Value);
}
else
{
g_Settings->LoadBool(m_DefaultSetting, Value);
}
}
}
@ -233,7 +233,7 @@ void CSettingTypeApplication::LoadDefault(uint32_t /*Index*/, std::string & Valu
//Update the settings
void CSettingTypeApplication::Save(uint32_t Index, bool Value)
{
bool indexed = g_Settings->IndexBasedSetting(m_DefaultSetting);
bool indexed = g_Settings->IndexBasedSetting(m_DefaultSetting);
if (m_DefaultSetting != Default_None &&
((m_DefaultSetting == Default_Constant && m_DefaultValue == (uint32_t)Value) ||

View File

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

View File

@ -356,9 +356,6 @@
<ClInclude Include="UserInterface\SupportWindow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="N64System\Debugger\OpInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UserInterface\WTLControls\TooltipDialog.h">
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
</ClInclude>
@ -431,9 +428,6 @@
<ClInclude Include="UserInterface\Debugger\ScriptSystem.h">
<Filter>Header Files\User Interface Headers\Debugger Headers</Filter>
</ClInclude>
<ClInclude Include="UserInterface\Debugger\stdafx.h">
<Filter>Header Files\User Interface Headers\Debugger Headers</Filter>
</ClInclude>
<ClInclude Include="UserInterface\Debugger\Symbols.h">
<Filter>Header Files\User Interface Headers\Debugger Headers</Filter>
</ClInclude>
@ -464,9 +458,6 @@
<ClInclude Include="UserInterface\Settings\SettingsPage-DiskDrive.h">
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
</ClInclude>
<ClInclude Include="DiscordRPC.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UserInterface\WTLControls\HexEditCtrl.h">
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
</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_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_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());
BYTE * RomHeader = _this->m_pRomInfo->GetRomAddress();
@ -123,19 +123,19 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
switch (RomHeader[0x3D])
{
case NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break;
case X_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break;
case Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break;
case USA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break;
case french: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break;
case Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break;
case Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break;
case Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break;
case Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break;
case Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break;
case X_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case Y_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case 0: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break;
case Country_NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break;
case Country_Asian_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break;
case Country_Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break;
case Country_NorthAmerica: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break;
case Country_French: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break;
case Country_Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break;
case Country_Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break;
case Country_Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break;
case Country_Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break;
case Country_Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break;
case Country_EuropeanX_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case Country_EuropeanY_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case Country_Unknown: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break;
default:
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])
{
case NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break;
case X_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break;
case Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break;
case USA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break;
case french: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break;
case Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break;
case Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break;
case Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break;
case Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break;
case Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break;
case X_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case Y_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case 0: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break;
case Country_NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break;
case Country_Asian_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break;
case Country_Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break;
case Country_NorthAmerica: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break;
case Country_French: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break;
case Country_Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break;
case Country_Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break;
case Country_Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break;
case Country_Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break;
case Country_Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break;
case Country_EuropeanX_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case Country_EuropeanY_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
case Country_Unknown: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break;
default:
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(), "");
if (GameDir.DirectoryExists())
{
g_Settings->SaveString(RomList_GameDir, GameDir.GetDirectory().c_str());
g_Settings->SaveString(RomList_GameDir, GameDir.GetDriveDirectory().c_str());
Notify().AddRecentDir(GameDir);
}
EndDialog(0);