mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
Implement experimental fusing method.
https://github.com/love2d/love-android/issues/201#issuecomment-772628115
This commit is contained in:
@@ -108,6 +108,10 @@ Filesystem::Filesystem()
|
|||||||
|
|
||||||
Filesystem::~Filesystem()
|
Filesystem::~Filesystem()
|
||||||
{
|
{
|
||||||
|
#ifdef LOVE_ANDROID
|
||||||
|
love::android::deinitializeVirtualArchive();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (PHYSFS_isInit())
|
if (PHYSFS_isInit())
|
||||||
PHYSFS_deinit();
|
PHYSFS_deinit();
|
||||||
}
|
}
|
||||||
@@ -224,6 +228,31 @@ bool Filesystem::setSource(const char *source)
|
|||||||
if (!love::android::createStorageDirectories())
|
if (!love::android::createStorageDirectories())
|
||||||
SDL_Log("Error creating storage directories!");
|
SDL_Log("Error creating storage directories!");
|
||||||
|
|
||||||
|
new_search_path = "";
|
||||||
|
|
||||||
|
PHYSFS_Io *gameLoveIO;
|
||||||
|
bool hasFusedGame = love::android::checkFusedGame((void **) &gameLoveIO);
|
||||||
|
|
||||||
|
if (hasFusedGame)
|
||||||
|
{
|
||||||
|
if (gameLoveIO)
|
||||||
|
{
|
||||||
|
// Actually we should just be able to mount gameLoveIO, but that's experimental.
|
||||||
|
gameLoveIO->destroy(gameLoveIO);
|
||||||
|
goto oldschool;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!love::android::initializeVirtualArchive())
|
||||||
|
{
|
||||||
|
SDL_Log("Unable to mount AAsset: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oldschool:
|
||||||
new_search_path = love::android::getSelectedGameFile();
|
new_search_path = love::android::getSelectedGameFile();
|
||||||
|
|
||||||
// try mounting first, if that fails, load to memory and mount
|
// try mounting first, if that fails, load to memory and mount
|
||||||
@@ -250,6 +279,7 @@ bool Filesystem::setSource(const char *source)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
// Add the directory.
|
// Add the directory.
|
||||||
if (!PHYSFS_mount(new_search_path.c_str(), nullptr, 1))
|
if (!PHYSFS_mount(new_search_path.c_str(), nullptr, 1))
|
||||||
|
|||||||
Reference in New Issue
Block a user