mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Don't use PHYSFS_getRealDir() to check for .zip
Not sure why the original implementation decided to do things this way instead of snprintf'ing a path to the .zip itself. Otherwise, if the level is from data.zip, PHYSFS_getRealDir() will return the path of data.zip, which then fails to mount for separate reasons.
This commit is contained in:
parent
a1df4c1383
commit
124d77c041
1 changed files with 27 additions and 21 deletions
|
@ -513,13 +513,10 @@ bool FILESYSTEM_mountAssets(const char* path)
|
||||||
{
|
{
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
char virtual_path[MAX_PATH];
|
char virtual_path[MAX_PATH];
|
||||||
const char* real_path;
|
|
||||||
|
|
||||||
VVV_between(path, "levels/", filename, ".vvvvvv");
|
VVV_between(path, "levels/", filename, ".vvvvvv");
|
||||||
|
|
||||||
real_path = PHYSFS_getRealDir(path);
|
/* Check for a zipped up pack only containing assets first */
|
||||||
|
|
||||||
/* Check for a zipped up level pack first */
|
|
||||||
SDL_snprintf(
|
SDL_snprintf(
|
||||||
virtual_path,
|
virtual_path,
|
||||||
sizeof(virtual_path),
|
sizeof(virtual_path),
|
||||||
|
@ -537,30 +534,18 @@ bool FILESYSTEM_mountAssets(const char* path)
|
||||||
|
|
||||||
MAYBE_FAIL(graphics.reloadresources());
|
MAYBE_FAIL(graphics.reloadresources());
|
||||||
}
|
}
|
||||||
else if (real_path != NULL && endsWith(real_path, ".zip"))
|
|
||||||
{
|
|
||||||
/* This is a base zip, probably the official data.zip */
|
|
||||||
printf("Asset directory is .zip at %s\n", real_path);
|
|
||||||
|
|
||||||
if (!FILESYSTEM_mountAssetsFrom(real_path))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MAYBE_FAIL(graphics.reloadresources());
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* If it's not a level or base zip, look for a level folder */
|
|
||||||
SDL_snprintf(
|
SDL_snprintf(
|
||||||
virtual_path,
|
virtual_path,
|
||||||
sizeof(virtual_path),
|
sizeof(virtual_path),
|
||||||
"levels/%s/",
|
"levels/%s.zip",
|
||||||
filename
|
filename
|
||||||
);
|
);
|
||||||
if (FILESYSTEM_exists(virtual_path))
|
if (FILESYSTEM_exists(virtual_path))
|
||||||
{
|
{
|
||||||
printf("Asset directory exists at %s\n", virtual_path);
|
/* This is a full zipped-up level including assets */
|
||||||
|
printf("Asset directory is .zip at %s\n", virtual_path);
|
||||||
|
|
||||||
if (!FILESYSTEM_mountAssetsFrom(virtual_path))
|
if (!FILESYSTEM_mountAssetsFrom(virtual_path))
|
||||||
{
|
{
|
||||||
|
@ -571,8 +556,29 @@ bool FILESYSTEM_mountAssets(const char* path)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Wasn't a level zip, base zip, or folder! */
|
/* If it's not a level or base zip, look for a level folder */
|
||||||
puts("Asset directory does not exist");
|
SDL_snprintf(
|
||||||
|
virtual_path,
|
||||||
|
sizeof(virtual_path),
|
||||||
|
"levels/%s/",
|
||||||
|
filename
|
||||||
|
);
|
||||||
|
if (FILESYSTEM_exists(virtual_path))
|
||||||
|
{
|
||||||
|
printf("Asset directory exists at %s\n", virtual_path);
|
||||||
|
|
||||||
|
if (!FILESYSTEM_mountAssetsFrom(virtual_path))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MAYBE_FAIL(graphics.reloadresources());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Wasn't a level zip, base zip, or folder! */
|
||||||
|
puts("Asset directory does not exist");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue