1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-16 17:48:29 +02:00

cleanup: Don't savestatsandsettings if filesystem not init

This isn't necessary, but it does silence these annoying logs if you
pass an invalid argument or don't have data.zip:

    [ERROR] Could not get window size: Invalid renderer
    [WARN] Stats not loaded! Not writing unlock.vvv.
    [ERROR] Could not get window size: Invalid renderer
    [WARN] Settings not loaded! Not writing settings.vvv.

To do this, I've added FILESYSTEM_isInit().
This commit is contained in:
Misa 2022-03-14 10:45:19 -07:00
parent a168f73a67
commit 84279354e5
3 changed files with 10 additions and 1 deletions

View File

@ -186,6 +186,11 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
return 1;
}
bool FILESYSTEM_isInit(void)
{
return isInit;
}
static unsigned char* stdin_buffer = NULL;
static size_t stdin_length = 0;

View File

@ -10,6 +10,7 @@ class binaryBlob;
namespace tinyxml2 { class XMLDocument; }
int FILESYSTEM_init(char *argvZero, char* baseDir, char* assetsPath);
bool FILESYSTEM_isInit(void);
void FILESYSTEM_deinit(void);
char *FILESYSTEM_getUserSaveDirectory(void);

View File

@ -697,7 +697,10 @@ int main(int argc, char *argv[])
static void cleanup(void)
{
/* Order matters! */
game.savestatsandsettings();
if (FILESYSTEM_isInit()) /* not necessary but silences logs */
{
game.savestatsandsettings();
}
gameScreen.destroy();
graphics.grphx.destroy();
graphics.destroy_buffers();