From 2f3846867168239666a75c9635c92ecc9df54b4d Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Sat, 4 Aug 2018 09:40:23 -0400 Subject: [PATCH] Android: add setting for modifier volumes to shell --- .../java/com/reicast/emulator/Emulator.java | 2 ++ .../emulator/config/OptionsFragment.java | 11 ++++++++ .../reicast/src/main/jni/src/Android.cpp | 6 ++++ .../res/layout-v14/configure_fragment.xml | 28 +++++++++++++++++++ .../main/res/layout/configure_fragment.xml | 28 +++++++++++++++++++ .../reicast/src/main/res/values/strings.xml | 3 +- 6 files changed, 77 insertions(+), 1 deletion(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/Emulator.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/Emulator.java index 79ae3cc15..694ea1f8b 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/Emulator.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/Emulator.java @@ -24,6 +24,7 @@ public class Emulator extends Application { public static final String pref_frameskip = "frame_skip"; public static final String pref_pvrrender = "pvr_render"; public static final String pref_syncedrender = "synced_render"; + public static final String pref_modvols = "modifier_volumes"; public static final String pref_cheatdisk = "cheat_disk"; public static final String pref_usereios = "use_reios"; @@ -42,6 +43,7 @@ public class Emulator extends Application { public static int frameskip = 0; public static boolean pvrrender = false; public static boolean syncedrender = false; + public static boolean modvols = true; public static String cheatdisk = "null"; public static boolean usereios = false; public static boolean nativeact = false; diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java index 99da078ea..61d7cd076 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java @@ -468,6 +468,17 @@ public class OptionsFragment extends Fragment { synced_render.setChecked(Emulator.syncedrender); synced_render.setOnCheckedChangeListener(synchronous); + OnCheckedChangeListener mod_volumes = new OnCheckedChangeListener() { + + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + mPrefs.edit().putBoolean(Emulator.pref_modvols, isChecked).apply(); + Emulator.modvols = isChecked; + } + }; + CompoundButton modifier_volumes = (CompoundButton) getView().findViewById(R.id.modvols_option); + modifier_volumes.setChecked(Emulator.modvols); + modifier_volumes.setOnCheckedChangeListener(mod_volumes); + final EditText cheatEdit = (EditText) getView().findViewById(R.id.cheat_disk); String disk = Emulator.cheatdisk; if (disk != null && disk.contains("/")) { diff --git a/shell/android-studio/reicast/src/main/jni/src/Android.cpp b/shell/android-studio/reicast/src/main/jni/src/Android.cpp index 827ce3fdb..877ce5943 100644 --- a/shell/android-studio/reicast/src/main/jni/src/Android.cpp +++ b/shell/android-studio/reicast/src/main/jni/src/Android.cpp @@ -60,6 +60,7 @@ extern "C" JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_frameskip(JNIEnv *env,jobject obj, jint frames) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_pvrrender(JNIEnv *env,jobject obj, jint render) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_syncedrender(JNIEnv *env,jobject obj, jint sync) __attribute__((visibility("default"))); + JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_modvols(JNIEnv *env,jobject obj, jint volumes) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_cheatdisk(JNIEnv *env,jobject obj, jstring disk) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_usereios(JNIEnv *env,jobject obj, jint reios) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_dreamtime(JNIEnv *env,jobject obj, jlong clock) __attribute__((visibility("default"))); @@ -140,6 +141,11 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_syncedrender(JNIEnv * settings.pvr.SynchronousRendering = sync; } +JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_modvols(JNIEnv *env,jobject obj, jint volumes) +{ + settings.rend.ModifierVolumes = volumes; +} + JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_cheatdisk(JNIEnv *env,jobject obj, jstring disk) { diff --git a/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml b/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml index 07645db68..60601e937 100644 --- a/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml +++ b/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml @@ -747,6 +747,34 @@ + + + + + + + + + + + + + + + + + + + + Use Mipmaps (fixes SGX540) Widescreen Mode Frameskip Value - Synchronous Rendering PVR Rendering (does nothing for now) + Synchronous Rendering + Enable Modifier Volumes Show On-Screen FPS Force Software Rendering Disable Emulator Sound