mirror of https://github.com/stella-emu/stella.git
Fixed ZIP handling in Windows; the '/' vs. '\' curse strikes again.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2591 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
7cf7e8d4c9
commit
1f16369487
|
@ -33,6 +33,9 @@
|
|||
* Fixed regression in M6532 INTIM reads; at least one known ROM
|
||||
(Mr. Roboto Berzerk hack) wasn't working properly.
|
||||
|
||||
* Fixed ZIP file handling in Windows when the archive contained
|
||||
multiple files; in several cases the ROM wasn't being loaded at all.
|
||||
|
||||
-Have fun!
|
||||
|
||||
|
||||
|
|
|
@ -51,6 +51,12 @@ bool FilesystemNode::operator<(const FilesystemNode& node) const
|
|||
return BSPF_strcasecmp(getDisplayName().c_str(), node.getDisplayName().c_str()) < 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool FilesystemNode::operator==(const FilesystemNode& node) const
|
||||
{
|
||||
return BSPF_strcasecmp(getDisplayName().c_str(), node.getDisplayName().c_str()) == 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool FilesystemNode::exists() const
|
||||
{
|
||||
|
|
|
@ -131,6 +131,12 @@ class FilesystemNode
|
|||
*/
|
||||
bool operator<(const FilesystemNode& node) const;
|
||||
|
||||
/**
|
||||
* Compare the name of this node to the name of another, testing for
|
||||
* equality
|
||||
*/
|
||||
bool operator==(const FilesystemNode& node) const;
|
||||
|
||||
/**
|
||||
* Indicates whether the object referred by this path exists in the filesystem or not.
|
||||
*
|
||||
|
|
|
@ -849,7 +849,9 @@ bool OSystem::loadFromZIP(const string& filename, uInt8** image, uInt32& size)
|
|||
}
|
||||
|
||||
// Open archive
|
||||
FilesystemNode searchnode(fileinzip);
|
||||
unzFile tz;
|
||||
bool found = false;
|
||||
if((tz = unzOpen(archive.c_str())) != NULL)
|
||||
{
|
||||
if(unzGoToFirstFile(tz) == UNZ_OK)
|
||||
|
@ -875,8 +877,11 @@ bool OSystem::loadFromZIP(const string& filename, uInt8** image, uInt32& size)
|
|||
BSPF_equalsIgnoreCase(ext, ".rom"))
|
||||
{
|
||||
// Either match the first file or the one we're looking for
|
||||
if(fileinzip.empty() || fileinzip == currfile)
|
||||
if(fileinzip.empty() || searchnode == FilesystemNode(currfile))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -886,7 +891,7 @@ bool OSystem::loadFromZIP(const string& filename, uInt8** image, uInt32& size)
|
|||
}
|
||||
|
||||
// Now see if we got a valid image
|
||||
if(ufo.uncompressed_size <= 0)
|
||||
if(!found || ufo.uncompressed_size <= 0)
|
||||
{
|
||||
unzClose(tz);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue