1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-05 02:39:41 +01:00

Add FILESYSTEM_isAssetMounted()

This function will check if a specific file is a mounted per-level
custom asset, instead of being a variable that's true if ANY file is a
mounted asset.
This commit is contained in:
Misa 2021-03-06 10:48:02 -08:00 committed by Ethan Lee
parent ca4afcc140
commit 34865a8ef1
2 changed files with 21 additions and 0 deletions

View file

@ -361,6 +361,26 @@ void FILESYSTEM_unmountassets(void)
FILESYSTEM_assetsmounted = false; FILESYSTEM_assetsmounted = false;
} }
bool FILESYSTEM_isAssetMounted(const char* filename)
{
const char* realDir;
/* Fast path */
if (assetDir[0] == '\0')
{
return false;
}
realDir = PHYSFS_getRealDir(filename);
if (realDir == NULL)
{
return false;
}
return SDL_strcmp(assetDir, realDir) == 0;
}
void FILESYSTEM_freeMemory(unsigned char **mem); void FILESYSTEM_freeMemory(unsigned char **mem);
void FILESYSTEM_loadFileToMemory( void FILESYSTEM_loadFileToMemory(

View file

@ -20,6 +20,7 @@ void FILESYSTEM_loadZip(const char* filename);
extern bool FILESYSTEM_assetsmounted; extern bool FILESYSTEM_assetsmounted;
void FILESYSTEM_mountassets(const char *path); void FILESYSTEM_mountassets(const char *path);
void FILESYSTEM_unmountassets(void); void FILESYSTEM_unmountassets(void);
bool FILESYSTEM_isAssetMounted(const char* filename);
void FILESYSTEM_loadFileToMemory(const char *name, unsigned char **mem, void FILESYSTEM_loadFileToMemory(const char *name, unsigned char **mem,
size_t *len, bool addnull = false); size_t *len, bool addnull = false);