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 e9f1b54be..515c83170 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 @@ -21,6 +21,7 @@ public class Emulator extends Application { public static final String pref_broadcast = "dc_broadcast"; public static final String pref_limitfps = "limit_fps"; public static final String pref_nosound = "sound_disabled"; + public static final String pref_interrupt = "interrupt_hack"; public static final String pref_mipmaps = "use_mipmaps"; public static final String pref_widescreen = "stretch_view"; public static final String pref_frameskip = "frame_skip"; @@ -40,6 +41,7 @@ public class Emulator extends Application { public static boolean limitfps = true; public static boolean nobatch = false; public static boolean nosound = false; + public static boolean interrupt = false; public static boolean mipmaps = true; public static boolean widescreen = false; public static boolean subdivide = false; @@ -64,6 +66,7 @@ public class Emulator extends Application { Emulator.broadcast = mPrefs.getInt(pref_broadcast, broadcast); Emulator.limitfps = mPrefs.getBoolean(pref_limitfps, limitfps); Emulator.nosound = mPrefs.getBoolean(pref_nosound, nosound); + Emulator.interrupt = mPrefs.getBoolean(pref_interrupt, interrupt); Emulator.mipmaps = mPrefs.getBoolean(pref_mipmaps, mipmaps); Emulator.widescreen = mPrefs.getBoolean(pref_widescreen, widescreen); Emulator.frameskip = mPrefs.getInt(pref_frameskip, frameskip); @@ -90,6 +93,7 @@ public class Emulator extends Application { JNIdc.limitfps(Emulator.limitfps ? 1 : 0); JNIdc.nobatch(Emulator.nobatch ? 1 : 0); JNIdc.nosound(Emulator.nosound ? 1 : 0); + JNIdc.interrupthack(Emulator.interrupt ? 1 : 0); JNIdc.mipmaps(Emulator.mipmaps ? 1 : 0); JNIdc.widescreen(Emulator.widescreen ? 1 : 0); JNIdc.subdivide(Emulator.subdivide ? 1 : 0); @@ -106,6 +110,7 @@ public class Emulator extends Application { SharedPreferences mPrefs = getSharedPreferences(gameId, Activity.MODE_PRIVATE); Emulator.unstableopt = mPrefs.getBoolean(pref_unstable, unstableopt); Emulator.dynsafemode = mPrefs.getBoolean(pref_dynsafemode, dynsafemode); + Emulator.interrupt = mPrefs.getBoolean(pref_interrupt, interrupt); Emulator.frameskip = mPrefs.getInt(pref_frameskip, frameskip); Emulator.pvrrender = mPrefs.getBoolean(pref_pvrrender, pvrrender); Emulator.syncedrender = mPrefs.getBoolean(pref_syncedrender, syncedrender); 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 2a4c4bec8..17e5eb101 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 @@ -464,6 +464,16 @@ public class OptionsFragment extends Fragment { modifier_volumes.setChecked(mPrefs.getBoolean(Emulator.pref_modvols, Emulator.modvols)); modifier_volumes.setOnCheckedChangeListener(mod_volumes); + CompoundButton interrupt_opt = (CompoundButton) getView().findViewById(R.id.interrupt_option); + OnCheckedChangeListener interrupthack = new OnCheckedChangeListener() { + + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + mPrefs.edit().putBoolean(Emulator.pref_interrupt, isChecked).apply(); + } + }; + interrupt_opt.setChecked(mPrefs.getBoolean(Emulator.pref_interrupt, false)); + interrupt_opt.setOnCheckedChangeListener(interrupthack); + // final EditText bootdiskEdit = (EditText) getView().findViewById(R.id.boot_disk); // String disk = Emulator.bootdisk; // if (disk != null && disk.contains("/")) { 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 88458c6d3..325442daa 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 @@ -45,7 +45,6 @@ import java.util.Map; public class PGConfigFragment extends Fragment { - private Emulator app; private Spinner mSpnrConfigs; private CompoundButton unstable_opt; @@ -55,6 +54,7 @@ public class PGConfigFragment extends Fragment { private CompoundButton pvr_render; private CompoundButton synced_render; private CompoundButton modifier_volumes; + private CompoundButton interrupt_opt; @Override public void onAttach(Activity activity) { @@ -76,7 +76,7 @@ public class PGConfigFragment extends Fragment { @Override public void onViewCreated(View view, Bundle savedInstanceState) { - app = (Emulator) getActivity().getApplicationContext(); + Emulator app = (Emulator) getActivity().getApplicationContext(); app.getConfigurationPrefs(PreferenceManager.getDefaultSharedPreferences(getActivity())); mSpnrConfigs = (Spinner) getView().findViewById(R.id.config_spinner); @@ -90,6 +90,7 @@ public class PGConfigFragment extends Fragment { pvr_render = (CompoundButton) getView().findViewById(R.id.render_option); synced_render = (CompoundButton) getView().findViewById(R.id.syncrender_option); modifier_volumes = (CompoundButton) getView().findViewById(R.id.modvols_option); + interrupt_opt = (CompoundButton) getView().findViewById(R.id.interrupt_option); } private void saveSettings(SharedPreferences mPrefs) { @@ -98,7 +99,8 @@ 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_modvols, modifier_volumes.isChecked()).apply(); + .putBoolean(Emulator.pref_modvols, modifier_volumes.isChecked()) + .putBoolean(Emulator.pref_interrupt, interrupt_opt.isChecked()).apply(); } private void configureViewByGame(String gameId) { @@ -144,6 +146,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)); modifier_volumes.setChecked(mPrefs.getBoolean(Emulator.pref_modvols, Emulator.modvols)); + interrupt_opt.setChecked(mPrefs.getBoolean(Emulator.pref_interrupt, Emulator.interrupt)); Button savePGC = (Button) getView().findViewById(R.id.save_pg_btn); savePGC.setOnClickListener(new View.OnClickListener() { 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 781620d10..4fef4739f 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 @@ -38,6 +38,7 @@ public final class JNIdc public static native void limitfps(int limiter); public static native void nobatch(int nobatch); public static native void nosound(int noaudio); + public static native void interrupthack(int interrupt); public static native void mipmaps(int mipmaps); public static native void widescreen(int stretch); public static native void subdivide(int subdivide); 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 61d6731ba..77395446d 100644 --- a/shell/android-studio/reicast/src/main/jni/src/Android.cpp +++ b/shell/android-studio/reicast/src/main/jni/src/Android.cpp @@ -53,6 +53,7 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_broadcast(JNIEnv *env JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_limitfps(JNIEnv *env,jobject obj, jint limiter) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_nobatch(JNIEnv *env,jobject obj, jint nobatch) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_nosound(JNIEnv *env,jobject obj, jint noaudio) __attribute__((visibility("default"))); +JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_interrupthack(JNIEnv *env,jobject obj, jint interrupt) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_mipmaps(JNIEnv *env,jobject obj, jint mipmaps) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_widescreen(JNIEnv *env,jobject obj, jint stretch) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_subdivide(JNIEnv *env,jobject obj, jint subdivide) __attribute__((visibility("default"))); @@ -115,6 +116,11 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_nosound(JNIEnv *env,j settings.aica.NoSound = noaudio; } +JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_interrupthack(JNIEnv *env,jobject obj, jint interrupt) +{ + settings.aica.InterruptHack = interrupt; +} + JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_mipmaps(JNIEnv *env,jobject obj, jint mipmaps) { settings.rend.UseMipmaps = mipmaps; 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 44395d05d..fdfed1599 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 @@ -775,6 +775,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 046b0a60f..138bf5e11 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 @@ -253,6 +253,35 @@ android:focusable="true" /> + + + + + + + + + + + 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 68c4fb6e6..5732c073c 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 @@ -775,6 +775,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 d02777be2..5b46b349e 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 @@ -253,6 +253,34 @@ 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 8b2a16470..103f48d6f 100644 --- a/shell/android-studio/reicast/src/main/res/values/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values/strings.xml @@ -49,6 +49,7 @@ PVR Rendering (does nothing for now) Synchronous Rendering Enable Modifier Volumes + Enable Interrupt Hack Show On-Screen FPS Use Software Layer Disable Emulator Sound