Commit 8783e652 authored by TwistedUmbrella's avatar TwistedUmbrella
Browse files

Add configuration for default emulator image (GS, AR, etc)

This is a future-proof addition to support possible integration of disk
swapping with a cheat engine such as GameShark or Action Replay, which
require loading a disk during games.
parent 02e5cd3e
......@@ -228,6 +228,34 @@
</TableRow
-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/cheatdisk_text"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1"
android:text="@string/default_disk" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/cheat_disk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName" >
</EditText>
</LinearLayout>
</LinearLayout>
<TableRow android:gravity="center_vertical" >
<Button
......
......@@ -25,6 +25,7 @@
<string name="select_stretch">Widescreen Mode</string>
<string name="set_frameskip">Frameskip Value</string>
<string name="select_render">PVR Rendering (does nothing for now)</string>
<string name="default_disk">Set Default Disk</string>
<string name="games_listing">Available Dreamcast Games</string>
......
......@@ -22,12 +22,16 @@ import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Toast;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
......@@ -47,6 +51,7 @@ public class ConfigureFragment extends Fragment {
boolean widescreen = false;
int frameskip = 0;
boolean pvrrender = false;
String cheatdisk = "null";
private SharedPreferences mPrefs;
private File sdcard = Environment.getExternalStorageDirectory();
......@@ -137,7 +142,9 @@ public class ConfigureFragment extends Fragment {
pvrrender = Boolean.valueOf(currentLine.replace(
"pvr.rend=", ""));
}*/
if (StringUtils.containsIgnoreCase(currentLine, "image")) {
cheatdisk = currentLine.replace("image=", "");
}
}
scanner.close();
}
......@@ -322,6 +329,31 @@ public class ConfigureFragment extends Fragment {
});
/*OnCheckedChangeListener pvr_rendering = new OnCheckedChangeListener() {
final EditText cheatEdit = (EditText) getView().findViewById(
R.id.cheat_disk);
cheatEdit.setText(cheatdisk);
cheatEdit.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
if (cheatEdit.getText() != null) {
cheatdisk = cheatEdit.getText().toString();
mPrefs.edit().putString("cheat_disk", cheatdisk)
.commit();
if (!executeAppendConfig("image", cheatdisk)) {
executeWriteConfig();
}
}
}
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
public void onTextChanged(CharSequence s, int start, int before,
int count) {
}
});
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
......@@ -524,8 +556,9 @@ public class ConfigureFragment extends Fragment {
+ String.valueOf(widescreen ? 1 : 0) + "\n");
rebuildFile.append("pvr.Subdivide=0" + "\n");
rebuildFile.append("ta.skip=" + String.valueOf(frameskip) + "\n");
rebuildFile.append("pvr.rend=" + String.valueOf(pvrrender ? 1 : 0) + "\n");
rebuildFile.append("image=null" + "\n");
rebuildFile.append("pvr.rend=" + String.valueOf(pvrrender ? 1 : 0)
+ "\n");
rebuildFile.append("image=" + cheatdisk + "\n");
FileOutputStream fos = new FileOutputStream(config);
fos.write(rebuildFile.toString().getBytes());
fos.close();
......
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