From e81f43ff20ba1ecf3d7bade53e5a19c52ed70350 Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Wed, 22 Aug 2018 14:42:10 -0400 Subject: [PATCH] Android: UI configuration for QueueRender setting --- .../java/com/reicast/emulator/Emulator.java | 7 +++++ .../emulator/config/OptionsFragment.java | 9 ++++++ .../emulator/config/PGConfigFragment.java | 4 +++ .../java/com/reicast/emulator/emu/JNIdc.java | 1 + .../reicast/src/main/jni/src/Android.cpp | 8 +++++ .../res/layout-v14/configure_fragment.xml | 28 ++++++++++++++++++ .../main/res/layout-v14/pgconfig_fragment.xml | 28 ++++++++++++++++++ .../main/res/layout/configure_fragment.xml | 28 ++++++++++++++++++ .../src/main/res/layout/pgconfig_fragment.xml | 29 +++++++++++++++++++ .../reicast/src/main/res/values/strings.xml | 1 + 10 files changed, 143 insertions(+) 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 515c83170..916cdc2b0 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 @@ -27,6 +27,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_queuerender = "queue_render"; public static final String pref_modvols = "modifier_volumes"; public static final String pref_bootdisk = "boot_disk"; public static final String pref_usereios = "use_reios"; @@ -48,6 +49,7 @@ public class Emulator extends Application { public static int frameskip = 0; public static boolean pvrrender = false; public static boolean syncedrender = false; + public static boolean queuerender = false; public static boolean modvols = true; public static String bootdisk = "null"; public static boolean usereios = false; @@ -72,6 +74,7 @@ public class Emulator extends Application { Emulator.frameskip = mPrefs.getInt(pref_frameskip, frameskip); Emulator.pvrrender = mPrefs.getBoolean(pref_pvrrender, pvrrender); Emulator.syncedrender = mPrefs.getBoolean(pref_syncedrender, syncedrender); + Emulator.queuerender = mPrefs.getBoolean(pref_queuerender, queuerender); Emulator.modvols = mPrefs.getBoolean(pref_modvols, modvols); Emulator.bootdisk = mPrefs.getString(pref_bootdisk, bootdisk); Emulator.usereios = mPrefs.getBoolean(pref_usereios, usereios); @@ -100,6 +103,7 @@ public class Emulator extends Application { JNIdc.frameskip(Emulator.frameskip); JNIdc.pvrrender(Emulator.pvrrender ? 1 : 0); JNIdc.syncedrender(Emulator.syncedrender ? 1 : 0); + JNIdc.queuerender(Emulator.queuerender ? 1 : 0); JNIdc.modvols(Emulator.modvols ? 1 : 0); JNIdc.usereios(Emulator.usereios ? 1 : 0); JNIdc.bootdisk(Emulator.bootdisk); @@ -114,15 +118,18 @@ public class Emulator extends Application { Emulator.frameskip = mPrefs.getInt(pref_frameskip, frameskip); Emulator.pvrrender = mPrefs.getBoolean(pref_pvrrender, pvrrender); Emulator.syncedrender = mPrefs.getBoolean(pref_syncedrender, syncedrender); + Emulator.queuerender = mPrefs.getBoolean(pref_queuerender, queuerender); Emulator.modvols = mPrefs.getBoolean(pref_modvols, modvols); } public void loadGameConfiguration() { JNIdc.unstable(Emulator.unstableopt ? 1 : 0); JNIdc.safemode(Emulator.dynsafemode ? 1 : 0); + JNIdc.interrupthack(Emulator.interrupt ? 1 : 0); JNIdc.frameskip(Emulator.frameskip); JNIdc.pvrrender(Emulator.pvrrender ? 1 : 0); JNIdc.syncedrender(Emulator.syncedrender ? 1 : 0); + JNIdc.queuerender(Emulator.queuerender ? 1 : 0); JNIdc.modvols(Emulator.modvols ? 1 : 0); } 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 17e5eb101..d72971269 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 @@ -454,6 +454,15 @@ public class OptionsFragment extends Fragment { synced_render.setChecked(mPrefs.getBoolean(Emulator.pref_syncedrender, Emulator.syncedrender)); synced_render.setOnCheckedChangeListener(synchronous); + OnCheckedChangeListener queued = new OnCheckedChangeListener() { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + mPrefs.edit().putBoolean(Emulator.pref_queuerender, isChecked).apply(); + } + }; + CompoundButton queue_render = (CompoundButton) getView().findViewById(R.id.queuerender_option); + queue_render.setChecked(mPrefs.getBoolean(Emulator.pref_queuerender, Emulator.queuerender)); + queue_render.setOnCheckedChangeListener(queued); + OnCheckedChangeListener mod_volumes = new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/PGConfigFragment.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/PGConfigFragment.java index 325442daa..9cde1ea46 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/PGConfigFragment.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/PGConfigFragment.java @@ -53,6 +53,7 @@ public class PGConfigFragment extends Fragment { private SeekBar frameSeek; private CompoundButton pvr_render; private CompoundButton synced_render; + private CompoundButton queue_render; private CompoundButton modifier_volumes; private CompoundButton interrupt_opt; @@ -89,6 +90,7 @@ public class PGConfigFragment extends Fragment { frameSeek = (SeekBar) getView().findViewById(R.id.frame_seekbar); pvr_render = (CompoundButton) getView().findViewById(R.id.render_option); synced_render = (CompoundButton) getView().findViewById(R.id.syncrender_option); + queue_render = (CompoundButton) getView().findViewById(R.id.queuerender_option); modifier_volumes = (CompoundButton) getView().findViewById(R.id.modvols_option); interrupt_opt = (CompoundButton) getView().findViewById(R.id.interrupt_option); } @@ -99,6 +101,7 @@ public class PGConfigFragment extends Fragment { .putInt(Emulator.pref_frameskip, frameSeek.getProgress()) .putBoolean(Emulator.pref_pvrrender, pvr_render.isChecked()) .putBoolean(Emulator.pref_syncedrender, synced_render.isChecked()) + .putBoolean(Emulator.pref_queuerender, queue_render.isChecked()) .putBoolean(Emulator.pref_modvols, modifier_volumes.isChecked()) .putBoolean(Emulator.pref_interrupt, interrupt_opt.isChecked()).apply(); } @@ -145,6 +148,7 @@ public class PGConfigFragment extends Fragment { pvr_render.setChecked(mPrefs.getBoolean(Emulator.pref_pvrrender, Emulator.pvrrender)); synced_render.setChecked(mPrefs.getBoolean(Emulator.pref_syncedrender, Emulator.syncedrender)); + queue_render.setChecked(mPrefs.getBoolean(Emulator.pref_queuerender, Emulator.queuerender)); modifier_volumes.setChecked(mPrefs.getBoolean(Emulator.pref_modvols, Emulator.modvols)); interrupt_opt.setChecked(mPrefs.getBoolean(Emulator.pref_interrupt, Emulator.interrupt)); diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java index 4fef4739f..7e54374dc 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java @@ -45,6 +45,7 @@ public final class JNIdc public static native void frameskip(int frames); public static native void pvrrender(int render); public static native void syncedrender(int sync); + public static native void queuerender(int queue); public static native void modvols(int volumes); public static native void bootdisk(String disk); public static native void usereios(int reios); 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 77395446d..0fb1672ae 100644 --- a/shell/android-studio/reicast/src/main/jni/src/Android.cpp +++ b/shell/android-studio/reicast/src/main/jni/src/Android.cpp @@ -8,6 +8,7 @@ #include #include +#include #include "types.h" #include "hw/maple/maple_cfg.h" @@ -60,6 +61,7 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_subdivide(JNIEnv *env 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_queuerender(JNIEnv *env,jobject obj, jint queue) __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_bootdisk(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"))); @@ -151,6 +153,12 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_syncedrender(JNIEnv * settings.pvr.SynchronousRender = sync; } +JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_queuerender(JNIEnv *env,jobject obj, jint queue) +{ + settings.pvr.QueueRender = queue; +} + + JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_modvols(JNIEnv *env,jobject obj, jint volumes) { settings.rend.ModifierVolumes = volumes; 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 fdfed1599..8578f825a 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 @@ + + + + + + + + + + diff --git a/shell/android-studio/reicast/src/main/res/layout-v14/pgconfig_fragment.xml b/shell/android-studio/reicast/src/main/res/layout-v14/pgconfig_fragment.xml index 138bf5e11..c14c48aba 100644 --- a/shell/android-studio/reicast/src/main/res/layout-v14/pgconfig_fragment.xml +++ b/shell/android-studio/reicast/src/main/res/layout-v14/pgconfig_fragment.xml @@ -226,6 +226,34 @@ + + + + + + + + + + diff --git a/shell/android-studio/reicast/src/main/res/layout/configure_fragment.xml b/shell/android-studio/reicast/src/main/res/layout/configure_fragment.xml index 5732c073c..3aff86e6c 100644 --- a/shell/android-studio/reicast/src/main/res/layout/configure_fragment.xml +++ b/shell/android-studio/reicast/src/main/res/layout/configure_fragment.xml @@ -747,6 +747,34 @@ + + + + + + + + + + diff --git a/shell/android-studio/reicast/src/main/res/layout/pgconfig_fragment.xml b/shell/android-studio/reicast/src/main/res/layout/pgconfig_fragment.xml index 5b46b349e..6383e2622 100644 --- a/shell/android-studio/reicast/src/main/res/layout/pgconfig_fragment.xml +++ b/shell/android-studio/reicast/src/main/res/layout/pgconfig_fragment.xml @@ -226,6 +226,34 @@ + + + + + + + + + + @@ -281,6 +309,7 @@ android:focusable="true" /> + diff --git a/shell/android-studio/reicast/src/main/res/values/strings.xml b/shell/android-studio/reicast/src/main/res/values/strings.xml index 103f48d6f..b71b66dfb 100644 --- a/shell/android-studio/reicast/src/main/res/values/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values/strings.xml @@ -48,6 +48,7 @@ Frameskip Value PVR Rendering (does nothing for now) Synchronous Rendering + Queue Rendering Enable Modifier Volumes Enable Interrupt Hack Show On-Screen FPS