Add a settings toggle to configure reios

This commit is contained in:
TwistedUmbrella 2015-03-14 11:51:30 -04:00
parent f440743a57
commit 6cf0d1acda
6 changed files with 106 additions and 26 deletions

View File

@ -58,6 +58,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_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")));
};
@ -136,6 +137,11 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_cheatdisk(JNIEnv *env
}
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_usereios(JNIEnv *env,jobject obj, jint reios)
{
settings.bios.UseReios = reios;
}
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_dreamtime(JNIEnv *env,jobject obj, jlong clock)
{
settings.dreamcast.RTC = (u32)(clock);

View File

@ -80,6 +80,41 @@
android:text="@string/browse" />
</LinearLayout>
</LinearLayout>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:stretchColumns="*" >
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/reios_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_reios" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical" >
<de.ankri.views.Switch
android:id="@+id/reios_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true" />
</LinearLayout>
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
@ -294,41 +329,45 @@
</LinearLayout>
</TableRow>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
<TableRow
android:layout_marginTop="10dp"
android:orientation="vertical" >
android:gravity="center_vertical" >
<TextView
android:id="@+id/frameskip_text"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:text="@string/set_frameskip" />
<LinearLayout
android:layout_width="match_parent"
<EditText
android:id="@+id/current_frames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:layout_marginRight="5dp"
android:layout_weight="1"
android:ems="10"
android:gravity="right"
android:inputType="number" >
</EditText>
</TableRow>
<TextView
android:id="@+id/current_frames"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" />
<TableRow
android:layout_marginTop="5dp"
android:gravity="center_vertical" >
<SeekBar
android:id="@+id/frame_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:max="5"
android:progress="0" />
</LinearLayout>
</LinearLayout>
<SeekBar
android:id="@+id/frame_seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:gravity="center_vertical|left"
android:max="5"
android:progress="0" />
</TableRow>
<TableRow
android:layout_marginTop="20dp"

View File

@ -30,6 +30,7 @@
<string name="optimization_opts">Optimization and Debugging Options</string>
<string name="experimental_opts">Experimental (May cause widespread panic)</string>
<string name="select_reios">Use reios BIOS</string>
<string name="select_bios">BIOS Region (dc_flash[X].bin)</string>
<string name="select_details">Enable Game Details</string>
<string name="select_native">Native Mode [No OSD]</string>

View File

@ -31,6 +31,7 @@ public class Config {
public static final String pref_frameskip = "frame_skip";
public static final String pref_pvrrender = "pvr_render";
public static final String pref_cheatdisk = "cheat_disk";
public static final String pref_usereios = "use_reios";
public static final String pref_showfps = "show_fps";
public static final String pref_forcegpu = "force_gpu";
@ -57,6 +58,7 @@ public class Config {
public static int frameskip = 0;
public static boolean pvrrender = false;
public static String cheatdisk = "null";
public static boolean usereios = false;
public static boolean nativeact = false;
public static int vibrationDuration = 20;
@ -87,6 +89,7 @@ public class Config {
Config.frameskip = mPrefs.getInt(pref_frameskip, frameskip);
Config.pvrrender = mPrefs.getBoolean(pref_pvrrender, pvrrender);
Config.cheatdisk = mPrefs.getString(pref_cheatdisk, cheatdisk);
Config.usereios = mPrefs.getBoolean(pref_usereios, usereios);
Config.nativeact = mPrefs.getBoolean(pref_nativeact, nativeact);
}
@ -109,6 +112,7 @@ public class Config {
JNIdc.subdivide(Config.subdivide ? 1 : 0);
JNIdc.frameskip(Config.frameskip);
JNIdc.pvrrender(Config.pvrrender ? 1 : 0);
JNIdc.usereios(Config.usereios ? 1 : 0);
JNIdc.cheatdisk(Config.cheatdisk);
JNIdc.dreamtime(DreamTime.getDreamtime());
}

View File

@ -152,6 +152,18 @@ public class OptionsFragment extends Fragment {
}
});
OnCheckedChangeListener reios_options = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_usereios, isChecked).commit();
}
};
Switch reios_opt = (Switch) getView().findViewById(
R.id.reios_option);
reios_opt.setChecked(mPrefs.getBoolean(Config.pref_usereios, false));
reios_opt.setOnCheckedChangeListener(reios_options);
OnCheckedChangeListener details_options = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
@ -379,10 +391,10 @@ public class OptionsFragment extends Fragment {
stretch_view.setChecked(Config.widescreen);
stretch_view.setOnCheckedChangeListener(full_screen);
final TextView mainFrames = (TextView) getView().findViewById(R.id.current_frames);
final EditText mainFrames = (EditText) getView().findViewById(R.id.current_frames);
mainFrames.setText(String.valueOf(Config.frameskip));
SeekBar frameSeek = (SeekBar) getView().findViewById(R.id.frame_seekbar);
final SeekBar frameSeek = (SeekBar) getView().findViewById(R.id.frame_seekbar);
frameSeek.setProgress(Config.frameskip);
frameSeek.setIndeterminate(false);
frameSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@ -400,6 +412,23 @@ public class OptionsFragment extends Fragment {
Config.frameskip = progress;
}
});
mainFrames.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
String frameText = mainFrames.getText().toString();
if (frameText != null) {
int frames = Integer.parseInt(frameText);
frameSeek.setProgress(frames);
mPrefs.edit().putInt(Config.pref_frameskip, frames).commit();
Config.frameskip = frames;
}
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
OnCheckedChangeListener pvr_rendering = new OnCheckedChangeListener() {

View File

@ -42,6 +42,7 @@ public final class JNIdc
public static native void frameskip(int frames);
public static native void pvrrender(int render);
public static native void cheatdisk(String disk);
public static native void usereios(int reios);
public static native void dreamtime(long clock);
public static void show_osd() {