Android: Begin implementing disk swap options
This commit is contained in:
parent
775f23221d
commit
925daa2bfd
|
@ -307,8 +307,6 @@ public class OptionsFragment extends Fragment {
|
|||
|
||||
});
|
||||
|
||||
// String[] regions = ArrayUtils.remove(parentActivity.getResources()
|
||||
// .getStringArray(R.array.region), 4);
|
||||
String[] regions = getResources().getStringArray(R.array.region);
|
||||
Spinner region_spnr = (Spinner) getView().findViewById(R.id.region_spinner);
|
||||
ArrayAdapter<String> regionAdapter = new ArrayAdapter<String>(
|
||||
|
@ -444,36 +442,30 @@ public class OptionsFragment extends Fragment {
|
|||
synced_render.setChecked(mPrefs.getBoolean(Emulator.pref_syncedrender, Emulator.syncedrender));
|
||||
synced_render.setOnCheckedChangeListener(synchronous);
|
||||
|
||||
// final EditText bootdiskEdit = (EditText) getView().findViewById(R.id.boot_disk);
|
||||
// String disk = Emulator.bootdisk;
|
||||
// if (disk != null && disk.contains("/")) {
|
||||
// bootdiskEdit.setText(disk.substring(disk.lastIndexOf("/"),
|
||||
// disk.length()));
|
||||
// } else {
|
||||
// bootdiskEdit.setText(disk);
|
||||
// }
|
||||
//
|
||||
// bootdiskEdit.addTextChangedListener(new TextWatcher() {
|
||||
// public void afterTextChanged(Editable s) {
|
||||
// if (bootdiskEdit.getText() != null) {
|
||||
// String disk = bootdiskEdit.getText().toString();
|
||||
// if (disk.contains("/")) {
|
||||
// bootdiskEdit.setText(disk.substring(disk.lastIndexOf("/"),
|
||||
// disk.length()));
|
||||
// } else {
|
||||
// bootdiskEdit.setText(disk);
|
||||
// }
|
||||
// mPrefs.edit().putString(Emulator.pref_bootdisk, disk).apply();
|
||||
// Emulator.bootdisk = disk;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
// }
|
||||
//
|
||||
// public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
// }
|
||||
// });
|
||||
final EditText bootdiskEdit = (EditText) getView().findViewById(R.id.boot_disk);
|
||||
bootdiskEdit.setText(mPrefs.getString(Emulator.pref_bootdisk, Emulator.bootdisk));
|
||||
|
||||
bootdiskEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable editText) {
|
||||
if (editText != null) {
|
||||
String disk = editText.toString();
|
||||
if (disk.substring(disk.lastIndexOf("/") + 1).length() == 0) {
|
||||
disk = "null";
|
||||
} else if (!disk.equals("null") && !disk.contains("/")) {
|
||||
disk = game_directory + "/" + disk;
|
||||
}
|
||||
bootdiskEdit.setText(disk);
|
||||
mPrefs.edit().putString(Emulator.pref_bootdisk, disk).apply();
|
||||
Emulator.bootdisk = disk;
|
||||
}
|
||||
}
|
||||
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
});
|
||||
|
||||
final CompoundButton fps_opt = (CompoundButton) getView().findViewById(R.id.fps_option);
|
||||
OnCheckedChangeListener fps_options = new OnCheckedChangeListener() {
|
||||
|
|
|
@ -158,11 +158,6 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_modvols(JNIEnv *env,j
|
|||
settings.rend.ModifierVolumes = volumes;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_bootdisk(JNIEnv *env,jobject obj, jstring disk)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_usereios(JNIEnv *env,jobject obj, jint reios)
|
||||
{
|
||||
settings.bios.UseReios = reios;
|
||||
|
@ -191,7 +186,8 @@ bool gles_init();
|
|||
extern int screen_width,screen_height;
|
||||
|
||||
static u64 tvs_base;
|
||||
static char CurFileName[256];
|
||||
static char bootdisk[256];
|
||||
static char gamedisk[256];
|
||||
|
||||
// Additonal controllers 2, 3 and 4 connected ?
|
||||
static bool add_controllers[3] = { false, false, false };
|
||||
|
@ -310,20 +306,34 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_config(JNIEnv *env,jo
|
|||
printf("Data dir is: %s\n", get_writable_data_path("/").c_str());
|
||||
env->ReleaseStringUTFChars(dirName,D);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_bootdisk(JNIEnv *env,jobject obj, jstring disk)
|
||||
{
|
||||
const char* P = disk? env->GetStringUTFChars(disk,0):0;
|
||||
if(!P) bootdisk[0] = '\0';
|
||||
else
|
||||
{
|
||||
printf("Got URI: '%s'\n",P);
|
||||
strncpy(bootdisk,(strlen(P)>=7)&&!memcmp(P,"file://",7)? P+7:P,sizeof(bootdisk));
|
||||
bootdisk[sizeof(bootdisk)-1] = '\0';
|
||||
env->ReleaseStringUTFChars(disk,P);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_init(JNIEnv *env,jobject obj,jstring fileName)
|
||||
{
|
||||
// Get filename string from Java
|
||||
const char* P = fileName? env->GetStringUTFChars(fileName,0):0;
|
||||
if(!P) CurFileName[0] = '\0';
|
||||
if(!P) gamedisk[0] = '\0';
|
||||
else
|
||||
{
|
||||
printf("Got URI: '%s'\n",P);
|
||||
strncpy(CurFileName,(strlen(P)>=7)&&!memcmp(P,"file://",7)? P+7:P,sizeof(CurFileName));
|
||||
CurFileName[sizeof(CurFileName)-1] = '\0';
|
||||
strncpy(gamedisk,(strlen(P)>=7)&&!memcmp(P,"file://",7)? P+7:P,sizeof(gamedisk));
|
||||
gamedisk[sizeof(gamedisk)-1] = '\0';
|
||||
env->ReleaseStringUTFChars(fileName,P);
|
||||
}
|
||||
|
||||
printf("Opening file: '%s'\n",CurFileName);
|
||||
printf("Opening file: '%s'\n",gamedisk);
|
||||
|
||||
// Initialize platform-specific stuff
|
||||
common_linux_setup();
|
||||
|
@ -340,7 +350,10 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_init(JNIEnv *env,jobj
|
|||
pthread_attr_destroy(&PTAttr);
|
||||
*/
|
||||
|
||||
ThreadHandler(CurFileName);
|
||||
if (strcmp(bootdisk, "null") != 0)
|
||||
ThreadHandler(bootdisk);
|
||||
else
|
||||
ThreadHandler(gamedisk);
|
||||
}
|
||||
|
||||
#define SAMPLE_COUNT 512
|
||||
|
@ -432,9 +445,10 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_destroy(JNIEnv *env,j
|
|||
dc_term();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_diskSwap(JNIEnv *env,jobject obj, jstring newdisk)
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_diskSwap(JNIEnv *env,jobject obj)
|
||||
{
|
||||
// Needs actual code to swap a disk
|
||||
// bootdisk is replaced by gamedisk
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_vmuSwap(JNIEnv *env,jobject obj)
|
||||
|
|
|
@ -719,34 +719,34 @@
|
|||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_marginTop="10dp"-->
|
||||
<!--android:orientation="vertical" >-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/boot_disk_text"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="0dip"-->
|
||||
<!--android:layout_weight="1"-->
|
||||
<!--android:text="@string/boot_disk" />-->
|
||||
<TextView
|
||||
android:id="@+id/boot_disk_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/boot_disk" />
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:orientation="vertical" >-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<!--<EditText-->
|
||||
<!--android:id="@+id/boot_disk"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_weight="1"-->
|
||||
<!--android:ems="10"-->
|
||||
<!--android:inputType="textPersonName" >-->
|
||||
<!--</EditText>-->
|
||||
<!--</LinearLayout>-->
|
||||
<!--</LinearLayout>-->
|
||||
<EditText
|
||||
android:id="@+id/boot_disk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:inputType="text" >
|
||||
</EditText>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
|
|
|
@ -719,34 +719,34 @@
|
|||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_marginTop="10dp"-->
|
||||
<!--android:orientation="vertical" >-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/boot_disk_text"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="0dip"-->
|
||||
<!--android:layout_weight="1"-->
|
||||
<!--android:text="@string/boot_disk" />-->
|
||||
<TextView
|
||||
android:id="@+id/boot_disk_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/boot_disk" />
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:orientation="vertical" >-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<!--<EditText-->
|
||||
<!--android:id="@+id/boot_disk"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_weight="1"-->
|
||||
<!--android:ems="10"-->
|
||||
<!--android:inputType="textPersonName" >-->
|
||||
<!--</EditText>-->
|
||||
<!--</LinearLayout>-->
|
||||
<!--</LinearLayout>-->
|
||||
<EditText
|
||||
android:id="@+id/boot_disk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:inputType="text" >
|
||||
</EditText>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<string name="select_software">Use Software Layer</string>
|
||||
<string name="select_sound">Disable Emulator Sound</string>
|
||||
<string name="select_depth">View Rendering Depth</string>
|
||||
<string name="boot_disk">Boot Disk (ie. Gameshark, Utopia)</string>
|
||||
<string name="boot_disk">Boot Disk (ie. Gameshark, Utopia) *NON-FUNCTIONAL*</string>
|
||||
|
||||
<string name="reset_emu">Reset Emu</string>
|
||||
<string name="reset_emu_title">Reset Emulator Settings</string>
|
||||
|
|
Loading…
Reference in New Issue