Browse Source

Set game source path when using virtual archive in Android.

This will also prevent double `love.filesystem.setSource()` call
in that case.
Miku AuahDark 3 years ago
parent
commit
1bb22d2e90
1 changed files with 7 additions and 5 deletions
  1. 7 5
      src/modules/filesystem/physfs/Filesystem.cpp

+ 7 - 5
src/modules/filesystem/physfs/Filesystem.cpp

@@ -232,15 +232,13 @@ bool Filesystem::setSource(const char *source)
 
 
 	PHYSFS_Io *gameLoveIO;
 	PHYSFS_Io *gameLoveIO;
 	bool hasFusedGame = love::android::checkFusedGame((void **) &gameLoveIO);
 	bool hasFusedGame = love::android::checkFusedGame((void **) &gameLoveIO);
+	bool isAAssetMounted = false;
 
 
 	if (hasFusedGame)
 	if (hasFusedGame)
 	{
 	{
 		if (gameLoveIO)
 		if (gameLoveIO)
-		{
 			// Actually we should just be able to mount gameLoveIO, but that's experimental.
 			// Actually we should just be able to mount gameLoveIO, but that's experimental.
 			gameLoveIO->destroy(gameLoveIO);
 			gameLoveIO->destroy(gameLoveIO);
-			goto oldschool;
-		}
 		else
 		else
 		{
 		{
 			if (!love::android::initializeVirtualArchive())
 			if (!love::android::initializeVirtualArchive())
@@ -248,11 +246,15 @@ bool Filesystem::setSource(const char *source)
 				SDL_Log("Unable to mount AAsset: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
 				SDL_Log("Unable to mount AAsset: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
 				return false;
 				return false;
 			}
 			}
+
+			// See love::android::initializeVirtualArchive()
+			new_search_path = "ASET.AASSET";
+			isAAssetMounted = true;
 		}
 		}
 	}
 	}
-	else
+
+	if (!isAAssetMounted)
 	{
 	{
-	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