diff --git a/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.Coldboot.kt b/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.Coldboot.kt index 9daff31..c5c0e5e 100644 --- a/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.Coldboot.kt +++ b/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.Coldboot.kt @@ -12,6 +12,7 @@ import id.psw.vshlauncher.livewallpaper.XMBWaveSurfaceView import id.psw.vshlauncher.submodules.GamepadSubmodule import id.psw.vshlauncher.typography.FontCollections import java.io.File +import java.nio.file.Files.exists import kotlin.system.exitProcess class VshViewColdBootState( @@ -62,10 +63,15 @@ fun XmbView.cbStart(){ fun XmbView.cbEnsureImageLoaded(){ if(state.coldBoot.image == null){ - val i = context.vsh.getAllPathsFor(VshBaseDirs.VSH_RESOURCES_DIR, "COLDBOOT.PNG", createParentDir = false).find { it.exists() } + + // Load custom coldboot if exists + val i = context.vsh.getAllPathsFor(VshBaseDirs.VSH_RESOURCES_DIR, "COLDBOOT.PNG", createParentDir = true).firstOrNull { it.exists() } if(i != null) { state.coldBoot.image = BitmapFactory.decodeFile(i.absolutePath) } - state.coldBoot.image = getDrawable(R.drawable.coldboot_internal)?.toBitmap(1280, 720) + // Load default if no custom coldboot can be loaded + if(state.coldBoot.image == null) { + state.coldBoot.image = getDrawable(R.drawable.coldboot_internal)?.toBitmap(1280, 720) + } } } @@ -141,7 +147,9 @@ fun XmbView.cbOnTouchScreen(a: PointF, b:PointF, act:Int){ } fun XmbView.cbEnd(){ - // NativeGL.setSpeed(state.coldBoot.waveSpeed) + // Unload coldboot image + state.coldBoot.image?.recycle() + state.coldBoot.image = null } fun XmbView.cbOnGamepad(k:GamepadSubmodule.Key, isPress:Boolean) : Boolean { diff --git a/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.Gameboot.kt b/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.Gameboot.kt index aa2a951..3a227aa 100644 --- a/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.Gameboot.kt +++ b/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.Gameboot.kt @@ -75,9 +75,15 @@ fun XmbView.gbStart(){ private fun XmbView.gbEnsureImageLoaded(){ if(state.gameBoot.image == null){ - val i = context.vsh.getAllPathsFor(VshBaseDirs.VSH_RESOURCES_DIR, "GAMEBOOT.PNG", createParentDir = false).find { it.exists() } + + // Load custom gameboot if exists + val i = context.vsh.getAllPathsFor(VshBaseDirs.VSH_RESOURCES_DIR, "GAMEBOOT.PNG", createParentDir = true).firstOrNull { it.exists() } if(i != null) { state.gameBoot.image = BitmapFactory.decodeFile(i.absolutePath) } - state.gameBoot.image = getDrawable(R.drawable.gameboot_internal)?.toBitmap(1280, 720) + + // Load default if no custom gameboot can be loaded + if(state.gameBoot.image == null){ + state.gameBoot.image = getDrawable(R.drawable.gameboot_internal)?.toBitmap(1280, 720) + } } if(state.gameBoot.pParticleTexture == null){ @@ -184,6 +190,10 @@ fun XmbView.gbOnTouchScreen(a:PointF, b:PointF, act:Int){ fun XmbView.gbEnd(){ state.gameBoot.currentTime = 0.0f + + // Unload gameboot image + state.gameBoot.image?.recycle() + state.gameBoot.image = null } fun XmbView.gbOnGamepad(k: GamepadSubmodule.Key, isPress:Boolean) : Boolean { diff --git a/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.kt b/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.kt index 7dcfa82..6e17a85 100644 --- a/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.kt +++ b/launcher_app/src/main/java/id/psw/vshlauncher/views/XmbView.kt @@ -6,7 +6,6 @@ import android.graphics.* import android.os.Build import android.text.TextPaint import android.util.AttributeSet -import android.util.Log import android.view.* import androidx.core.content.res.ResourcesCompat import androidx.core.graphics.drawable.toBitmap @@ -17,7 +16,6 @@ import id.psw.vshlauncher.activities.XMB import id.psw.vshlauncher.submodules.GamepadSubmodule import id.psw.vshlauncher.typography.FontCollections import id.psw.vshlauncher.views.dialogviews.SubDialogUI -import id.psw.vshlauncher.views.dialogviews.TestDialogView import java.util.* import kotlin.ConcurrentModificationException import kotlin.concurrent.thread