qmc2 / qmc2-mame-fe

QMC2 - M.A.M.E. Catalog / Launcher II
40 stars 3 forks source link

Another minizip-ng issue #7

Closed qmc2 closed 2 years ago

qmc2 commented 2 years ago

I just found out that the "ROMAlyzer" somehow gets this on checksum scanning:

...
17:03:57.359: scan started for file '/home/games/mame/roms/3dobios.zip'
17:03:57.367: ZIP scan: member '' from archive '/home/games/mame/roms/3dobios.zip' has SHA-1 '3c912300775d1ad730dc35757e279c274c0acaad' and CRC '58242cee'
17:03:57.373: ZIP scan: member '' from archive '/home/games/mame/roms/3dobios.zip' has SHA-1 'c4a2e5336f77fb5f743de1eea2cda43675ee2de7' and CRC 'b6f5028b'
17:03:57.379: ZIP scan: member '' from archive '/home/games/mame/roms/3dobios.zip' has SHA-1 '34bf189111295f74d7b7dfc1f304d98b8d36325a' and CRC 'c8c8ff89'
17:03:57.385: ZIP scan: member '' from archive '/home/games/mame/roms/3dobios.zip' has SHA-1 'b01c53da256dde43ffec4ad3fc3adfa8d635e943' and CRC 'd5cbc509'
17:03:57.385: database update: an object with SHA-1 '3c912300775d1ad730dc35757e279c274c0acaad' and CRC '58242cee' already exists in the database, member '' from archive '/home/games/mame/roms/3dobios.zip' ignored
17:03:57.385: database update: an object with SHA-1 'c4a2e5336f77fb5f743de1eea2cda43675ee2de7' and CRC 'b6f5028b' already exists in the database, member '' from archive '/home/games/mame/roms/3dobios.zip' ignored
17:03:57.385: database update: an object with SHA-1 '34bf189111295f74d7b7dfc1f304d98b8d36325a' and CRC 'c8c8ff89' already exists in the database, member '' from archive '/home/games/mame/roms/3dobios.zip' ignored
17:03:57.385: database update: an object with SHA-1 'b01c53da256dde43ffec4ad3fc3adfa8d635e943' and CRC 'd5cbc509' already exists in the database, member '' from archive '/home/games/mame/roms/3dobios.zip' ignored
17:03:57.385: scan finished for file '/home/games/mame/roms/3dobios.zip'
...

The empty names (member '' from archive) show another minizip-ng issue, probably a missing file.

belegdol commented 2 years ago

It has something to do with the data type changes unzGetCurrentFileInfo takes. I hardcoded 32767 instead of QMC2_ROMALYZER_ZIP_BUFFER_SIZE and names are showing now. Without this change, the cast in mz_compat.c line 980 fails.

belegdol commented 2 years ago
diff --git a/src/macros.h b/src/macros.h
index 2d1c5f30c..375ce1c31 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -359,7 +359,7 @@
 #define QMC2_SEARCH_TIMEOUT                    2500

 // buffer size for reading zip-files
-#define QMC2_ZIP_BUFFER_SIZE                   QMC2_64K
+#define QMC2_ZIP_BUFFER_SIZE                   QMC2_64K - 1

 // buffer size for reading regular files
 #define QMC2_FILE_BUFFER_SIZE                  QMC2_256K

This does the trick but I have no idea how right or wrong it is. 65536 cannot be cast to uint16_t.

qmc2 commented 2 years ago

Oh, this sounds as if it is the right way to go... I will try later!

qmc2 commented 2 years ago

I halved the QMC2_ZIP_BUFFER_SIZE to QMC2_32K and the result seems good so far. Thanks!