From 33e4bc37ad7f1e16bd6a00636f69130e544e8e82 Mon Sep 17 00:00:00 2001 From: Petr Bartos Date: Mon, 16 May 2022 21:37:43 +0200 Subject: [PATCH 1/2] Delete obsolete glsl folder on startup --- .../com/drbeef/ioq3quest/MainActivity.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/android/app/src/main/java/com/drbeef/ioq3quest/MainActivity.java b/android/app/src/main/java/com/drbeef/ioq3quest/MainActivity.java index 772dffd1..ef32c167 100644 --- a/android/app/src/main/java/com/drbeef/ioq3quest/MainActivity.java +++ b/android/app/src/main/java/com/drbeef/ioq3quest/MainActivity.java @@ -124,10 +124,15 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback copy_asset("/sdcard/ioquake3Quest/baseq3", "pakQ3Q.pk3", true); copy_asset("/sdcard/ioquake3Quest/missionpack", "pakQ3Q.pk3", true); + // cleanup incompatible shaders + delete_asset("/sdcard/ioquake3Quest/baseq3/glsl"); + delete_asset("/sdcard/ioquake3Quest/missionpack/glsl"); + //If open arena is installed then copy necessary stuff if (new File("/sdcard/ioquake3Quest/baseoa").exists()) { copy_asset("/sdcard/ioquake3Quest/baseoa", "autoexec_oa.cfg", "autoexec.cfg", false); copy_asset("/sdcard/ioquake3Quest/baseoa", "pakQ3Q.pk3", true); + delete_asset("/sdcard/ioquake3Quest/baseoa/glsl"); } //Read these from a file and pass through @@ -191,6 +196,23 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback } } + public void delete_asset(String path) { + File file = new File(path); + delete_asset(file); + } + + public void delete_asset(File file) { + if (!file.exists()) { + return; + } + if (file.isDirectory()) { + for (File nestedFile : file.listFiles()) { + delete_asset(nestedFile); + } + } + file.delete(); + } + public void _copy_asset(String name_in, String name_out) { AssetManager assets = this.getAssets(); From d322b861f254e526bed29e76210b11fccc35206f Mon Sep 17 00:00:00 2001 From: Petr Bartos Date: Wed, 18 May 2022 22:48:05 +0200 Subject: [PATCH 2/2] Do not create missionpack folder if not installed --- .../com/drbeef/ioq3quest/MainActivity.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/android/app/src/main/java/com/drbeef/ioq3quest/MainActivity.java b/android/app/src/main/java/com/drbeef/ioq3quest/MainActivity.java index ef32c167..861f2a9d 100644 --- a/android/app/src/main/java/com/drbeef/ioq3quest/MainActivity.java +++ b/android/app/src/main/java/com/drbeef/ioq3quest/MainActivity.java @@ -108,27 +108,26 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback } public void create() throws IOException { - //Make the directories + // Prepare base game directory new File("/sdcard/ioquake3Quest/baseq3").mkdirs(); - new File("/sdcard/ioquake3Quest/missionpack").mkdirs(); - //Copy the command line params file + // Copy the command line params file and autoexec copy_asset("/sdcard/ioquake3Quest", "commandline.txt", false); copy_asset("/sdcard/ioquake3Quest/baseq3", "autoexec.cfg", false); - copy_asset("/sdcard/ioquake3Quest/missionpack", "autoexec.cfg", false); - - //copy demo - copy_asset("/sdcard/ioquake3Quest/baseq3", "pak0.pk3", false); - - //our special pak files + // Copy our special pak file and demo copy_asset("/sdcard/ioquake3Quest/baseq3", "pakQ3Q.pk3", true); - copy_asset("/sdcard/ioquake3Quest/missionpack", "pakQ3Q.pk3", true); - - // cleanup incompatible shaders + copy_asset("/sdcard/ioquake3Quest/baseq3", "pak0.pk3", false); + // Cleanup incompatible shaders delete_asset("/sdcard/ioquake3Quest/baseq3/glsl"); - delete_asset("/sdcard/ioquake3Quest/missionpack/glsl"); - //If open arena is installed then copy necessary stuff + // If Team Arena is installed then copy necessary stuff + if (new File("/sdcard/ioquake3Quest/missionpack").exists()) { + copy_asset("/sdcard/ioquake3Quest/missionpack", "autoexec.cfg", false); + copy_asset("/sdcard/ioquake3Quest/missionpack", "pakQ3Q.pk3", true); + delete_asset("/sdcard/ioquake3Quest/missionpack/glsl"); + } + + // If Open Arena is installed then copy necessary stuff if (new File("/sdcard/ioquake3Quest/baseoa").exists()) { copy_asset("/sdcard/ioquake3Quest/baseoa", "autoexec_oa.cfg", "autoexec.cfg", false); copy_asset("/sdcard/ioquake3Quest/baseoa", "pakQ3Q.pk3", true);