Project64: Some code clean up of N64RomClass.h
This commit is contained in:
parent
a497e9ef38
commit
6caa9ea47a
|
@ -21,20 +21,20 @@ 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; }
|
||||
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();
|
||||
void UnallocateRomImage();
|
||||
|
||||
//Get a message id for the reason that you failed to load the rom
|
||||
LanguageStringID GetError() const { return m_ErrorMsg; }
|
||||
|
@ -42,14 +42,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 };
|
||||
|
|
|
@ -148,11 +148,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 +168,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 +191,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 +199,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 +322,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
|
|||
#endif
|
||||
break;
|
||||
}
|
||||
} while (SearchPath.FindNext());
|
||||
} while (SearchDir.FindNext());
|
||||
#ifdef _WIN32
|
||||
m_ZipIniFile->FlushChanges();
|
||||
#endif
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue