Merge branch 'master' of github.com:TASVideos/fceux

This commit is contained in:
mjbudd77 2021-06-17 20:44:54 -04:00
commit b87452861c
3 changed files with 17 additions and 10 deletions

View File

@ -10,6 +10,7 @@
#include "7zip/IArchive.h"
#include "file.h"
#include "utils/guid.h"
#include "utils/xstring.h"
#include "driver.h"
#include "main.h"
@ -266,7 +267,7 @@ public:
}
};
//used to move all child items in the dialog when you resize (except for the dock fill controls which are resized)
// Callback for resizing child controls
BOOL CALLBACK ArchiveEnumWindowsProc(HWND hwnd, LPARAM lParam)
{
RECT crect;
@ -311,7 +312,6 @@ public:
}
};
// Callback for resizing child controls
static INT_PTR CALLBACK ArchiveFileSelectorCallback(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
@ -476,18 +476,18 @@ static std::string wstringFromPROPVARIANT(BSTR bstr, bool& success)
return strret;
}
static bool endsWith(const std::string& str, const std::string& suffix)
{
return (str.size() >= suffix.size()) && (str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0);
}
ArchiveScanRecord FCEUD_ScanArchive(std::string fname)
{
if(!archiveSystemInitialized)
{
if (endsWith(fname, ".zip") || endsWith(fname, ".7z") || endsWith(fname, ".rar"))
std::string fext = getExtension(fname.c_str());
if ((fext == "zip") || (fext == "7z") || (fext == "rar"))
{
MessageBox(hAppWnd, "Could not locate " _7Z_DLL, "Failure reading archive file", 0);
return ArchiveScanRecord();
ArchiveScanRecord error = ArchiveScanRecord();
error.numFilesInArchive = -1;
return error;
}
}
//check the file against the signatures

View File

@ -425,7 +425,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
int lastpal = PAL;
int lastdendy = dendy;
const char* romextensions[] = { "nes", "fds", 0 };
const char* romextensions[] = { "nes", "fds", "nsf", 0 };
// indicator for if the operaton was canceled by user
// currently there's only one situation:

View File

@ -287,6 +287,13 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, const char *mode, cha
if(read)
{
ArchiveScanRecord asr = FCEUD_ScanArchive(fileToOpen);
if (asr.numFilesInArchive < 0)
{
// error occurred, return
// actually it's canceled not by user but an error message already shown
*userCancel = 1;
return fceufp;
}
asr.files.FilterByExtension(extensions);
if(!asr.isArchive())
{