diff --git a/lemuroid-app/build.gradle.kts b/lemuroid-app/build.gradle.kts index aa2793b3f6..2567e6bbfe 100644 --- a/lemuroid-app/build.gradle.kts +++ b/lemuroid-app/build.gradle.kts @@ -8,7 +8,7 @@ plugins { android { defaultConfig { - versionCode = 147 + versionCode = 148 versionName = "1.11.1" applicationId = "com.swordfish.lemuroid" } diff --git a/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/mobile/feature/game/GameActivity.kt b/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/mobile/feature/game/GameActivity.kt index 3ea201193b..222eec7f69 100644 --- a/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/mobile/feature/game/GameActivity.kt +++ b/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/mobile/feature/game/GameActivity.kt @@ -103,7 +103,7 @@ class GameActivity : BaseGameActivity() { tiltSensor = TiltSensor(applicationContext) - serviceController = GameService.startService(applicationContext, game) + startGameService() setupVirtualGamePadVisibility() setupVirtualGamePads() @@ -286,11 +286,24 @@ class GameActivity : BaseGameActivity() { } override fun onDestroy() { - serviceController = GameService.stopService(applicationContext, serviceController) + stopGameService() virtualControllerDisposables.clear() super.onDestroy() } + private fun startGameService() { + serviceController = GameService.startService(applicationContext, game) + } + + private fun stopGameService() { + serviceController = GameService.stopService(applicationContext, serviceController) + } + + override fun onFinishTriggered() { + super.onFinishTriggered() + stopGameService() + } + private fun getGamePadTheme(context: Context): RadialGamePadTheme { val accentColor = GraphicsUtils.colorToRgb(context.getColor(R.color.colorPrimary)) val alpha = (255 * PRESSED_COLOR_ALPHA).roundToInt() diff --git a/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/shared/game/BaseGameActivity.kt b/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/shared/game/BaseGameActivity.kt index 7d9bc7d912..7f992912d2 100644 --- a/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/shared/game/BaseGameActivity.kt +++ b/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/shared/game/BaseGameActivity.kt @@ -681,6 +681,7 @@ abstract class BaseGameActivity : ImmersiveActivity() { } private fun finishAndExitProcess() { + onFinishTriggered() GlobalScope.launch { sleep(animationDuration().toLong()) exitProcess(0) @@ -689,6 +690,8 @@ abstract class BaseGameActivity : ImmersiveActivity() { overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out) } + open fun onFinishTriggered() { } + private fun cancelBackgroundWork() { SaveSyncWork.cancelAutoWork(applicationContext) SaveSyncWork.cancelManualWork(applicationContext)