Commit 6f8699a1 authored by TwistedUmbrella's avatar TwistedUmbrella
Browse files

Integrate previously locked settings with valid user warning

parent f97b085f
......@@ -7,38 +7,12 @@
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*" >
android:stretchColumns="*"
android:layout_marginLeft="6dp" >
<!--
TableRow android:gravity="center_vertical"
android:layout_marginTop="10dp" >
<TextView
android:id="@+id/dynarec_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_dynarec" />
<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/dynarec_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</TableRow
-->
<TableRow android:gravity="center_vertical"
android:layout_marginTop="10dp" >
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/unstable_text"
......@@ -63,64 +37,9 @@
</LinearLayout>
</TableRow>
<!--
LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp" >
<TextView
android:id="@+id/region_text"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1"
android:text="@string/select_region" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Spinner
android:id="@+id/region_spinner"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" >
</Spinner>
</LinearLayout>
</LinearLayout
-->
<TableRow android:gravity="center_vertical"
android:layout_marginTop="10dp" >
<TextView
android:id="@+id/limitfps_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_limitfps" />
<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/limitfps_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</TableRow>
<TableRow android:gravity="center_vertical"
android:layout_marginTop="10dp" >
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/mipmaps_text"
......@@ -145,8 +64,9 @@
</LinearLayout>
</TableRow>
<TableRow android:gravity="center_vertical"
android:layout_marginTop="10dp" >
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/stretch_text"
......@@ -174,8 +94,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp" >
android:layout_marginTop="10dp"
android:orientation="vertical" >
<TextView
android:id="@+id/frameskip_text"
......@@ -207,40 +127,134 @@
</LinearLayout>
</LinearLayout>
<!--
TableRow android:gravity="center_vertical"
android:layout_marginTop="10dp" >
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/render_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_render" />
android:id="@+id/experimental_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:gravity="center_vertical"
android:text="@string/experimental_opts" />
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/dynarec_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_dynarec" />
<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/render_option"
android:id="@+id/dynarec_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</TableRow>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<TextView
android:id="@+id/region_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="0dip"
android:layout_weight="1"
android:text="@string/select_region" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Spinner
android:id="@+id/region_spinner"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" >
</Spinner>
</LinearLayout>
</LinearLayout>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/limitfps_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_limitfps" />
</TableRow
-->
<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/limitfps_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/render_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_render" />
<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/render_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</TableRow>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp" >
android:layout_marginTop="10dp"
android:orientation="vertical" >
<TextView
android:id="@+id/cheatdisk_text"
......@@ -265,8 +279,9 @@
</LinearLayout>
</LinearLayout>
<TableRow android:gravity="center_vertical"
android:layout_marginTop="10dp" >
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<Button
android:id="@+id/debug_button"
......
......@@ -16,6 +16,7 @@
<string name="folder_bios">BOOT BIOS</string>
<string name="folder_select">SELECT CURRENT FOLDER</string>
<string name="experimental_opts">Experimental (May cause widespread panic)</string>
<string name="select_dynarec">Dynarec Options</string>
<string name="select_unstable">Unstable Optimisations</string>
<string name="select_region">DC Region</string>
......@@ -104,6 +105,8 @@
<string name="textOn">ON</string>
<string name="textOff">OFF</string>
<string name="platform">Identified %1$s</string>
<string name="menu_debug">Save Error Logs</string>
......
......@@ -16,7 +16,14 @@ import de.ankri.views.Switch;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
......@@ -28,9 +35,13 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.SeekBar;
......@@ -42,7 +53,7 @@ public class ConfigureFragment extends Fragment {
Activity parentActivity;
TextView mainFrames;
OnClickListener mCallback;
boolean dynarecopt = true;
boolean unstableopt = false;
int dcregion = 3;
......@@ -53,6 +64,9 @@ public class ConfigureFragment extends Fragment {
boolean pvrrender = false;
String cheatdisk = "null";
boolean tegra = false;
boolean qualcomm = false;
private SharedPreferences mPrefs;
private File sdcard = Environment.getExternalStorageDirectory();
private String home_directory = sdcard + "/dc";
......@@ -99,6 +113,19 @@ public class ConfigureFragment extends Fragment {
mPrefs = PreferenceManager.getDefaultSharedPreferences(parentActivity);
home_directory = mPrefs.getString("home_directory", home_directory);
String platform = readOutput("/system/bin/getprop ro.board.platform");
if (platform != null && !platform.equals(null)) {
Toast.makeText(parentActivity,
parentActivity.getString(R.string.platform, platform),
Toast.LENGTH_SHORT).show();
if (platform.contains("msm")) {
qualcomm = true;
}
if (platform.contains("tegra")) {
tegra = true;
}
}
try {
File config = new File(home_directory, "emu.cfg");
if (config.exists()) {
......@@ -106,26 +133,32 @@ public class ConfigureFragment extends Fragment {
String currentLine;
while (scanner.hasNextLine()) {
currentLine = scanner.nextLine();
// Check if the existing emu.cfg has the setting and get current value
/*if (StringUtils.containsIgnoreCase(currentLine, "Dynarec.Enabled")) {
// Check if the existing emu.cfg has the setting and get
// current value
if (StringUtils.containsIgnoreCase(currentLine,
"Dynarec.Enabled")) {
dynarecopt = Boolean.valueOf(currentLine.replace(
"Dynarec.Enabled=", ""));
}*/
if (StringUtils.containsIgnoreCase(currentLine, "Dynarec.unstable-opt")) {
}
if (StringUtils.containsIgnoreCase(currentLine,
"Dynarec.unstable-opt")) {
unstableopt = Boolean.valueOf(currentLine.replace(
"Dynarec.unstable-opt=", ""));
}
/*if (StringUtils.containsIgnoreCase(currentLine, "Dreamcast.Region")) {
if (StringUtils.containsIgnoreCase(currentLine,
"Dreamcast.Region")) {
dcregion = Integer.valueOf(currentLine.replace(
"Dreamcast.Region=", ""));
}*/
if (StringUtils.containsIgnoreCase(currentLine, "aica.LimitFPS")) {
}
if (StringUtils.containsIgnoreCase(currentLine,
"aica.LimitFPS")) {
limitfps = Boolean.valueOf(currentLine.replace(
"aica.LimitFPS=", ""));
}
if (StringUtils.containsIgnoreCase(currentLine, "rend.UseMipmaps")) {
if (StringUtils.containsIgnoreCase(currentLine,
"rend.UseMipmaps")) {
mipmaps = Boolean.valueOf(currentLine.replace(
"rend.UseMipmaps=", ""));
}
......@@ -138,23 +171,24 @@ public class ConfigureFragment extends Fragment {
frameskip = Integer.valueOf(currentLine.replace(
"ta.skip=", ""));
}
/*if (StringUtils.containsIgnoreCase(currentLine, "pvr.rend")) {
if (StringUtils.containsIgnoreCase(currentLine, "pvr.rend")) {
pvrrender = Boolean.valueOf(currentLine.replace(
"pvr.rend=", ""));
}*/
}
if (StringUtils.containsIgnoreCase(currentLine, "image")) {
cheatdisk = currentLine.replace("image=", "");
}
}
scanner.close();
}
} catch (Exception e) {
Log.d("reicast", "Exception: " + e);
}
// Generate the menu options and fill in existing settings
/*OnCheckedChangeListener dynarec_options = new OnCheckedChangeListener() {
OnCheckedChangeListener dynarec_options = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
......@@ -166,16 +200,16 @@ public class ConfigureFragment extends Fragment {
}
}
};
Switch dynarec_opt = (Switch) getView().findViewById(
R.id.dynarec_option);
boolean dynarec = mPrefs.getBoolean("dynarec_opt", dynarecopt);
if (dynarec) {
dynarec_opt.setChecked(true);
} else {
dynarec_opt.setChecked(false);
}
dynarec_opt.setOnCheckedChangeListener(dynarec_options);*/
Switch dynarec_opt = (Switch) getView().findViewById(
R.id.dynarec_option);
boolean dynarec = mPrefs.getBoolean("dynarec_opt", dynarecopt);
if (dynarec) {
dynarec_opt.setChecked(true);
} else {
dynarec_opt.setChecked(false);
}
dynarec_opt.setOnCheckedChangeListener(dynarec_options);
OnCheckedChangeListener unstable_option = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
......@@ -197,8 +231,9 @@ public class ConfigureFragment extends Fragment {
unstable_opt.setChecked(false);
}
unstable_opt.setOnCheckedChangeListener(unstable_option);
/*String[] regions = parentActivity.getResources().getStringArray(R.array.region);
String[] regions = parentActivity.getResources().getStringArray(
R.array.region);
Spinner region_spnr = (Spinner) getView().findViewById(
R.id.region_spinner);
......@@ -207,7 +242,7 @@ public class ConfigureFragment extends Fragment {
localeAdapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
region_spnr.setAdapter(localeAdapter);
int dc_region = mPrefs.getInt("dc_region", dcregion);
region_spnr.setSelection(dc_region, true);
......@@ -228,8 +263,8 @@ public class ConfigureFragment extends Fragment {
mPrefs.edit().putInt("dc_region", 3).commit();
}
});*/
});
OnCheckedChangeListener limitfps_option = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
......@@ -251,7 +286,7 @@ public class ConfigureFragment extends Fragment {
limit_fps.setChecked(false);
}
limit_fps.setOnCheckedChangeListener(limitfps_option);
OnCheckedChangeListener mipmaps_option = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
......@@ -295,7 +330,7 @@ public class ConfigureFragment extends Fragment {
stretch_view.setChecked(false);
}
stretch_view.setOnCheckedChangeListener(full_screen);
mainFrames = (TextView) getView().findViewById(R.id.current_frames);
mainFrames.setText(String.valueOf(frameskip));
......@@ -328,7 +363,7 @@ public class ConfigureFragment extends Fragment {
}
});
/*OnCheckedChangeListener pvr_rendering = new OnCheckedChangeListener() {
OnCheckedChangeListener pvr_rendering = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
......@@ -347,7 +382,7 @@ public class ConfigureFragment extends Fragment {
} else {
pvr_render.setChecked(false);
}
pvr_render.setOnCheckedChangeListener(pvr_rendering);*/
pvr_render.setOnCheckedChangeListener(pvr_rendering);
final EditText cheatEdit = (EditText) getView().findViewById(
R.id.cheat_disk);
......@@ -372,7 +407,7 @@ public class ConfigureFragment extends Fragment {
int count) {
}
});
Button debug_button = (Button) getView()
.findViewById(R.id.debug_button);
debug_button.setOnClickListener(new View.OnClickListener() {
......@@ -495,9 +530,9 @@ public class ConfigureFragment extends Fragment {
File config = new File(home_directory, "emu.cfg");
if (config.exists()) {
try {
// Read existing emu.cfg and substitute new setting value
StringBuilder rebuildFile = new StringBuilder();
Scanner scanner = new Scanner(config);
String currentLine;
......@@ -533,23 +568,27 @@ public class ConfigureFragment extends Fragment {
if (config.exists()) {
config.delete();
}
// Write new emu.cfg using current display values
StringBuilder rebuildFile = new StringBuilder();
rebuildFile.append("[config]" + "\n");
rebuildFile.append("Dynarec.Enabled=" + String.valueOf(dynarecopt ? 1 : 0) + "\n");
rebuildFile.append("Dynarec.Enabled="
+ String.valueOf(dynarecopt ? 1 : 0) + "\n");
rebuildFile.append("Dynarec.idleskip=1" + "\n");
rebuildFile.append("Dynarec.unstable-opt=" + String.valueOf(unstableopt ? 1 : 0) + "\n");
rebuildFile.append("Dynarec.unstable-opt="
+ String.valueOf(unstableopt ? 1 : 0) + "\n");
rebuildFile.append("Dreamcast.Cable=3" + "\n");
rebuildFile.append("Dreamcast.RTC="
+ String.valueOf(System.currentTimeMillis()) + "\n");
rebuildFile.append("Dreamcast.Region=" + String.valueOf(dcregion)
+ "\n");
rebuildFile.append("Dreamcast.Broadcast=4" + "\n");
rebuildFile.append("aica.LimitFPS=" + String.valueOf(limitfps ? 1 : 0) + "\n");
rebuildFile.append("aica.LimitFPS="
+ String.valueOf(limitfps ? 1 : 0) + "\n");
rebuildFile.append("aica.NoBatch=0" + "\n");
rebuildFile.append("rend.UseMipmaps=" + String.valueOf(mipmaps ? 1 : 0) + "\n");
rebuildFile.append("rend.UseMipmaps="
+ String.valueOf(mipmaps ? 1 : 0) + "\n");
rebuildFile.append("rend.WideScreen="
+ String.valueOf(widescreen ? 1 : 0) + "\n");
rebuildFile.append("pvr.Subdivide=0" + "\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment