Basic automated BIOS locator
Requires BIOS still be in a “data” subfolder
This commit is contained in:
parent
b18350652a
commit
1aa50faadf
|
@ -40,7 +40,7 @@
|
||||||
android:id="@+id/browse_main_path"
|
android:id="@+id/browse_main_path"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Browse" />
|
android:text="@string/locate" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView1"
|
android:id="@+id/textView2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
android:id="@+id/browse_game_path"
|
android:id="@+id/browse_game_path"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Browse" />
|
android:text="@string/browse" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView1"
|
android:id="@+id/textView3"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
<item>24</item>
|
<item>24</item>
|
||||||
<item>32</item>
|
<item>32</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="flash">
|
||||||
|
<item>bin</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string-array name="cable">
|
<string-array name="cable">
|
||||||
<item>HDMI</item>
|
<item>HDMI</item>
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
<string name="config_home">Please configure a home directory.</string>
|
<string name="config_home">Please configure a home directory.</string>
|
||||||
<string name="config_game">Please configure a game directory.</string>
|
<string name="config_game">Please configure a game directory.</string>
|
||||||
<string name="unsupported">Unsupported kernel version!</string>
|
<string name="unsupported">Unsupported kernel version!</string>
|
||||||
|
<string name="locate">Locate</string>
|
||||||
|
<string name="browse">Browse</string>
|
||||||
|
|
||||||
<string name="boot_bios">Boot Dreamcast BIOS</string>
|
<string name="boot_bios">Boot Dreamcast BIOS</string>
|
||||||
<string name="missing_bios_title">Missing Dreamcast BIOS</string>
|
<string name="missing_bios_title">Missing Dreamcast BIOS</string>
|
||||||
|
|
|
@ -156,9 +156,16 @@ public class FileBrowser extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ImgBrowse) {
|
if (!ImgBrowse) {
|
||||||
navigate(sdcard);
|
// navigate(sdcard);
|
||||||
|
LocateGames mLocateGames = new LocateGames(R.array.flash);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||||
|
mLocateGames
|
||||||
|
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, home_directory);
|
||||||
|
} else {
|
||||||
|
mLocateGames.execute(home_directory);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LocateGames mLocateGames = new LocateGames();
|
LocateGames mLocateGames = new LocateGames(R.array.images);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||||
mLocateGames
|
mLocateGames
|
||||||
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, game_directory);
|
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, game_directory);
|
||||||
|
@ -169,13 +176,19 @@ public class FileBrowser extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class LocateGames extends AsyncTask<String, Integer, List<File>> {
|
private final class LocateGames extends AsyncTask<String, Integer, List<File>> {
|
||||||
|
|
||||||
|
private int array;
|
||||||
|
|
||||||
|
public LocateGames(int arrayType) {
|
||||||
|
this.array = arrayType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<File> doInBackground(String... paths) {
|
protected List<File> doInBackground(String... paths) {
|
||||||
File storage = new File(paths[0]);
|
File storage = new File(paths[0]);
|
||||||
|
|
||||||
// array of valid image file extensions
|
// array of valid image file extensions
|
||||||
String[] mediaTypes = parentActivity.getResources().getStringArray(R.array.images);
|
String[] mediaTypes = parentActivity.getResources().getStringArray(array);
|
||||||
FilenameFilter[] filter = new FilenameFilter[mediaTypes.length];
|
FilenameFilter[] filter = new FilenameFilter[mediaTypes.length];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -209,10 +222,10 @@ public class FileBrowser extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
String heading = parentActivity.getString(R.string.games_listing);
|
String heading = parentActivity.getString(R.string.games_listing);
|
||||||
createListHeader(heading, list, true);
|
createListHeader(heading, list, array == R.array.images);
|
||||||
if (items != null && !items.isEmpty()) {
|
if (items != null && !items.isEmpty()) {
|
||||||
for (int i = 0; i < items.size(); i++) {
|
for (int i = 0; i < items.size(); i++) {
|
||||||
createListItem(list, items.get(i), i);
|
createListItem(list, items.get(i), i, array == R.array.images);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(parentActivity, R.string.config_game, Toast.LENGTH_LONG).show();
|
Toast.makeText(parentActivity, R.string.config_game, Toast.LENGTH_LONG).show();
|
||||||
|
@ -286,7 +299,7 @@ public class FileBrowser extends Fragment {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createListItem(LinearLayout list, final File game, final int index) {
|
private void createListItem(LinearLayout list, final File game, final int index, final boolean isGame) {
|
||||||
final View childview = parentActivity.getLayoutInflater().inflate(
|
final View childview = parentActivity.getLayoutInflater().inflate(
|
||||||
R.layout.app_list_item, null, false);
|
R.layout.app_list_item, null, false);
|
||||||
|
|
||||||
|
@ -301,6 +314,7 @@ public class FileBrowser extends Fragment {
|
||||||
childview.findViewById(R.id.childview).setOnClickListener(
|
childview.findViewById(R.id.childview).setOnClickListener(
|
||||||
new OnClickListener() {
|
new OnClickListener() {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
if (isGame) {
|
||||||
vib.vibrate(50);
|
vib.vibrate(50);
|
||||||
if (mPrefs.getBoolean(Config.pref_gamedetails, false)) {
|
if (mPrefs.getBoolean(Config.pref_gamedetails, false)) {
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||||
|
@ -332,6 +346,16 @@ public class FileBrowser extends Fragment {
|
||||||
.fromFile(game) : Uri.EMPTY);
|
.fromFile(game) : Uri.EMPTY);
|
||||||
vib.vibrate(250);
|
vib.vibrate(250);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
vib.vibrate(50);
|
||||||
|
mCallback.onFolderSelected(game != null ? Uri
|
||||||
|
.fromFile(game) : Uri.EMPTY);
|
||||||
|
home_directory = game.getAbsolutePath().substring(0,
|
||||||
|
game.getAbsolutePath().lastIndexOf(File.separator));
|
||||||
|
mPrefs.edit().putString("home_directory",
|
||||||
|
home_directory.replace("/data", "")).commit();
|
||||||
|
JNIdc.config(home_directory.replace("/data", ""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -101,10 +101,6 @@ public class OptionsFragment extends Fragment {
|
||||||
|
|
||||||
mainBrowse.setOnClickListener(new View.OnClickListener() {
|
mainBrowse.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (editBrowse.getText() != null) {
|
|
||||||
home_directory = editBrowse.getText().toString();
|
|
||||||
//mPrefs.edit().putString("home_directory", home_directory).commit();
|
|
||||||
}
|
|
||||||
mCallback.onMainBrowseSelected(home_directory, false);
|
mCallback.onMainBrowseSelected(home_directory, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue