Merge branch 'master' of https://github.com/reicast/reicast-emulator
This commit is contained in:
commit
ef6a83add6
|
@ -74,3 +74,7 @@ The original reicast team consisted of drk||Raziel (mostly just writing code), P
|
|||
Special thanks
|
||||
--------------
|
||||
In previous iterations a lot of people have worked on this, notably David Miller (aka, ZeZu), the nullDC team, friends from #pcsx2 and all over the world :)
|
||||
|
||||
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
||||
|
|
|
@ -9,9 +9,12 @@
|
|||
|
||||
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||
|
||||
<application
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
|
|
|
@ -28,6 +28,8 @@ public class EditVJoyActivity extends Activity {
|
|||
PopupWindow popUp;
|
||||
LayoutParams params;
|
||||
|
||||
private static float[][] vjoy_d_cached;
|
||||
|
||||
View addbut(int x, OnClickListener ocl) {
|
||||
ImageButton but = new ImageButton(this);
|
||||
|
||||
|
@ -63,6 +65,13 @@ public class EditVJoyActivity extends Activity {
|
|||
}
|
||||
}), params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.close, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
mView.restoreCustomVjoyValues(vjoy_d_cached);
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
popUp.setContentView(hlay);
|
||||
}
|
||||
|
||||
|
@ -79,6 +88,8 @@ public class EditVJoyActivity extends Activity {
|
|||
mView = new GL2JNIView(getApplication(), null, false, 24, 0, true);
|
||||
setContentView(mView);
|
||||
|
||||
vjoy_d_cached = GL2JNIView.readCustomVjoyValues(getApplicationContext());
|
||||
|
||||
JNIdc.show_osd();
|
||||
|
||||
Toast.makeText(getApplicationContext(),
|
||||
|
|
|
@ -16,13 +16,14 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Vibrator;
|
||||
|
@ -54,7 +55,7 @@ public class FileBrowser extends Fragment {
|
|||
private SharedPreferences mPrefs;
|
||||
private File sdcard = Environment.getExternalStorageDirectory();
|
||||
private String home_directory = sdcard + "/dc";
|
||||
private String game_directory = sdcard + "/";
|
||||
private String game_directory = sdcard + "/dc";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -154,9 +155,74 @@ public class FileBrowser extends Fragment {
|
|||
if (!ImgBrowse) {
|
||||
navigate(sdcard);
|
||||
} else {
|
||||
generate(ExternalFiles(new File(game_directory)));
|
||||
LocateGames mLocateGames = new LocateGames();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
mLocateGames
|
||||
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, game_directory);
|
||||
} else {
|
||||
mLocateGames.execute(game_directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LocateGames extends AsyncTask<String, Integer, List<File>> {
|
||||
|
||||
@Override
|
||||
protected List<File> doInBackground(String... paths) {
|
||||
final List<File> tFileList = new ArrayList<File>();
|
||||
File storage = new File(paths[0]);
|
||||
Resources resources = parentActivity.getResources();
|
||||
// array of valid image file extensions
|
||||
String[] mediaTypes = resources.getStringArray(R.array.images);
|
||||
FilenameFilter[] filter = new FilenameFilter[mediaTypes.length];
|
||||
|
||||
int i = 0;
|
||||
for (final String type : mediaTypes) {
|
||||
filter[i] = new FilenameFilter() {
|
||||
|
||||
public boolean accept(File dir, String name) {
|
||||
if (dir.getName().startsWith(".")
|
||||
|| name.startsWith(".")) {
|
||||
return false;
|
||||
} else {
|
||||
return StringUtils.endsWithIgnoreCase(name, "."
|
||||
+ type);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
i++;
|
||||
}
|
||||
|
||||
FileUtils fileUtils = new FileUtils();
|
||||
File[] allMatchingFiles = fileUtils.listFilesAsArray(storage,
|
||||
filter, 1);
|
||||
for (File mediaFile : allMatchingFiles) {
|
||||
tFileList.add(mediaFile);
|
||||
}
|
||||
return tFileList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<File> games) {
|
||||
if (games != null && !games.isEmpty()) {
|
||||
final LinearLayout list = (LinearLayout) parentActivity
|
||||
.findViewById(R.id.game_list);
|
||||
list.removeAllViews();
|
||||
|
||||
String heading = parentActivity
|
||||
.getString(R.string.games_listing);
|
||||
createListHeader(heading, list, true);
|
||||
for (int i = 0; i < games.size(); i++) {
|
||||
createListItem(list, games.get(i));
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(parentActivity, "Please configure a games directory",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DirSort implements Comparator<File> {
|
||||
|
||||
|
@ -170,47 +236,13 @@ public class FileBrowser extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private List<File> ExternalFiles(File baseDirectory) {
|
||||
// allows the input of a base directory for storage selection
|
||||
final List<File> tFileList = new ArrayList<File>();
|
||||
Resources resources = getResources();
|
||||
// array of valid image file extensions
|
||||
String[] mediaTypes = resources.getStringArray(R.array.images);
|
||||
FilenameFilter[] filter = new FilenameFilter[mediaTypes.length];
|
||||
|
||||
int i = 0;
|
||||
for (final String type : mediaTypes) {
|
||||
filter[i] = new FilenameFilter() {
|
||||
|
||||
public boolean accept(File dir, String name) {
|
||||
if (dir.getName().startsWith(".") || name.startsWith(".")) {
|
||||
return false;
|
||||
} else {
|
||||
return StringUtils.endsWithIgnoreCase(name, "." + type);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
i++;
|
||||
}
|
||||
|
||||
FileUtils fileUtils = new FileUtils();
|
||||
File[] allMatchingFiles = fileUtils.listFilesAsArray(baseDirectory,
|
||||
filter, -1);
|
||||
for (File mediaFile : allMatchingFiles) {
|
||||
tFileList.add(mediaFile);
|
||||
}
|
||||
|
||||
return tFileList;
|
||||
}
|
||||
|
||||
private void createListHeader(String header_text, View view, boolean hasBios) {
|
||||
if (hasBios) {
|
||||
final View childview = parentActivity.getLayoutInflater().inflate(
|
||||
R.layout.bios_list_item, null, false);
|
||||
|
||||
((TextView) childview.findViewById(R.id.item_name))
|
||||
.setText(getString(R.string.boot_bios));
|
||||
.setText(parentActivity.getString(R.string.boot_bios));
|
||||
|
||||
childview.setTag(null);
|
||||
|
||||
|
@ -255,41 +287,21 @@ public class FileBrowser extends Fragment {
|
|||
|
||||
}
|
||||
|
||||
void generate(List<File> games) {
|
||||
final LinearLayout list = (LinearLayout) parentActivity
|
||||
.findViewById(R.id.game_list);
|
||||
list.removeAllViews();
|
||||
|
||||
String heading = parentActivity.getString(R.string.games_listing);
|
||||
createListHeader(heading, list, true);
|
||||
for (int i = 0; i < games.size(); i++) {
|
||||
createListItem(list, games.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
private void createListItem(LinearLayout list, final File game) {
|
||||
final String name = game.getName();
|
||||
final View childview = parentActivity
|
||||
.getLayoutInflater()
|
||||
.inflate(R.layout.app_list_item, null,
|
||||
false);
|
||||
final View childview = parentActivity.getLayoutInflater().inflate(
|
||||
R.layout.app_list_item, null, false);
|
||||
|
||||
((TextView) childview.findViewById(R.id.item_name))
|
||||
.setText(name);
|
||||
((TextView) childview.findViewById(R.id.item_name)).setText(name);
|
||||
|
||||
((ImageView) childview.findViewById(R.id.item_icon))
|
||||
.setImageResource(game == null ? R.drawable.config
|
||||
: game.isDirectory() ? R.drawable.open_folder
|
||||
: name.toLowerCase(
|
||||
Locale.getDefault())
|
||||
.endsWith(".gdi") ? R.drawable.gdi
|
||||
: name.toLowerCase(
|
||||
Locale.getDefault())
|
||||
.endsWith(
|
||||
".cdi") ? R.drawable.cdi
|
||||
: name.toLowerCase(
|
||||
Locale.getDefault())
|
||||
.endsWith(
|
||||
.setImageResource(game == null ? R.drawable.config : game
|
||||
.isDirectory() ? R.drawable.open_folder
|
||||
: name.toLowerCase(Locale.getDefault())
|
||||
.endsWith(".gdi") ? R.drawable.gdi : name
|
||||
.toLowerCase(Locale.getDefault()).endsWith(
|
||||
".cdi") ? R.drawable.cdi : name
|
||||
.toLowerCase(Locale.getDefault()).endsWith(
|
||||
".chd") ? R.drawable.chd
|
||||
: R.drawable.disk_unknown);
|
||||
|
||||
|
@ -299,23 +311,20 @@ public class FileBrowser extends Fragment {
|
|||
|
||||
// vw.findViewById(R.id.childview).setBackgroundColor(0xFFFFFFFF);
|
||||
|
||||
childview.findViewById(R.id.childview)
|
||||
.setOnClickListener(new OnClickListener() {
|
||||
childview.findViewById(R.id.childview).setOnClickListener(
|
||||
new OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
vib.vibrate(50);
|
||||
mCallback
|
||||
.onGameSelected(game != null ? Uri
|
||||
.fromFile(game)
|
||||
: Uri.EMPTY);
|
||||
mCallback.onGameSelected(game != null ? Uri
|
||||
.fromFile(game) : Uri.EMPTY);
|
||||
vib.vibrate(250);
|
||||
}
|
||||
});
|
||||
|
||||
childview.findViewById(R.id.childview)
|
||||
.setOnTouchListener(new OnTouchListener() {
|
||||
childview.findViewById(R.id.childview).setOnTouchListener(
|
||||
new OnTouchListener() {
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean onTouch(View view,
|
||||
MotionEvent arg1) {
|
||||
public boolean onTouch(View view, MotionEvent arg1) {
|
||||
if (arg1.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||
view.setBackgroundColor(0xFF4F3FFF);
|
||||
} else if (arg1.getActionMasked() == MotionEvent.ACTION_CANCEL
|
||||
|
|
|
@ -267,6 +267,9 @@ public class GL2JNIActivity extends Activity {
|
|||
OuyaController.BUTTON_MENU, key_CONT_START,
|
||||
OuyaController.BUTTON_R1, key_CONT_START };
|
||||
nVidia[playerNum] = true;
|
||||
|
||||
globalLS_X[playerNum] = previousLS_X[playerNum] = 0.0f;
|
||||
globalLS_Y[playerNum] = previousLS_Y[playerNum] = 0.0f;
|
||||
} else if (!moga.isActive) { // Ouya controller
|
||||
map[playerNum] = new int[] {
|
||||
OuyaController.BUTTON_O, key_CONT_A,
|
||||
|
|
|
@ -146,7 +146,7 @@ class GL2JNIView extends GLSurfaceView
|
|||
prefs.edit().putFloat("touch_scale_analog", vjoy_d_custom[5][2]).commit();
|
||||
}
|
||||
|
||||
private static float[][] readCustomVjoyValues(Context context) {
|
||||
public static float[][] readCustomVjoyValues(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
return new float[][]
|
||||
|
@ -194,6 +194,14 @@ class GL2JNIView extends GLSurfaceView
|
|||
requestLayout();
|
||||
}
|
||||
|
||||
public void restoreCustomVjoyValues(float[][] vjoy_d_cached) {
|
||||
vjoy_d_custom = vjoy_d_cached;
|
||||
writeCustomVjoyValues(vjoy_d_cached, context);
|
||||
|
||||
resetEditMode();
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public GL2JNIView(Context context,String newFileName,boolean translucent,int depth,int stencil,boolean editVjoyMode)
|
||||
{
|
||||
super(context);
|
||||
|
|
|
@ -60,6 +60,9 @@ public class InputFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
if (!MainActivity.isBiosExisting() || !MainActivity.isFlashExisting())
|
||||
buttonLaunchEditor.setEnabled(false);
|
||||
|
||||
OnCheckedChangeListener touch_vibration = new OnCheckedChangeListener() {
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
|
|
|
@ -37,8 +37,8 @@ public class MainActivity extends FragmentActivity implements
|
|||
FileBrowser.OnItemSelectedListener, OptionsFragment.OnClickListener {
|
||||
|
||||
private SharedPreferences mPrefs;
|
||||
private File sdcard = Environment.getExternalStorageDirectory();
|
||||
private String home_directory = sdcard + "/dc";
|
||||
private static File sdcard = Environment.getExternalStorageDirectory();
|
||||
public static String home_directory = sdcard + "/dc";
|
||||
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ListView mDrawerList;
|
||||
|
@ -268,14 +268,21 @@ public class MainActivity extends FragmentActivity implements
|
|||
|
||||
}
|
||||
|
||||
public void onGameSelected(Uri uri) {
|
||||
public static boolean isBiosExisting() {
|
||||
File bios = new File(home_directory, "data/dc_boot.bin");
|
||||
File flash = new File(home_directory, "data/dc_flash.bin");
|
||||
return bios.exists();
|
||||
}
|
||||
|
||||
public static boolean isFlashExisting() {
|
||||
File flash = new File(home_directory, "data/dc_flash.bin");
|
||||
return flash.exists();
|
||||
}
|
||||
|
||||
public void onGameSelected(Uri uri) {
|
||||
String msg = null;
|
||||
if (!bios.exists())
|
||||
if (!isBiosExisting())
|
||||
msg = getString(R.string.missing_bios, home_directory);
|
||||
else if (!flash.exists())
|
||||
else if (!isFlashExisting())
|
||||
msg = getString(R.string.missing_flash, home_directory);
|
||||
|
||||
if (msg != null) {
|
||||
|
|
|
@ -27,7 +27,7 @@ public class OptionsFragment extends Fragment {
|
|||
private SharedPreferences mPrefs;
|
||||
private File sdcard = Environment.getExternalStorageDirectory();
|
||||
private String home_directory = sdcard + "/dc";
|
||||
private String game_directory = sdcard + "/";
|
||||
private String game_directory = sdcard + "/dc";
|
||||
|
||||
// Container Activity must implement this interface
|
||||
public interface OnClickListener {
|
||||
|
|
Loading…
Reference in New Issue