X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Ffile.cpp;fp=src%2Ffile.cpp;h=ac39edead80ac15229f3ae7280e2a64798df4ebd;hb=fcdc03c5e732a7e4461c817c3c315a11ed87d3b9;hp=78b4233c6eb53cda59df23bdfabd8e06be021915;hpb=07d689da4cceee0c376861a1459c9e9c2289c6a2;p=virtualjaguar diff --git a/src/file.cpp b/src/file.cpp index 78b4233..ac39ede 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -483,7 +483,9 @@ uint32 GetFileFromZIP(const char * zipFile, FileType type, uint8 * &buffer) WriteLog("FILE: Found image file '%s'.\n", ze->name); } - if ((type == FT_SOFTWARE) && (CheckExtension(ze->name, ".j64") || CheckExtension(ze->name, ".rom") || CheckExtension(ze->name, ".abs") || CheckExtension(ze->name, ".cof"))) + if ((type == FT_SOFTWARE) && (CheckExtension(ze->name, ".j64") + || CheckExtension(ze->name, ".rom") || CheckExtension(ze->name, ".abs") + || CheckExtension(ze->name, ".cof") || CheckExtension(ze->name, ".jag"))) { found = true; WriteLog("FILE: Found software file '%s'.\n", ze->name); @@ -529,17 +531,7 @@ uint32 GetFileFromZIP(const char * zipFile, FileType type, uint8 * &buffer) // uint32 ParseFileType(uint8 header1, uint8 header2, uint32 size) { - // If the file size is divisible by 1M, we probably have an regular ROM. - // We can also check our CRC32 against the internal ROM database to be sure. - if ((size % 1048576) == 0) - return JST_ROM; - - // If the file size + 8192 bytes is divisible by 1M, we probably have an - // Alpine format ROM. - if (((size + 8192) % 1048576) == 0) - return JST_ALPINE; - - // So much for low hanging fruit. Now try some other types. + // Check headers first... // ABS/COFF type 1 if (header1 == 0x60 && header2 == 0x1B) @@ -553,6 +545,18 @@ uint32 ParseFileType(uint8 header1, uint8 header2, uint32 size) if (header1 == 0x60 && header2 == 0x1A) return JST_JAGSERVER; + // And if that fails, try file sizes... + + // If the file size is divisible by 1M, we probably have an regular ROM. + // We can also check our CRC32 against the internal ROM database to be sure. + if ((size % 1048576) == 0) + return JST_ROM; + + // If the file size + 8192 bytes is divisible by 1M, we probably have an + // Alpine format ROM. + if (((size + 8192) % 1048576) == 0) + return JST_ALPINE; + // Headerless crap return JST_NONE; }