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.
This commit is contained in:
TwistedUmbrella 2014-01-27 02:27:46 -05:00
parent 02e5cd3ee2
commit 8783e6529e
3 changed files with 65 additions and 3 deletions

View File

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

View File

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

View File

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