Fix[storage]: fix previous commit not starting the game

This commit is contained in:
artdeell 2025-01-15 18:06:04 +03:00 committed by Maksim Belov
parent 9c83fc677b
commit 2f34549f65
2 changed files with 13 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import net.kdt.pojavlaunch.lifecycle.ContextExecutor; import net.kdt.pojavlaunch.lifecycle.ContextExecutor;
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
import net.kdt.pojavlaunch.tasks.AsyncAssetManager; import net.kdt.pojavlaunch.tasks.AsyncAssetManager;
import net.kdt.pojavlaunch.utils.*; import net.kdt.pojavlaunch.utils.*;
import net.kdt.pojavlaunch.utils.FileUtils; import net.kdt.pojavlaunch.utils.FileUtils;
@ -57,7 +58,15 @@ public class PojavApplication extends Application {
try { try {
super.onCreate(); super.onCreate();
if(Tools.checkStorageRoot(this)){
// Implicitly initializes early constants and storage constants.
// Required to run the main activity properly.
LauncherPreferences.loadPreferences(this);
} else {
// In other cases, only initialize enough for the basicmost basics to work
// and not explode.
Tools.initEarlyConstants(this); Tools.initEarlyConstants(this);
}
Tools.DEVICE_ARCHITECTURE = Architecture.getDeviceArchitecture(); Tools.DEVICE_ARCHITECTURE = Architecture.getDeviceArchitecture();
//Force x86 lib directory for Asus x86 based zenfones //Force x86 lib directory for Asus x86 based zenfones
if(Architecture.isx86Device() && Architecture.is32BitsDevice()){ if(Architecture.isx86Device() && Architecture.is32BitsDevice()){

View File

@ -14,6 +14,7 @@ import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
import net.kdt.pojavlaunch.tasks.AsyncAssetManager; import net.kdt.pojavlaunch.tasks.AsyncAssetManager;
public class TestStorageActivity extends Activity { public class TestStorageActivity extends Activity {
@ -60,8 +61,8 @@ public class TestStorageActivity extends Activity {
startActivity(new Intent(this, MissingStorageActivity.class)); startActivity(new Intent(this, MissingStorageActivity.class));
return; return;
} }
//Initialize constants after we confirm that we have storage. //Initialize constants (implicitly) and preferences after we confirm that we have storage.
Tools.initStorageConstants(getApplicationContext()); LauncherPreferences.loadPreferences(this);
AsyncAssetManager.unpackComponents(this); AsyncAssetManager.unpackComponents(this);
AsyncAssetManager.unpackSingleFiles(this); AsyncAssetManager.unpackSingleFiles(this);