From 668c3d91d681a2f010115e1cfaa034af841d7c9a Mon Sep 17 00:00:00 2001 From: leo60228 Date: Thu, 30 Jul 2020 17:08:27 -0400 Subject: [PATCH] Return false from unPackBinary if no tracks are valid --- desktop_version/src/FileSystemUtils.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index 46d3be8c..6bf17f0c 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -770,7 +770,7 @@ bool FILESYSTEM_loadBinaryBlob(binaryBlob* blob, const char* filename) { PHYSFS_sint64 size; PHYSFS_File* handle; - int offset; + int valid, offset; size_t i; char path[MAX_PATH]; @@ -796,6 +796,7 @@ bool FILESYSTEM_loadBinaryBlob(binaryBlob* blob, const char* filename) sizeof(blob->m_headers) ); + valid = 0; offset = sizeof(blob->m_headers); for (i = 0; i < SDL_arraysize(blob->m_headers); ++i) @@ -828,15 +829,20 @@ bool FILESYSTEM_loadBinaryBlob(binaryBlob* blob, const char* filename) } PHYSFS_readBytes(handle, *memblock, header->size); offset += header->size; + valid += 1; continue; - fail: header->valid = false; } PHYSFS_close(handle); + if (valid == 0) + { + return false; + } + printf("The complete reloaded file size: %lli\n", size); for (i = 0; i < SDL_arraysize(blob->m_headers); ++i)