This commit is contained in:
zilmar 2012-09-29 18:02:32 +10:00
commit d592afc787
3 changed files with 56 additions and 59 deletions

View File

@ -455,17 +455,15 @@ void CRomBrowser::FillRomExtensionInfo(ROM_INFO * pRomInfo) {
}
bool CRomBrowser::FillRomInfo(ROM_INFO * pRomInfo) {
int count;
BYTE RomData[0x1000];
if (!LoadDataFromRomFile(pRomInfo->szFullFileName,RomData,sizeof(RomData),&pRomInfo->RomSize,pRomInfo->FileFormat)) { return FALSE; }
return FillRomInfo2(pRomInfo,RomData, sizeof(RomData));
}
bool CRomBrowser::FillRomInfo2(ROM_INFO * pRomInfo, BYTE * RomData, DWORD RomDataSize )
if (!LoadDataFromRomFile(pRomInfo->szFullFileName,RomData,sizeof(RomData),&pRomInfo->RomSize,pRomInfo->FileFormat))
{
return false;
}
else
{
int count;
if (strstr(pRomInfo->szFullFileName,"?") != NULL)
{
strcpy(pRomInfo->FileName,strstr(pRomInfo->szFullFileName,"?") + 1);
@ -502,9 +500,9 @@ bool CRomBrowser::FillRomInfo2(ROM_INFO * pRomInfo, BYTE * RomData, DWORD RomDat
pRomInfo->SelColorBrush = (DWORD)CreateSolidBrush(pRomInfo->SelColor);
}
return TRUE;
return true;
}
}
void CRomBrowser::GetRomFileNames( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, bool InWatchThread )
{
@ -782,7 +780,7 @@ bool CRomBrowser::LoadDataFromRomFile(char * FileName,BYTE * Data,int DataLen, i
char zname[132];
unzFile file;
file = unzOpen(FileName);
if (file == NULL) { return FALSE; }
if (file == NULL) { return false; }
port = unzGoToFirstFile(file);
FoundRom = FALSE;
@ -790,15 +788,15 @@ bool CRomBrowser::LoadDataFromRomFile(char * FileName,BYTE * Data,int DataLen, i
unzGetCurrentFileInfo(file, &info, zname, 128, NULL,0, NULL,0);
if (unzLocateFile(file, zname, 1) != UNZ_OK ) {
unzClose(file);
return FALSE;
return true;
}
if( unzOpenCurrentFile(file) != UNZ_OK ) {
unzClose(file);
return FALSE;
return true;
}
unzReadCurrentFile(file,Test,4);
if (CN64Rom::IsValidRomImage(Test)) {
FoundRom = TRUE;
FoundRom = true;
//RomFileSize = info.uncompressed_size;
memcpy(Data,Test,4);
len = unzReadCurrentFile(file,&Data[4],DataLen - 4) + 4;
@ -806,23 +804,23 @@ bool CRomBrowser::LoadDataFromRomFile(char * FileName,BYTE * Data,int DataLen, i
if ((int)DataLen != len) {
unzCloseCurrentFile(file);
unzClose(file);
return FALSE;
return false;
}
*RomSize = info.uncompressed_size;
if(unzCloseCurrentFile(file) == UNZ_CRCERROR) {
unzClose(file);
return FALSE;
return false;
}
unzClose(file);
}
if (FoundRom == FALSE) {
if (FoundRom == false) {
unzCloseCurrentFile(file);
port = unzGoToNextFile(file);
}
}
if (FoundRom == FALSE) {
return FALSE;
if (FoundRom == false) {
return false;
}
FileFormat = Format_Zip;
} else {
@ -833,19 +831,19 @@ bool CRomBrowser::LoadDataFromRomFile(char * FileName,BYTE * Data,int DataLen, i
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
NULL);
if (hFile == INVALID_HANDLE_VALUE) { return FALSE; }
if (hFile == INVALID_HANDLE_VALUE) { return false; }
SetFilePointer(hFile,0,0,FILE_BEGIN);
ReadFile(hFile,Test,4,&dwRead,NULL);
if (!CN64Rom::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; }
if (!ReadFile(hFile,Data,DataLen,&dwRead,NULL)) { CloseHandle( hFile ); return false; }
*RomSize = GetFileSize(hFile,NULL);
CloseHandle( hFile );
FileFormat = Format_Uncompressed;
}
ByteSwapRomData(Data,DataLen);
return TRUE;
return true;
}
void CRomBrowser::ByteSwapRomData (BYTE * Data, int DataLen)

View File

@ -146,7 +146,6 @@ class CRomBrowser
void DeallocateBrushs ( void );
void FillRomExtensionInfo ( ROM_INFO * pRomInfo );
bool FillRomInfo ( ROM_INFO * pRomInfo );
bool FillRomInfo2 ( ROM_INFO * pRomInfo, BYTE * RomData, DWORD RomDataSize );
void FillRomList ( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, const char * lpLastRom );
void FixRomListWindow ( void );
static int GetCicChipID ( BYTE * RomData );

View File

@ -537,8 +537,8 @@ void RSP_SW_DMEM ( DWORD Addr, DWORD Value ) {
}
*(BYTE *)(RSPInfo.DMEM + (Addr ^ 3)) = (BYTE)(Value >> 0x18);
*(BYTE *)(RSPInfo.DMEM + ((Addr + 1) ^ 3)) = (BYTE)(Value >> 0x10);
*(BYTE *)(RSPInfo.DMEM + ((Addr + 2) ^ 3)) = (BYTE)(Value >> 0x8);
*(BYTE *)(RSPInfo.DMEM + ((Addr + 3) ^ 3)) = (BYTE)(Value);
*(BYTE *)(RSPInfo.DMEM + ((Addr + 2) ^ 3)) = (BYTE)(Value >> 0x8 &0xFF);
*(BYTE *)(RSPInfo.DMEM + ((Addr + 3) ^ 3)) = (BYTE)(Value &0xFF);
return;
}
*(DWORD *)(RSPInfo.DMEM + Addr) = Value;