Merge branch 'master' of github.com:TASVideos/fceux
This commit is contained in:
commit
b87452861c
|
@ -10,6 +10,7 @@
|
||||||
#include "7zip/IArchive.h"
|
#include "7zip/IArchive.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "utils/guid.h"
|
#include "utils/guid.h"
|
||||||
|
#include "utils/xstring.h"
|
||||||
|
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "main.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)
|
BOOL CALLBACK ArchiveEnumWindowsProc(HWND hwnd, LPARAM lParam)
|
||||||
{
|
{
|
||||||
RECT crect;
|
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)
|
static INT_PTR CALLBACK ArchiveFileSelectorCallback(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
|
@ -476,18 +476,18 @@ static std::string wstringFromPROPVARIANT(BSTR bstr, bool& success)
|
||||||
return strret;
|
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)
|
ArchiveScanRecord FCEUD_ScanArchive(std::string fname)
|
||||||
{
|
{
|
||||||
if(!archiveSystemInitialized)
|
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);
|
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
|
//check the file against the signatures
|
||||||
|
|
|
@ -425,7 +425,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
||||||
int lastpal = PAL;
|
int lastpal = PAL;
|
||||||
int lastdendy = dendy;
|
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
|
// indicator for if the operaton was canceled by user
|
||||||
// currently there's only one situation:
|
// currently there's only one situation:
|
||||||
|
|
|
@ -287,6 +287,13 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, const char *mode, cha
|
||||||
if(read)
|
if(read)
|
||||||
{
|
{
|
||||||
ArchiveScanRecord asr = FCEUD_ScanArchive(fileToOpen);
|
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);
|
asr.files.FilterByExtension(extensions);
|
||||||
if(!asr.isArchive())
|
if(!asr.isArchive())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue