1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Return false from unPackBinary if no tracks are valid

This commit is contained in:
leo60228 2020-07-30 17:08:27 -04:00 committed by Misa Elizabeth Kai
parent f86a67456b
commit 668c3d91d6

View file

@ -770,7 +770,7 @@ bool FILESYSTEM_loadBinaryBlob(binaryBlob* blob, const char* filename)
{ {
PHYSFS_sint64 size; PHYSFS_sint64 size;
PHYSFS_File* handle; PHYSFS_File* handle;
int offset; int valid, offset;
size_t i; size_t i;
char path[MAX_PATH]; char path[MAX_PATH];
@ -796,6 +796,7 @@ bool FILESYSTEM_loadBinaryBlob(binaryBlob* blob, const char* filename)
sizeof(blob->m_headers) sizeof(blob->m_headers)
); );
valid = 0;
offset = sizeof(blob->m_headers); offset = sizeof(blob->m_headers);
for (i = 0; i < SDL_arraysize(blob->m_headers); ++i) 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); PHYSFS_readBytes(handle, *memblock, header->size);
offset += header->size; offset += header->size;
valid += 1;
continue; continue;
fail: fail:
header->valid = false; header->valid = false;
} }
PHYSFS_close(handle); PHYSFS_close(handle);
if (valid == 0)
{
return false;
}
printf("The complete reloaded file size: %lli\n", size); printf("The complete reloaded file size: %lli\n", size);
for (i = 0; i < SDL_arraysize(blob->m_headers); ++i) for (i = 0; i < SDL_arraysize(blob->m_headers); ++i)