Merge pull request #426 from death-droid/7z_improvements

Allow 7z files to actually work through "Open ROM". Removes the codes as...
This commit is contained in:
zilmar 2015-05-02 05:51:55 +10:00
commit 24cd364812
2 changed files with 10 additions and 5 deletions

View File

@ -490,7 +490,7 @@ stdstr CN64System::ChooseFileToOpen ( HWND hParent )
openfilename.lStructSize = sizeof( openfilename );
openfilename.hwndOwner = (HWND)hParent;
openfilename.lpstrFilter = "N64 ROMs (*.zip, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
openfilename.lpstrFilter = "N64 ROMs (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
openfilename.lpstrFile = FileName;
openfilename.lpstrInitialDir = Directory;
openfilename.nMaxFile = MAX_PATH;

View File

@ -276,7 +276,8 @@ bool CN64Rom::LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly ) {
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
_splitpath(FileLoc,drive,dir,fname,ext);
bool Loaded7zFile = false;
if (strstr(FileLoc,"?") != NULL || strcmp(ext,".z7") == 0)
if (strstr(FileLoc,"?") != NULL || strcmp(ext,".7z") == 0)
{
char FullPath[MAX_PATH + 100];
strcpy(FullPath,FileLoc);
@ -287,7 +288,7 @@ bool CN64Rom::LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly ) {
{
//Pop up a dialog and select file
//allocate memory for sub name and copy selected file name to var
return false; //remove once dialog is done
//return false; //remove once dialog is done
} else {
*SubFile = '\0';
SubFile += 1;
@ -302,12 +303,16 @@ bool CN64Rom::LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly ) {
{
continue;
}
stdstr ZipFileName;
ZipFileName.FromUTF16(ZipFile.FileNameIndex(i).c_str());
if (SubFile != NULL)
{
if (_stricmp(ZipFileName.c_str(), SubFile) != 0)
{
continue;
}
}
//Get the size of the rom and try to allocate the memory needed.
DWORD RomFileSize = (DWORD)f->Size;