diff options
author | Abandoned Cart <twistedumbrella@gmail.com> | 2023-06-17 17:24:19 +0200 |
---|---|---|
committer | Abandoned Cart <twistedumbrella@gmail.com> | 2023-06-22 00:23:13 +0200 |
commit | cfc6ef42d965ac9391080876fc25e5acb1d3af77 (patch) | |
tree | 1ca23da1867e0f0b7197688dd61cce01052a4d65 /src | |
parent | Fix JNI and expose mute settings to Android (diff) | |
download | yuzu-cfc6ef42d965ac9391080876fc25e5acb1d3af77.tar yuzu-cfc6ef42d965ac9391080876fc25e5acb1d3af77.tar.gz yuzu-cfc6ef42d965ac9391080876fc25e5acb1d3af77.tar.bz2 yuzu-cfc6ef42d965ac9391080876fc25e5acb1d3af77.tar.lz yuzu-cfc6ef42d965ac9391080876fc25e5acb1d3af77.tar.xz yuzu-cfc6ef42d965ac9391080876fc25e5acb1d3af77.tar.zst yuzu-cfc6ef42d965ac9391080876fc25e5acb1d3af77.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt | 4 | ||||
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt | 35 | ||||
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt | 2 | ||||
-rw-r--r-- | src/android/app/src/main/jni/native.cpp | 4 | ||||
-rw-r--r-- | src/android/app/src/main/res/drawable/ic_pip_unmute.xml (renamed from src/android/app/src/main/res/drawable/ic_pip_sound.xml) | 0 | ||||
-rw-r--r-- | src/android/app/src/main/res/values/strings.xml | 2 |
6 files changed, 25 insertions, 22 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt index 6a4e07046..9c32e044c 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt @@ -286,7 +286,7 @@ object NativeLibrary { /** * Unpauses emulation from a paused state. */ - external fun unPauseEmulation() + external fun unpauseEmulation() /** * Pauses emulation. @@ -321,7 +321,7 @@ object NativeLibrary { /** * Unmutes emulation sound */ - external fun unMuteAudio(): Boolean + external fun unmuteAudio(): Boolean /** * Returns true if emulation audio is muted. diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt index b77c21380..2b63388cc 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt @@ -64,7 +64,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { private val actionPause = "ACTION_EMULATOR_PAUSE" private val actionPlay = "ACTION_EMULATOR_PLAY" private val actionMute = "ACTION_EMULATOR_MUTE" - private val actionSound = "ACTION_EMULATOR_SOUND" + private val actionUnmute = "ACTION_EMULATOR_UNMUTE" private val settingsViewModel: SettingsViewModel by viewModels() @@ -308,20 +308,23 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { } if (NativeLibrary.isMuted()) { - val soundIcon = Icon.createWithResource(this@EmulationActivity, R.drawable.ic_pip_sound) - val soundPendingIntent = PendingIntent.getBroadcast( + val unmuteIcon = Icon.createWithResource( this@EmulationActivity, - R.drawable.ic_pip_sound, - Intent(actionSound), + R.drawable.ic_pip_unmute + ) + val unmutePendingIntent = PendingIntent.getBroadcast( + this@EmulationActivity, + R.drawable.ic_pip_unmute, + Intent(actionUnmute), pendingFlags ) - val soundRemoteAction = RemoteAction( - soundIcon, - getString(R.string.sound), - getString(R.string.sound), - soundPendingIntent + val unmuteRemoteAction = RemoteAction( + unmuteIcon, + getString(R.string.unmute), + getString(R.string.unmute), + unmutePendingIntent ) - pictureInPictureActions.add(soundRemoteAction) + pictureInPictureActions.add(unmuteRemoteAction) } else { val muteIcon = Icon.createWithResource(this@EmulationActivity, R.drawable.ic_pip_mute) val mutePendingIntent = PendingIntent.getBroadcast( @@ -356,12 +359,12 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { private var pictureInPictureReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent) { if (intent.action == actionPlay) { - if (NativeLibrary.isPaused()) NativeLibrary.unPauseEmulation() + if (NativeLibrary.isPaused()) NativeLibrary.unpauseEmulation() } else if (intent.action == actionPause) { if (!NativeLibrary.isPaused()) NativeLibrary.pauseEmulation() } - if (intent.action == actionSound) { - if (NativeLibrary.isMuted()) NativeLibrary.unMuteAudio() + if (intent.action == actionUnmute) { + if (NativeLibrary.isMuted()) NativeLibrary.unmuteAudio() } else if (intent.action == actionMute) { if (!NativeLibrary.isMuted()) NativeLibrary.muteAudio() } @@ -379,7 +382,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { addAction(actionPause) addAction(actionPlay) addAction(actionMute) - addAction(actionSound) + addAction(actionUnmute) }.also { registerReceiver(pictureInPictureReceiver, it) } @@ -389,7 +392,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { } catch (ignored: Exception) { } // Always resume audio, since there is no UI button - if (NativeLibrary.isMuted()) NativeLibrary.unMuteAudio() + if (NativeLibrary.isMuted()) NativeLibrary.unmuteAudio() } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt index 4643418c1..09976db62 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt @@ -714,7 +714,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { State.PAUSED -> { Log.debug("[EmulationFragment] Resuming emulation.") NativeLibrary.surfaceChanged(surface) - NativeLibrary.unPauseEmulation() + NativeLibrary.unpauseEmulation() } else -> Log.debug("[EmulationFragment] Bug, run called while already running.") diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 07c2a7850..6688416d6 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -583,7 +583,7 @@ jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_reloadKeys(JNIEnv* env, jclass cl return static_cast<jboolean>(Core::Crypto::KeyManager::Instance().AreKeysLoaded()); } -void Java_org_yuzu_yuzu_1emu_NativeLibrary_unPauseEmulation(JNIEnv* env, jclass clazz) { +void Java_org_yuzu_yuzu_1emu_NativeLibrary_unpauseEmulation(JNIEnv* env, jclass clazz) { EmulationSession::GetInstance().UnPauseEmulation(); } @@ -611,7 +611,7 @@ void Java_org_yuzu_yuzu_1emu_NativeLibrary_muteAduio(JNIEnv* env, jclass clazz) Settings::values.audio_muted = true; } -void Java_org_yuzu_yuzu_1emu_NativeLibrary_unMuteAudio(JNIEnv* env, jclass clazz) { +void Java_org_yuzu_yuzu_1emu_NativeLibrary_unmuteAudio(JNIEnv* env, jclass clazz) { Settings::values.audio_muted = false; } diff --git a/src/android/app/src/main/res/drawable/ic_pip_sound.xml b/src/android/app/src/main/res/drawable/ic_pip_unmute.xml index f7ed0862e..f7ed0862e 100644 --- a/src/android/app/src/main/res/drawable/ic_pip_sound.xml +++ b/src/android/app/src/main/res/drawable/ic_pip_unmute.xml diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index eb1d83693..381dfbc3b 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -388,7 +388,7 @@ <string name="pause">Pause</string> <string name="play">Play</string> <string name="mute">Mute</string> - <string name="sound">Sound</string> + <string name="unmute">Unmute</string> <!-- Licenses screen strings --> <string name="licenses">Licenses</string> |