mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Improve vlog statements when PHYSFS_openRead
fails
There are three different places where we call PHYSFS_openRead. This commit makes sure all of them print a statement upon failure along with the PhysFS reason for failure, and assigns the log level of each print as so: - FILESYSTEM_loadFileToMemory: Debug print (previously no print existed in the first place), because some files (such as font.txt) may or may not be needed, but if it isn't then no need to print and worry the user. The game will error anyway if a critical file like a graphics file is missing. - FILESYSTEM_loadBinaryBlob: Debug print (previously info print), because sometimes it's not needed, such as mmmmmm.vvv. I remember one user being worried that the game printed "Unable to open file mmmmmm.vvv" when it's not critical unlike vvvvvvmusic.vvv (and that file is assumed to exist if data.zip exists anyways). Though maybe we should move to loose-leaf files to save on memory usage (and so we don't have to use special tools to modify a binary blob)... - FILESYSTEM_loadZip: Error print. If we're calling this function, we really do expect the zip to be loaded, and if it fails because we can't open the file in the first place, then it would be good to know why.
This commit is contained in:
parent
ea4302b41e
commit
a23a4cbbd0
1 changed files with 18 additions and 1 deletions
|
@ -355,6 +355,14 @@ static bool FILESYSTEM_mountAssetsFrom(const char *fname)
|
||||||
void FILESYSTEM_loadZip(const char* filename)
|
void FILESYSTEM_loadZip(const char* filename)
|
||||||
{
|
{
|
||||||
PHYSFS_File* zip = PHYSFS_openRead(filename);
|
PHYSFS_File* zip = PHYSFS_openRead(filename);
|
||||||
|
if (zip == NULL)
|
||||||
|
{
|
||||||
|
vlog_error(
|
||||||
|
"Could not read zip %s: %s",
|
||||||
|
filename,
|
||||||
|
PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!PHYSFS_mountHandle(zip, filename, "levels", 1))
|
if (!PHYSFS_mountHandle(zip, filename, "levels", 1))
|
||||||
{
|
{
|
||||||
|
@ -589,6 +597,11 @@ void FILESYSTEM_loadFileToMemory(
|
||||||
handle = PHYSFS_openRead(name);
|
handle = PHYSFS_openRead(name);
|
||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
{
|
{
|
||||||
|
vlog_debug(
|
||||||
|
"Could not read file %s: %s",
|
||||||
|
name,
|
||||||
|
PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())
|
||||||
|
);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
length = PHYSFS_fileLength(handle);
|
length = PHYSFS_fileLength(handle);
|
||||||
|
@ -673,7 +686,11 @@ bool FILESYSTEM_loadBinaryBlob(binaryBlob* blob, const char* filename)
|
||||||
handle = PHYSFS_openRead(path);
|
handle = PHYSFS_openRead(path);
|
||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
{
|
{
|
||||||
vlog_info("Unable to open file %s", filename);
|
vlog_debug(
|
||||||
|
"Could not read binary blob %s: %s",
|
||||||
|
filename,
|
||||||
|
PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue