summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/romcmp.cpp
diff options
context:
space:
mode:
author Antonio Giner <estudio@antonioginer.com>2016-03-18 22:41:17 +0100
committer Antonio Giner <estudio@antonioginer.com>2016-03-18 22:41:17 +0100
commite39daaf5bdcf21d64abf239e1133963643dc6df1 (patch)
tree1f1b5f333e84bf056ce82c27bebdbad933f26c0d /src/tools/romcmp.cpp
parent421656e108e7091ee9e1b14c84f0a3f6efc2ad2e (diff)
parentb79020559ea3617b2d6bd4c92041d314045e2938 (diff)
Merge remote-tracking branch 'refs/remotes/mamedev/master'
Diffstat (limited to 'src/tools/romcmp.cpp')
-rw-r--r--src/tools/romcmp.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/tools/romcmp.cpp b/src/tools/romcmp.cpp
index a6919631cd8..641667b6342 100644
--- a/src/tools/romcmp.cpp
+++ b/src/tools/romcmp.cpp
@@ -490,43 +490,45 @@ static int load_files(int i, int *found, const char *path)
/* if not, try to open as a ZIP file */
else
{
- zip_file::ptr zip;
- const zip_file::file_header* zipent;
- zip_file::error ziperr;
+ util::archive_file::ptr zip;
/* wasn't a directory, so try to open it as a zip file */
- ziperr = zip_file::open(path, zip);
- if (ziperr != zip_file::error::NONE)
+ if ((util::archive_file::open_zip(path, zip) != util::archive_file::error::NONE) &&
+ (util::archive_file::open_7z(path, zip) != util::archive_file::error::NONE))
{
printf("Error, cannot open zip file '%s' !\n", path);
return 1;
}
/* load all files in zip file */
- for (zipent = zip->first_file(); zipent != nullptr; zipent = zip->next_file())
+ for (int zipent = zip->first_file(); zipent >= 0; zipent = zip->next_file())
{
+ if (zip->current_is_directory()) continue;
+
int size;
- size = zipent->uncompressed_length;
+ size = zip->current_uncompressed_length();
while (size && (size & 1) == 0) size >>= 1;
- if (zipent->uncompressed_length == 0) // || (size & ~1))
+ if (zip->current_uncompressed_length() == 0) // || (size & ~1))
+ {
printf("%-23s %-23s ignored (not a ROM)\n",
- i ? "" : zipent->filename, i ? zipent->filename : "");
+ i ? "" : zip->current_name().c_str(), i ? zip->current_name().c_str() : "");
+ }
else
{
fileinfo *file = &files[i][found[i]];
- const char *delim = strrchr(zipent->filename,'/');
+ const char *delim = strrchr(zip->current_name().c_str(), '/');
if (delim)
strcpy (file->name,delim+1);
else
- strcpy(file->name,zipent->filename);
- file->size = zipent->uncompressed_length;
+ strcpy(file->name,zip->current_name().c_str());
+ file->size = zip->current_uncompressed_length();
if ((file->buf = (unsigned char *)malloc(file->size)) == nullptr)
printf("%s: out of memory!\n",file->name);
else
{
- if (zip->decompress(file->buf, file->size) != zip_file::error::NONE)
+ if (zip->decompress(file->buf, file->size) != util::archive_file::error::NONE)
{
free(file->buf);
file->buf = nullptr;
@@ -743,6 +745,6 @@ int CLIB_DECL main(int argc,char *argv[])
}
}
- zip_file::cache_clear();
+ util::archive_file::cache_clear();
return 0;
}