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:
parent
02e5cd3ee2
commit
8783e6529e
|
@ -228,6 +228,34 @@
|
||||||
</TableRow
|
</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" >
|
<TableRow android:gravity="center_vertical" >
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
<string name="select_stretch">Widescreen Mode</string>
|
<string name="select_stretch">Widescreen Mode</string>
|
||||||
<string name="set_frameskip">Frameskip Value</string>
|
<string name="set_frameskip">Frameskip Value</string>
|
||||||
<string name="select_render">PVR Rendering (does nothing for now)</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>
|
<string name="games_listing">Available Dreamcast Games</string>
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,16 @@ import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Toast;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||||
|
@ -47,6 +51,7 @@ public class ConfigureFragment extends Fragment {
|
||||||
boolean widescreen = false;
|
boolean widescreen = false;
|
||||||
int frameskip = 0;
|
int frameskip = 0;
|
||||||
boolean pvrrender = false;
|
boolean pvrrender = false;
|
||||||
|
String cheatdisk = "null";
|
||||||
|
|
||||||
private SharedPreferences mPrefs;
|
private SharedPreferences mPrefs;
|
||||||
private File sdcard = Environment.getExternalStorageDirectory();
|
private File sdcard = Environment.getExternalStorageDirectory();
|
||||||
|
@ -137,7 +142,9 @@ public class ConfigureFragment extends Fragment {
|
||||||
pvrrender = Boolean.valueOf(currentLine.replace(
|
pvrrender = Boolean.valueOf(currentLine.replace(
|
||||||
"pvr.rend=", ""));
|
"pvr.rend=", ""));
|
||||||
}*/
|
}*/
|
||||||
|
if (StringUtils.containsIgnoreCase(currentLine, "image")) {
|
||||||
|
cheatdisk = currentLine.replace("image=", "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scanner.close();
|
scanner.close();
|
||||||
}
|
}
|
||||||
|
@ -322,6 +329,31 @@ public class ConfigureFragment extends Fragment {
|
||||||
});
|
});
|
||||||
|
|
||||||
/*OnCheckedChangeListener pvr_rendering = new OnCheckedChangeListener() {
|
/*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,
|
public void onCheckedChanged(CompoundButton buttonView,
|
||||||
boolean isChecked) {
|
boolean isChecked) {
|
||||||
|
@ -524,8 +556,9 @@ public class ConfigureFragment extends Fragment {
|
||||||
+ String.valueOf(widescreen ? 1 : 0) + "\n");
|
+ String.valueOf(widescreen ? 1 : 0) + "\n");
|
||||||
rebuildFile.append("pvr.Subdivide=0" + "\n");
|
rebuildFile.append("pvr.Subdivide=0" + "\n");
|
||||||
rebuildFile.append("ta.skip=" + String.valueOf(frameskip) + "\n");
|
rebuildFile.append("ta.skip=" + String.valueOf(frameskip) + "\n");
|
||||||
rebuildFile.append("pvr.rend=" + String.valueOf(pvrrender ? 1 : 0) + "\n");
|
rebuildFile.append("pvr.rend=" + String.valueOf(pvrrender ? 1 : 0)
|
||||||
rebuildFile.append("image=null" + "\n");
|
+ "\n");
|
||||||
|
rebuildFile.append("image=" + cheatdisk + "\n");
|
||||||
FileOutputStream fos = new FileOutputStream(config);
|
FileOutputStream fos = new FileOutputStream(config);
|
||||||
fos.write(rebuildFile.toString().getBytes());
|
fos.write(rebuildFile.toString().getBytes());
|
||||||
fos.close();
|
fos.close();
|
||||||
|
|
Loading…
Reference in New Issue