Remove the extra IsValidRomImage from Rom browser, and make it use the one from within the n64 rom class.h file

This commit is contained in:
Emmet Young 2012-09-27 00:42:28 +10:00
parent a5befbcc87
commit 383446bdd3
4 changed files with 4 additions and 15 deletions

View File

@ -1,8 +1,6 @@
#include "stdafx.h"
#include <time.h>
CEeprom::CEeprom (bool ReadOnly):
m_ReadOnly(ReadOnly),
m_hFile(NULL)

View File

@ -17,7 +17,6 @@ class CN64Rom
bool AllocateAndLoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly );
bool AllocateAndLoadZipImage ( const char * FileLoc, bool LoadBootCodeOnly );
void ByteSwapRom ( void );
bool IsValidRomImage ( BYTE Test[4] );
void SetError ( LanguageStringID ErrorMsg );
static void __stdcall NotificationCB ( LPCSTR Status, CN64Rom * _this );
void CalculateCicChip ( void );
@ -26,6 +25,7 @@ public:
CN64Rom ( void );
~CN64Rom ( void );
bool LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly = false );
static bool IsValidRomImage( BYTE Test[4] );
void SaveRomSettingID ( void );
void ClearRomSettingID ( void );
CICChip CicChipID ( void );

View File

@ -644,9 +644,8 @@ void CRomBrowser::FillRomList ( strlist & FileList, CPath & BaseDirectory, stdst
{
BYTE RomData[0x1000];
ZipFile.GetFile(i,RomData,sizeof(RomData));
WriteTrace(TraceDebug,"CRomBrowser::FillRomList 9");
if (!IsValidRomImage(RomData)) { continue; }
if (!CN64Rom::IsValidRomImage(RomData)) { continue; }
WriteTrace(TraceDebug,"CRomBrowser::FillRomList 10");
ByteSwapRomData(RomData,sizeof(RomData));
WriteTrace(TraceDebug,"CRomBrowser::FillRomList 11");
@ -774,13 +773,6 @@ void CRomBrowser::HighLightLastRom(void) {
}
}
bool CRomBrowser::IsValidRomImage ( BYTE Test[4] ) {
if ( *((DWORD *)&Test[0]) == 0x40123780 ) { return TRUE; }
if ( *((DWORD *)&Test[0]) == 0x12408037 ) { return TRUE; }
if ( *((DWORD *)&Test[0]) == 0x80371240 ) { return TRUE; }
return FALSE;
}
bool CRomBrowser::LoadDataFromRomFile(char * FileName,BYTE * Data,int DataLen, int * RomSize, FILE_FORMAT & FileFormat) {
BYTE Test[4];
@ -805,7 +797,7 @@ bool CRomBrowser::LoadDataFromRomFile(char * FileName,BYTE * Data,int DataLen, i
return FALSE;
}
unzReadCurrentFile(file,Test,4);
if (IsValidRomImage(Test)) {
if (CN64Rom::IsValidRomImage(Test)) {
FoundRom = TRUE;
//RomFileSize = info.uncompressed_size;
memcpy(Data,Test,4);
@ -845,7 +837,7 @@ bool CRomBrowser::LoadDataFromRomFile(char * FileName,BYTE * Data,int DataLen, i
SetFilePointer(hFile,0,0,FILE_BEGIN);
ReadFile(hFile,Test,4,&dwRead,NULL);
if (!IsValidRomImage(Test)) { CloseHandle( hFile ); return FALSE; }
if (!CN64Rom::IsValidRomImage(Test)) { CloseHandle( hFile ); return FALSE; }
SetFilePointer(hFile,0,0,FILE_BEGIN);
if (!ReadFile(hFile,Data,DataLen,&dwRead,NULL)) { CloseHandle( hFile ); return FALSE; }
*RomSize = GetFileSize(hFile,NULL);

View File

@ -150,7 +150,6 @@ class CRomBrowser
void FillRomList ( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, const char * lpLastRom );
void FixRomListWindow ( void );
static int GetCicChipID ( BYTE * RomData );
static bool IsValidRomImage ( BYTE Test[4] );
bool LoadDataFromRomFile ( char * FileName, BYTE * Data,int DataLen, int * RomSize, FILE_FORMAT & FileFormat );
void LoadRomList ( void );
void MenuSetText ( MENU_HANDLE hMenu, int MenuPos, const char * Title, char * ShotCut);