Android: UI configuration for InterruptHack setting

This commit is contained in:
Ender's Games 2018-08-22 14:17:23 -04:00
parent 2c517896b2
commit eebf3fc57c
10 changed files with 142 additions and 3 deletions

View File

@ -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);

View File

@ -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("/")) {

View File

@ -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() {

View File

@ -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);

View File

@ -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;

View File

@ -775,6 +775,34 @@
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/interrupt_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ems="10"
android:gravity="center_vertical|left"
android:text="@string/select_interrupt" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical" >
<Switch
android:id="@+id/interrupt_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true" />
</LinearLayout>
</TableRow>
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->

View File

@ -253,6 +253,35 @@
android:focusable="true" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/interrupt_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ems="10"
android:gravity="center_vertical|left"
android:text="@string/select_interrupt" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical" >
<Switch
android:id="@+id/interrupt_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >

View File

@ -775,6 +775,34 @@
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/interrupt_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ems="10"
android:gravity="center_vertical|left"
android:text="@string/select_interrupt" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical" >
<Checkbox
android:id="@+id/interrupt_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true" />
</LinearLayout>
</TableRow>
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->

View File

@ -253,6 +253,34 @@
android:focusable="true" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/interrupt_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ems="10"
android:gravity="center_vertical|left"
android:text="@string/select_interrupt" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical" >
<Checkbox
android:id="@+id/interrupt_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >

View File

@ -49,6 +49,7 @@
<string name="select_render">PVR Rendering (does nothing for now)</string>
<string name="select_syncrender">Synchronous Rendering</string>
<string name="select_modvols">Enable Modifier Volumes</string>
<string name="select_interrupt">Enable Interrupt Hack</string>
<string name="select_fps">Show On-Screen FPS</string>
<string name="select_software">Use Software Layer</string>
<string name="select_sound">Disable Emulator Sound</string>