1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Build and mount repo.zip with fonts/ and lang/

This commit is contained in:
leo60228 2023-09-05 14:21:57 -04:00 committed by Misa Elizabeth Kai
parent 3e0cf57a99
commit 945823ca30
2 changed files with 42 additions and 8 deletions

View file

@ -68,6 +68,32 @@ android {
enable true enable true
} }
} }
sourceSets {
main {
assets {
srcDir layout.buildDirectory.dir("generated/main/assets")
}
}
}
}
def zipRepoAssetsTask = tasks.register("zipRepoAssets", Zip) {
from('../../fonts') { spec ->
spec.into('graphics')
}
from('../../lang') { spec ->
spec.into('lang')
}
archiveFileName.set('repo.zip')
destinationDirectory.value(layout.buildDirectory.dir("generated/main/assets"))
}
project.android.applicationVariants.configureEach { variant ->
def compressAssetsTask = project.tasks.named("merge${variant.name.capitalize()}Assets")
compressAssetsTask.configure { task ->
task.dependsOn zipRepoAssetsTask
}
} }
dependencies { dependencies {

View file

@ -266,12 +266,6 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath, char* langD
basePath = SDL_strdup("./"); basePath = SDL_strdup("./");
} }
doesLangDirExist = mount_pre_datazip(mainLangDir, "lang", "lang/", langDir);
vlog_info("Languages directory: %s", mainLangDir);
doesFontsDirExist = mount_pre_datazip(NULL, "fonts", "graphics/", fontsDir);
/* Mount the stock content last */
#ifdef __ANDROID__ #ifdef __ANDROID__
// This is kind of a mess, but that's not really solvable unless we expect the user to download the data.zip manually. // This is kind of a mess, but that's not really solvable unless we expect the user to download the data.zip manually.
if (!PHYSFS_mount(PHYSFS_getBaseDir(), "/apk", 1)) if (!PHYSFS_mount(PHYSFS_getBaseDir(), "/apk", 1))
@ -279,9 +273,23 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath, char* langD
vlog_error("Failed to mount apk!"); vlog_error("Failed to mount apk!");
return 0; return 0;
} }
PHYSFS_File* zip = PHYSFS_openRead("/apk/assets/data.zip");
if (!zip || !PHYSFS_mountHandle(zip, "data.zip", NULL, 1)) PHYSFS_File* repoZip = PHYSFS_openRead("/apk/assets/repo.zip");
if (repoZip && PHYSFS_mountHandle(repoZip, "repo.zip", NULL, 1))
{
doesLangDirExist = true;
doesFontsDirExist = true;
}
PHYSFS_File* dataZip = PHYSFS_openRead("/apk/assets/data.zip");
if (!dataZip || !PHYSFS_mountHandle(dataZip, "data.zip", NULL, 1))
#else #else
doesLangDirExist = mount_pre_datazip(mainLangDir, "lang", "lang/", langDir);
vlog_info("Languages directory: %s", mainLangDir);
doesFontsDirExist = mount_pre_datazip(NULL, "fonts", "graphics/", fontsDir);
/* Mount the stock content last */
if (assetsPath) if (assetsPath)
{ {
SDL_strlcpy(output, assetsPath, sizeof(output)); SDL_strlcpy(output, assetsPath, sizeof(output));