Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Swordfish90 committed Jul 4, 2022
2 parents 4a7d9f3 + b4686ed commit b29582c
Show file tree
Hide file tree
Showing 26 changed files with 266 additions and 194 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object deps {
const val room = "2.3.0"
const val epoxy = "4.6.3-vinay-compose"
const val serialization = "1.2.2"
const val libretrodroid = "0.8.0"
const val libretrodroid = "0.8.1"
const val radialgamepad = "1.1.0"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CoreUpdaterImpl(

// This is the last tagged versions of cores.
companion object {
private const val CORES_VERSION = "1.13"
private const val CORES_VERSION = "1.14"
}

private val baseUri = Uri.parse("https://github.com/Swordfish90/LemuroidCores/")
Expand Down
4 changes: 2 additions & 2 deletions lemuroid-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ plugins {

android {
defaultConfig {
versionCode = 172
versionName = "1.13.3" // Always remember to update Cores Tag!
versionCode = 174
versionName = "1.14.0" // Always remember to update Cores Tag!
applicationId = "com.swordfish.lemuroid"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,17 @@ abstract class LemuroidApplicationModule {
coreVariablesManager: CoreVariablesManager,
retrogradeDatabase: RetrogradeDatabase,
savesCoherencyEngine: SavesCoherencyEngine,
directoriesManager: DirectoriesManager
directoriesManager: DirectoriesManager,
biosManager: BiosManager
) = GameLoader(
lemuroidLibrary,
statesManager,
savesManager,
coreVariablesManager,
retrogradeDatabase,
savesCoherencyEngine,
directoriesManager
directoriesManager,
biosManager
)

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.appcompat.widget.SearchView
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.ViewModelProvider
import androidx.paging.cachedIn
import androidx.recyclerview.widget.LinearLayoutManager
import com.jakewharton.rxbinding3.appcompat.queryTextChanges
import com.jakewharton.rxrelay2.PublishRelay
import com.swordfish.lemuroid.R
import com.swordfish.lemuroid.app.mobile.shared.GamesAdapter
import com.swordfish.lemuroid.app.mobile.shared.RecyclerViewFragment
Expand All @@ -19,10 +21,9 @@ import com.swordfish.lemuroid.app.shared.covers.CoverLoader
import com.swordfish.lemuroid.lib.library.db.RetrogradeDatabase
import com.swordfish.lemuroid.common.view.setVisibleOrGone
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider
import com.uber.autodispose.android.lifecycle.scope
import com.uber.autodispose.android.lifecycle.autoDispose
import com.uber.autodispose.autoDispose
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.subjects.PublishSubject
import java.util.concurrent.TimeUnit
import javax.inject.Inject

Expand All @@ -34,7 +35,7 @@ class SearchFragment : RecyclerViewFragment() {

private lateinit var searchViewModel: SearchViewModel

private var searchSubject: PublishSubject<String> = PublishSubject.create()
private val searchRelay: PublishRelay<String> = PublishRelay.create()

override fun onAttach(context: Context) {
super.onAttach(context)
Expand Down Expand Up @@ -62,7 +63,7 @@ class SearchFragment : RecyclerViewFragment() {
emptyView?.setVisibleOrGone(gamesAdapter.itemCount == 0)
}

searchSubject
searchRelay
.distinctUntilChanged()
.autoDispose(AndroidLifecycleScopeProvider.from(viewLifecycleOwner))
.subscribe { searchViewModel.queryString.postValue(it) }
Expand Down Expand Up @@ -94,8 +95,8 @@ class SearchFragment : RecyclerViewFragment() {
.debounce(1, TimeUnit.SECONDS)
.map { it.toString() }
.observeOn(AndroidSchedulers.mainThread())
.autoDispose(scope())
.subscribe(searchSubject)
.autoDispose(this, Lifecycle.Event.ON_DESTROY)
.subscribe(searchRelay)
}

@dagger.Module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ abstract class BaseGameActivity : ImmersiveActivity() {

private fun setUpExceptionsHandler() {
Thread.setDefaultUncaughtExceptionHandler { thread, exception ->
performUnsuccessfulActivityFinish(exception)
performUnexpectedErrorFinish(exception)
defaultExceptionHandler?.uncaughtException(thread, exception)
}
}
Expand Down Expand Up @@ -303,11 +303,11 @@ abstract class BaseGameActivity : ImmersiveActivity() {
private fun handleRetroViewError(errorCode: Int) {
Timber.e("Error in GLRetroView $errorCode")
val gameLoaderError = when (errorCode) {
GLRetroView.ERROR_GL_NOT_COMPATIBLE -> GameLoaderError.GL_INCOMPATIBLE
GLRetroView.ERROR_LOAD_GAME -> GameLoaderError.LOAD_GAME
GLRetroView.ERROR_LOAD_LIBRARY -> GameLoaderError.LOAD_CORE
GLRetroView.ERROR_SERIALIZATION -> GameLoaderError.SAVES
else -> GameLoaderError.GENERIC
GLRetroView.ERROR_GL_NOT_COMPATIBLE -> GameLoaderError.GLIncompatible
GLRetroView.ERROR_LOAD_GAME -> GameLoaderError.LoadGame
GLRetroView.ERROR_LOAD_LIBRARY -> GameLoaderError.LoadCore
GLRetroView.ERROR_SERIALIZATION -> GameLoaderError.Saves
else -> GameLoaderError.Generic
}
retroGameView = null
displayGameLoaderError(gameLoaderError, systemCoreConfig)
Expand Down Expand Up @@ -736,14 +736,23 @@ abstract class BaseGameActivity : ImmersiveActivity() {
finishAndExitProcess()
}

private fun performUnsuccessfulActivityFinish(exception: Throwable) {
private fun performUnexpectedErrorFinish(exception: Throwable) {
Timber.e(exception, "Handling java exception in BaseGameActivity")
val resultIntent = Intent().apply {
putExtra(PLAY_GAME_RESULT_ERROR, exception.message)
}

setResult(Activity.RESULT_CANCELED, resultIntent)
finish()
setResult(RESULT_UNEXPECTED_ERROR, resultIntent)
finishAndExitProcess()
}

private fun performErrorFinish(message: String) {
val resultIntent = Intent().apply {
putExtra(PLAY_GAME_RESULT_ERROR, message)
}

setResult(RESULT_ERROR, resultIntent)
finishAndExitProcess()
}

private fun finishAndExitProcess() {
Expand Down Expand Up @@ -964,6 +973,23 @@ abstract class BaseGameActivity : ImmersiveActivity() {
}
}

private fun displayGameLoaderError(gameError: GameLoaderError, coreConfig: SystemCoreConfig) {

val messageId = when (gameError) {
is GameLoaderError.GLIncompatible -> getString(R.string.game_loader_error_gl_incompatible)
is GameLoaderError.Generic -> getString(R.string.game_loader_error_generic)
is GameLoaderError.LoadCore -> getString(R.string.game_loader_error_load_core)
is GameLoaderError.LoadGame -> getString(R.string.game_loader_error_load_game)
is GameLoaderError.Saves -> getString(R.string.game_loader_error_save)
is GameLoaderError.MissingBiosFiles -> getString(
R.string.game_loader_error_missing_bios,
gameError.missingFiles
)
}

performErrorFinish(messageId)
}

companion object {
const val DIALOG_REQUEST = 100

Expand All @@ -978,6 +1004,9 @@ abstract class BaseGameActivity : ImmersiveActivity() {
const val PLAY_GAME_RESULT_LEANBACK = "PLAY_GAME_RESULT_LEANBACK"
const val PLAY_GAME_RESULT_ERROR = "PLAY_GAME_RESULT_ERROR"

const val RESULT_ERROR = Activity.RESULT_FIRST_USER + 2
const val RESULT_UNEXPECTED_ERROR = Activity.RESULT_FIRST_USER + 3

fun launchGame(
activity: Activity,
systemCoreConfig: SystemCoreConfig,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
package com.swordfish.lemuroid.app.shared.gamecrash

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.widget.TextView
import com.swordfish.lemuroid.R
import com.swordfish.lemuroid.common.view.setVisibleOrGone

class GameCrashActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_crash)

val message = intent.getStringExtra(EXTRA_MESSAGE)?.let {
getString(R.string.lemuroid_crash_message, it)
val message = intent.getStringExtra(EXTRA_MESSAGE)
val messageDetail = intent.getStringExtra(EXTRA_MESSAGE_DETAIL)

findViewById<TextView>(R.id.text1).apply {
setVisibleOrGone(!message.isNullOrEmpty())
text = message
}

findViewById<TextView>(R.id.crashmessage).text = message
findViewById<TextView>(R.id.text2).apply {
setVisibleOrGone(!messageDetail.isNullOrEmpty())
text = messageDetail
}
}

companion object {
const val EXTRA_MESSAGE = "EXTRA_MESSAGE"
private const val EXTRA_MESSAGE = "EXTRA_MESSAGE"
private const val EXTRA_MESSAGE_DETAIL = "EXTRA_MESSAGE_DETAIL"

fun launch(activity: Activity, message: String, messageDetail: String?) {
val intent = Intent(activity, GameCrashActivity::class.java).apply {
putExtra(EXTRA_MESSAGE, message)
putExtra(EXTRA_MESSAGE_DETAIL, messageDetail)
}
activity.startActivity(intent)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.swordfish.lemuroid.app.shared.main
import android.app.Activity
import android.content.Context
import android.content.Intent
import com.swordfish.lemuroid.R
import com.swordfish.lemuroid.app.shared.game.BaseGameActivity
import com.swordfish.lemuroid.app.shared.gamecrash.GameCrashActivity
import com.swordfish.lemuroid.app.shared.savesync.SaveSyncWork
Expand All @@ -28,10 +29,19 @@ class GameLaunchTaskHandler(

fun handleGameFinish(enableRatingFlow: Boolean, activity: Activity, resultCode: Int, data: Intent?): Completable {
rescheduleBackgroundWork(activity.applicationContext)
return if (resultCode == Activity.RESULT_OK) {
handleSuccessfulGameFinish(activity, enableRatingFlow, data)
} else {
handleUnsuccessfulGameFinish(activity, data)
return when (resultCode) {
Activity.RESULT_OK -> handleSuccessfulGameFinish(activity, enableRatingFlow, data)
BaseGameActivity.RESULT_ERROR -> handleUnsuccessfulGameFinish(
activity,
data?.getStringExtra(BaseGameActivity.PLAY_GAME_RESULT_ERROR)!!,
null
)
BaseGameActivity.RESULT_UNEXPECTED_ERROR -> handleUnsuccessfulGameFinish(
activity,
activity.getString(R.string.lemuroid_crash_disclamer),
data?.getStringExtra(BaseGameActivity.PLAY_GAME_RESULT_ERROR)
)
else -> Completable.complete()
}
}

Expand All @@ -47,13 +57,9 @@ class GameLaunchTaskHandler(
CacheCleanerWork.enqueueCleanCacheLRU(context)
}

private fun handleUnsuccessfulGameFinish(activity: Activity, data: Intent?): Completable {
private fun handleUnsuccessfulGameFinish(activity: Activity, message: String, messageDetail: String?): Completable {
return Completable.fromAction {
val message = data?.getStringExtra(BaseGameActivity.PLAY_GAME_RESULT_ERROR)
val intent = Intent(activity, GameCrashActivity::class.java).apply {
putExtra(GameCrashActivity.EXTRA_MESSAGE, message)
}
activity.startActivity(intent)
GameCrashActivity.launch(activity, message, messageDetail)
}.subscribeOn(AndroidSchedulers.mainThread())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class BiosPreferences(private val biosManager: BiosManager) {
private fun createBiosPreference(context: Context, bios: Bios): Preference {
val preference = Preference(context)
preference.title = bios.description
preference.summary = bios.fileName
preference.summary = bios.displayName()
preference.isIconSpaceReserved = false
return preference
}
Expand Down
5 changes: 0 additions & 5 deletions lemuroid-app/src/main/res/drawable/bug.xml

This file was deleted.

5 changes: 5 additions & 0 deletions lemuroid-app/src/main/res/drawable/ic_warning.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="96dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="96dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M1,21h22L12,2 1,21zM13,18h-2v-2h2v2zM13,14h-2v-4h2v4z"/>
</vector>
7 changes: 3 additions & 4 deletions lemuroid-app/src/main/res/layout/activity_crash.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@
android:layout_margin="32dp">

<ImageView
android:src="@drawable/bug"
android:id="@+id/bugimage"
android:src="@drawable/ic_warning"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/crashtext"
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/lemuroid_crash_disclamer" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/crashmessage"
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp" />
Expand Down
1 change: 1 addition & 0 deletions lemuroid-app/src/main/res/values/material-themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<style name="LemuroidMaterialTheme.Game" parent="LemuroidMaterialTheme">
<item name="android:windowBackground">@android:color/black</item>
<item name="android:navigationBarColor">@android:color/black</item>
<item name="android:statusBarColor">@android:color/black</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges</item>
</style>

Expand Down
2 changes: 0 additions & 2 deletions lemuroid-app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@
\n\n If none of the above works, it might be possible that this Game/Core is not supported by this device.
</string>

<string name="lemuroid_crash_message">Error message: %1$s</string>

<string name="error_message_incompatible_state">This save state is not compatible with the current core version. Please load the latest in-game save or use a previous Lemuroid version.</string>

<string-array name="pref_key_shader_filter_names">
Expand Down
2 changes: 1 addition & 1 deletion lemuroid-cores
Submodule lemuroid-cores updated 62 files
+ lemuroid_core_citra/src/main/jniLibs/arm64-v8a/libcitra_libretro_android.so
+ lemuroid_core_desmume/src/main/jniLibs/arm64-v8a/libdesmume_libretro_android.so
+ lemuroid_core_desmume/src/main/jniLibs/armeabi-v7a/libdesmume_libretro_android.so
+ lemuroid_core_desmume/src/main/jniLibs/x86/libdesmume_libretro_android.so
+ lemuroid_core_desmume/src/main/jniLibs/x86_64/libdesmume_libretro_android.so
+ lemuroid_core_dosbox_pure/src/main/jniLibs/arm64-v8a/libdosbox_pure_libretro_android.so
+ lemuroid_core_dosbox_pure/src/main/jniLibs/armeabi-v7a/libdosbox_pure_libretro_android.so
+ lemuroid_core_dosbox_pure/src/main/jniLibs/x86/libdosbox_pure_libretro_android.so
+ lemuroid_core_dosbox_pure/src/main/jniLibs/x86_64/libdosbox_pure_libretro_android.so
+ lemuroid_core_fbneo/src/main/jniLibs/arm64-v8a/libfbneo_libretro_android.so
+ lemuroid_core_fbneo/src/main/jniLibs/armeabi-v7a/libfbneo_libretro_android.so
+ lemuroid_core_fbneo/src/main/jniLibs/x86/libfbneo_libretro_android.so
+ lemuroid_core_fbneo/src/main/jniLibs/x86_64/libfbneo_libretro_android.so
+ lemuroid_core_fceumm/src/main/jniLibs/arm64-v8a/libfceumm_libretro_android.so
+ lemuroid_core_fceumm/src/main/jniLibs/armeabi-v7a/libfceumm_libretro_android.so
+ lemuroid_core_fceumm/src/main/jniLibs/x86/libfceumm_libretro_android.so
+ lemuroid_core_fceumm/src/main/jniLibs/x86_64/libfceumm_libretro_android.so
+ lemuroid_core_gambatte/src/main/jniLibs/arm64-v8a/libgambatte_libretro_android.so
+ lemuroid_core_gambatte/src/main/jniLibs/armeabi-v7a/libgambatte_libretro_android.so
+ lemuroid_core_gambatte/src/main/jniLibs/x86/libgambatte_libretro_android.so
+ lemuroid_core_gambatte/src/main/jniLibs/x86_64/libgambatte_libretro_android.so
+ lemuroid_core_genesis_plus_gx/src/main/jniLibs/arm64-v8a/libgenesis_plus_gx_libretro_android.so
+ lemuroid_core_genesis_plus_gx/src/main/jniLibs/armeabi-v7a/libgenesis_plus_gx_libretro_android.so
+ lemuroid_core_genesis_plus_gx/src/main/jniLibs/x86/libgenesis_plus_gx_libretro_android.so
+ lemuroid_core_genesis_plus_gx/src/main/jniLibs/x86_64/libgenesis_plus_gx_libretro_android.so
+ lemuroid_core_handy/src/main/jniLibs/arm64-v8a/libhandy_libretro_android.so
+ lemuroid_core_handy/src/main/jniLibs/armeabi-v7a/libhandy_libretro_android.so
+ lemuroid_core_handy/src/main/jniLibs/x86/libhandy_libretro_android.so
+ lemuroid_core_handy/src/main/jniLibs/x86_64/libhandy_libretro_android.so
+ lemuroid_core_mame2003_plus/src/main/jniLibs/arm64-v8a/libmame2003_plus_libretro_android.so
+ lemuroid_core_mame2003_plus/src/main/jniLibs/armeabi-v7a/libmame2003_plus_libretro_android.so
+ lemuroid_core_mame2003_plus/src/main/jniLibs/x86/libmame2003_plus_libretro_android.so
+ lemuroid_core_mame2003_plus/src/main/jniLibs/x86_64/libmame2003_plus_libretro_android.so
+ lemuroid_core_mednafen_ngp/src/main/jniLibs/arm64-v8a/libmednafen_ngp_libretro_android.so
+ lemuroid_core_mednafen_ngp/src/main/jniLibs/armeabi-v7a/libmednafen_ngp_libretro_android.so
+ lemuroid_core_mednafen_ngp/src/main/jniLibs/x86/libmednafen_ngp_libretro_android.so
+ lemuroid_core_mednafen_ngp/src/main/jniLibs/x86_64/libmednafen_ngp_libretro_android.so
+ lemuroid_core_mednafen_pce_fast/src/main/jniLibs/arm64-v8a/libmednafen_pce_fast_libretro_android.so
+ lemuroid_core_mednafen_pce_fast/src/main/jniLibs/armeabi-v7a/libmednafen_pce_fast_libretro_android.so
+ lemuroid_core_mednafen_pce_fast/src/main/jniLibs/x86/libmednafen_pce_fast_libretro_android.so
+ lemuroid_core_mednafen_pce_fast/src/main/jniLibs/x86_64/libmednafen_pce_fast_libretro_android.so
+ lemuroid_core_mednafen_wswan/src/main/jniLibs/arm64-v8a/libmednafen_wswan_libretro_android.so
+ lemuroid_core_mednafen_wswan/src/main/jniLibs/armeabi-v7a/libmednafen_wswan_libretro_android.so
+ lemuroid_core_mednafen_wswan/src/main/jniLibs/x86/libmednafen_wswan_libretro_android.so
+ lemuroid_core_mednafen_wswan/src/main/jniLibs/x86_64/libmednafen_wswan_libretro_android.so
+ lemuroid_core_mupen64plus_next_gles3/src/main/jniLibs/arm64-v8a/libmupen64plus_next_gles3_libretro_android.so
+ ...roid_core_mupen64plus_next_gles3/src/main/jniLibs/armeabi-v7a/libmupen64plus_next_gles3_libretro_android.so
+ lemuroid_core_mupen64plus_next_gles3/src/main/jniLibs/x86/libmupen64plus_next_gles3_libretro_android.so
+ lemuroid_core_mupen64plus_next_gles3/src/main/jniLibs/x86_64/libmupen64plus_next_gles3_libretro_android.so
+ lemuroid_core_pcsx_rearmed/src/main/jniLibs/arm64-v8a/libpcsx_rearmed_libretro_android.so
+ lemuroid_core_pcsx_rearmed/src/main/jniLibs/armeabi-v7a/libpcsx_rearmed_libretro_android.so
+ lemuroid_core_pcsx_rearmed/src/main/jniLibs/x86/libpcsx_rearmed_libretro_android.so
+ lemuroid_core_pcsx_rearmed/src/main/jniLibs/x86_64/libpcsx_rearmed_libretro_android.so
+ lemuroid_core_snes9x/src/main/jniLibs/arm64-v8a/libsnes9x_libretro_android.so
+ lemuroid_core_snes9x/src/main/jniLibs/armeabi-v7a/libsnes9x_libretro_android.so
+ lemuroid_core_snes9x/src/main/jniLibs/x86/libsnes9x_libretro_android.so
+ lemuroid_core_snes9x/src/main/jniLibs/x86_64/libsnes9x_libretro_android.so
+ lemuroid_core_stella/src/main/jniLibs/arm64-v8a/libstella_libretro_android.so
+ lemuroid_core_stella/src/main/jniLibs/armeabi-v7a/libstella_libretro_android.so
+ lemuroid_core_stella/src/main/jniLibs/x86/libstella_libretro_android.so
+ lemuroid_core_stella/src/main/jniLibs/x86_64/libstella_libretro_android.so
+15 −15 update_cores.ipy
Binary file not shown.
Loading

0 comments on commit b29582c

Please sign in to comment.