diff --git a/core/hw/pvr/ta_ctx.cpp b/core/hw/pvr/ta_ctx.cpp
index cee1c7835..12c237159 100644
--- a/core/hw/pvr/ta_ctx.cpp
+++ b/core/hw/pvr/ta_ctx.cpp
@@ -41,7 +41,7 @@ void SetCurrentTARC(u32 addr)
bool TryDecodeTARC()
{
- verify((int)ta_ctx);
+ verify(ta_ctx != 0);
if (vd_ctx == 0)
{
@@ -62,7 +62,7 @@ bool TryDecodeTARC()
void VDecEnd()
{
- verify((int)vd_ctx);
+ verify(vd_ctx != 0);
vd_ctx->rend = vd_rc;
diff --git a/shell/android/AndroidManifest.xml b/shell/android/AndroidManifest.xml
index 539c17e0f..10906caea 100644
--- a/shell/android/AndroidManifest.xml
+++ b/shell/android/AndroidManifest.xml
@@ -2,6 +2,13 @@
package="com.reicast.emulator"
android:versionCode="7"
android:versionName="r7" >
+
+
+
+
+
+
\ No newline at end of file
diff --git a/shell/android/res/layout/drawer_menu.xml b/shell/android/res/layout/drawer_menu.xml
index 465ec919d..434057f7b 100644
--- a/shell/android/res/layout/drawer_menu.xml
+++ b/shell/android/res/layout/drawer_menu.xml
@@ -47,7 +47,7 @@
android:id="@+id/settings_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="26dp"
+ android:layout_marginLeft="32dp"
android:layout_marginTop="10dp"
android:background="@drawable/game_selector"
android:focusable="true"
@@ -109,7 +109,7 @@
android:id="@+id/about_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="26dp"
+ android:layout_marginLeft="32dp"
android:layout_marginTop="10dp"
android:background="@drawable/game_selector"
android:focusable="true"
@@ -170,7 +170,7 @@
android:id="@+id/cloud_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="26dp"
+ android:layout_marginLeft="32dp"
android:layout_marginTop="10dp"
android:background="@drawable/game_selector"
android:focusable="true"
diff --git a/shell/android/res/layout/menu_popup_config.xml b/shell/android/res/layout/menu_popup_config.xml
index 3669b4bf1..ef2b5b1de 100755
--- a/shell/android/res/layout/menu_popup_config.xml
+++ b/shell/android/res/layout/menu_popup_config.xml
@@ -2,22 +2,23 @@
@@ -32,8 +34,8 @@
@@ -48,8 +51,8 @@
@@ -64,8 +68,8 @@
@@ -80,8 +85,8 @@
@@ -96,8 +102,8 @@
@@ -112,8 +119,8 @@
diff --git a/shell/android/res/layout/menu_popup_debug.xml b/shell/android/res/layout/menu_popup_debug.xml
index 8bf0bf925..8abd257a3 100755
--- a/shell/android/res/layout/menu_popup_debug.xml
+++ b/shell/android/res/layout/menu_popup_debug.xml
@@ -2,22 +2,23 @@
@@ -32,8 +34,8 @@
@@ -48,8 +51,8 @@
@@ -64,8 +68,8 @@
@@ -80,8 +85,8 @@
diff --git a/shell/android/res/layout/menu_popup_main.xml b/shell/android/res/layout/menu_popup_main.xml
index 272f5145d..4a7c9f2b6 100755
--- a/shell/android/res/layout/menu_popup_main.xml
+++ b/shell/android/res/layout/menu_popup_main.xml
@@ -2,22 +2,23 @@
@@ -46,8 +48,8 @@
@@ -62,8 +65,8 @@
@@ -78,8 +82,8 @@
@@ -94,8 +99,8 @@
@@ -110,8 +116,8 @@
diff --git a/shell/android/res/values/strings.xml b/shell/android/res/values/strings.xml
index cf517ed73..6f244803a 100644
--- a/shell/android/res/values/strings.xml
+++ b/shell/android/res/values/strings.xml
@@ -101,7 +101,7 @@
Input
About
Rate Me
- Test Suite
+ Send Logs
Cloud VMU
ON
diff --git a/shell/android/src/com/reicast/emulator/AboutFragment.java b/shell/android/src/com/reicast/emulator/AboutFragment.java
index ab8a80af0..a7b75c89e 100644
--- a/shell/android/src/com/reicast/emulator/AboutFragment.java
+++ b/shell/android/src/com/reicast/emulator/AboutFragment.java
@@ -98,13 +98,7 @@ public class AboutFragment extends Fragment {
slidingGithub.setOnDrawerOpenListener(new OnDrawerOpenListener() {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onDrawerOpened() {
- retrieveGitTask queryGithub = new retrieveGitTask();
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- queryGithub.executeOnExecutor(
- AsyncTask.THREAD_POOL_EXECUTOR, git_api);
- } else {
- queryGithub.execute(git_api);
- }
+ new retrieveGitTask().execute(git_api);
}
});
diff --git a/shell/android/src/com/reicast/emulator/FileBrowser.java b/shell/android/src/com/reicast/emulator/FileBrowser.java
index 313291c5a..ffd7363b1 100644
--- a/shell/android/src/com/reicast/emulator/FileBrowser.java
+++ b/shell/android/src/com/reicast/emulator/FileBrowser.java
@@ -195,21 +195,9 @@ public class FileBrowser extends Fragment {
}
if (!ImgBrowse && !games) {
- 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);
- }
+ new LocateGames(R.array.flash).execute(home_directory);
} else {
- LocateGames mLocateGames = new LocateGames(R.array.images);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- mLocateGames
- .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, game_directory);
- } else {
- mLocateGames.execute(game_directory);
- }
+ new LocateGames(R.array.images).execute(game_directory);
}
}
@@ -405,14 +393,13 @@ public class FileBrowser extends Fragment {
mCallback.onFolderSelected(game != null ? Uri
.fromFile(game) : Uri.EMPTY);
home_directory = game.getAbsolutePath().substring(0,
- game.getAbsolutePath().lastIndexOf(File.separator));
+ game.getAbsolutePath().lastIndexOf(File.separator)).replace("/data", "");
if (!DataDirectoryBIOS()) {
MainActivity.showToastMessage(getActivity(),
getActivity().getString(R.string.config_data, home_directory),
Toast.LENGTH_LONG);
}
- mPrefs.edit().putString("home_directory",
- home_directory.replace("/data", "")).commit();
+ mPrefs.edit().putString("home_directory", home_directory).commit();
JNIdc.config(home_directory.replace("/data", ""));
}
}
@@ -504,7 +491,7 @@ public class FileBrowser extends Fragment {
.putString(Config.pref_games,
heading).commit();
} else {
- home_directory = heading;
+ home_directory = heading.replace("/data", "");
mPrefs.edit()
.putString(Config.pref_home,
heading).commit();
@@ -544,12 +531,18 @@ public class FileBrowser extends Fragment {
if (!data_directory.exists() || !data_directory.isDirectory()) {
data_directory.mkdirs();
File bios = new File(home_directory, "dc_boot.bin");
- boolean success = bios.renameTo(new File(home_directory + "/data", "dc_boot.bin"));
+ boolean success = bios.renameTo(new File(home_directory, "data/dc_boot.bin"));
File flash = new File(home_directory, "dc_flash.bin");
- success = flash.renameTo(new File(home_directory + "/data", "dc_flash.bin"));
+ success = flash.renameTo(new File(home_directory, "data/dc_flash.bin"));
return success;
} else {
- return true;
+ File bios = new File(home_directory, "data/dc_boot.bin");
+ File flash = new File(home_directory, "data/dc_flash.bin");
+ if (bios.exists() && flash.exists()) {
+ return true;
+ } else {
+ return false;
+ }
}
}
}
diff --git a/shell/android/src/com/reicast/emulator/GL2JNIActivity.java b/shell/android/src/com/reicast/emulator/GL2JNIActivity.java
index 01212eda2..98ba5ff10 100644
--- a/shell/android/src/com/reicast/emulator/GL2JNIActivity.java
+++ b/shell/android/src/com/reicast/emulator/GL2JNIActivity.java
@@ -96,6 +96,7 @@ public class GL2JNIActivity extends Activity {
pad.deviceDescriptor_PlayerNum.remove(null);
moga.onCreate(this, pad);
+ moga.mListener.setPlayerNum(1);
boolean controllerTwoConnected = false;
boolean controllerThreeConnected = false;
@@ -314,7 +315,73 @@ public class GL2JNIActivity extends Activity {
} else {
return false;
}
+ }
+
+ public boolean motionEventHandler(Integer playerNum, com.bda.controller.MotionEvent event) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
+ if (playerNum == null || playerNum == -1)
+ return false;
+
+ if (!pad.compat[playerNum]) {
+
+ // do other things with joystick
+ float LS_X = event.getAxisValue(OuyaController.AXIS_LS_X);
+ float LS_Y = event.getAxisValue(OuyaController.AXIS_LS_Y);
+ float RS_X = event.getAxisValue(OuyaController.AXIS_RS_X);
+ float RS_Y = event.getAxisValue(OuyaController.AXIS_RS_Y);
+ float L2 = event.getAxisValue(OuyaController.AXIS_L2);
+ float R2 = event.getAxisValue(OuyaController.AXIS_R2);
+
+ if (!pad.joystick[playerNum]) {
+ pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum];
+ pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum];
+ pad.globalLS_X[playerNum] = LS_X;
+ pad.globalLS_Y[playerNum] = LS_Y;
+ }
+
+ GL2JNIView.jx[playerNum] = (int) (LS_X * 126);
+ GL2JNIView.jy[playerNum] = (int) (LS_Y * 126);
+
+ GL2JNIView.lt[playerNum] = (int) (L2 * 255);
+ GL2JNIView.rt[playerNum] = (int) (R2 * 255);
+
+ if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) {
+ if (RS_Y > 0.25) {
+ handle_key(playerNum, pad.map[playerNum][0]/* A */, true);
+ pad.wasKeyStick[playerNum] = true;
+ } else if (RS_Y < 0.25) {
+ handle_key(playerNum, pad.map[playerNum][1]/* B */, true);
+ pad.wasKeyStick[playerNum] = true;
+ } else if (pad.wasKeyStick[playerNum]){
+ handle_key(playerNum, pad.map[playerNum][0], false);
+ handle_key(playerNum, pad.map[playerNum][1], false);
+ pad.wasKeyStick[playerNum] = false;
+ }
+ } else {
+ if (RS_Y > 0.25) {
+ GL2JNIView.rt[playerNum] = (int) (RS_Y * 255);
+ GL2JNIView.lt[playerNum] = (int) (L2 * 255);
+ } else if (RS_Y < 0.25) {
+ GL2JNIView.rt[playerNum] = (int) (R2 * 255);
+ GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255);
+ }
+ }
+
+ }
+ mView.pushInput();
+ if (!pad.joystick[playerNum] && (pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum] && pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum])
+ || (pad.previousLS_X[playerNum] == 0.0f && pad.previousLS_Y[playerNum] == 0.0f))
+ // Only handle Left Stick on an Xbox 360 controller if there was
+ // some actual motion on the stick,
+ // so otherwise the event can be handled as a DPAD event
+ return false;
+ else
+ return true;
+
+ } else {
+ return false;
+ }
}
public boolean simulatedTouchEvent(int playerNum, float L2, float R2) {
diff --git a/shell/android/src/com/reicast/emulator/GL2JNINative.java b/shell/android/src/com/reicast/emulator/GL2JNINative.java
index c0346ac3f..f2b89174e 100644
--- a/shell/android/src/com/reicast/emulator/GL2JNINative.java
+++ b/shell/android/src/com/reicast/emulator/GL2JNINative.java
@@ -98,6 +98,7 @@ public class GL2JNINative extends NativeActivity {
pad.deviceDescriptor_PlayerNum.remove(null);
moga.onCreate(this, pad);
+ moga.mListener.setPlayerNum(1);
boolean controllerTwoConnected = false;
boolean controllerThreeConnected = false;
@@ -320,6 +321,73 @@ public class GL2JNINative extends NativeActivity {
popUpConfig.update(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
}
+
+ public boolean motionEventHandler(Integer playerNum, com.bda.controller.MotionEvent event) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
+
+ if (playerNum == null || playerNum == -1)
+ return false;
+
+ if (!pad.compat[playerNum]) {
+
+ // do other things with joystick
+ float LS_X = event.getAxisValue(OuyaController.AXIS_LS_X);
+ float LS_Y = event.getAxisValue(OuyaController.AXIS_LS_Y);
+ float RS_X = event.getAxisValue(OuyaController.AXIS_RS_X);
+ float RS_Y = event.getAxisValue(OuyaController.AXIS_RS_Y);
+ float L2 = event.getAxisValue(OuyaController.AXIS_L2);
+ float R2 = event.getAxisValue(OuyaController.AXIS_R2);
+
+ if (!pad.joystick[playerNum]) {
+ pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum];
+ pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum];
+ pad.globalLS_X[playerNum] = LS_X;
+ pad.globalLS_Y[playerNum] = LS_Y;
+ }
+
+ GL2JNIView.jx[playerNum] = (int) (LS_X * 126);
+ GL2JNIView.jy[playerNum] = (int) (LS_Y * 126);
+
+ GL2JNIView.lt[playerNum] = (int) (L2 * 255);
+ GL2JNIView.rt[playerNum] = (int) (R2 * 255);
+
+ if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) {
+ if (RS_Y > 0.25) {
+ handle_key(playerNum, pad.map[playerNum][0]/* A */, true);
+ pad.wasKeyStick[playerNum] = true;
+ } else if (RS_Y < 0.25) {
+ handle_key(playerNum, pad.map[playerNum][1]/* B */, true);
+ pad.wasKeyStick[playerNum] = true;
+ } else if (pad.wasKeyStick[playerNum]){
+ handle_key(playerNum, pad.map[playerNum][0], false);
+ handle_key(playerNum, pad.map[playerNum][1], false);
+ pad.wasKeyStick[playerNum] = false;
+ }
+ } else {
+ if (RS_Y > 0.25) {
+ GL2JNIView.rt[playerNum] = (int) (RS_Y * 255);
+ GL2JNIView.lt[playerNum] = (int) (L2 * 255);
+ } else if (RS_Y < 0.25) {
+ GL2JNIView.rt[playerNum] = (int) (R2 * 255);
+ GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255);
+ }
+ }
+
+ }
+ mView.pushInput();
+ if (!pad.joystick[playerNum] && (pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum] && pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum])
+ || (pad.previousLS_X[playerNum] == 0.0f && pad.previousLS_Y[playerNum] == 0.0f))
+ // Only handle Left Stick on an Xbox 360 controller if there was
+ // some actual motion on the stick,
+ // so otherwise the event can be handled as a DPAD event
+ return false;
+ else
+ return true;
+
+ } else {
+ return false;
+ }
+ }
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
@@ -402,7 +470,7 @@ public class GL2JNINative extends NativeActivity {
}
- boolean handle_key(Integer playerNum, int kc, boolean down) {
+ public boolean handle_key(Integer playerNum, int kc, boolean down) {
if (playerNum == null || playerNum == -1)
return false;
if (kc == pad.getSelectButtonCode()) {
diff --git a/shell/android/src/com/reicast/emulator/MainActivity.java b/shell/android/src/com/reicast/emulator/MainActivity.java
index bd3068def..56841d19c 100644
--- a/shell/android/src/com/reicast/emulator/MainActivity.java
+++ b/shell/android/src/com/reicast/emulator/MainActivity.java
@@ -106,11 +106,7 @@ public class MainActivity extends SlidingFragmentActivity implements
public void uncaughtException(Thread t, Throwable error) {
if (error != null) {
StringBuilder output = new StringBuilder();
- output.append("Thread:\n");
- for (StackTraceElement trace : t.getStackTrace()) {
- output.append(trace.toString() + "\n");
- }
- output.append("\nError:\n");
+ output.append("UncaughtException:\n");
for (StackTraceElement trace : error.getStackTrace()) {
output.append(trace.toString() + "\n");
}
@@ -349,14 +345,7 @@ public class MainActivity extends SlidingFragmentActivity implements
}
public void generateErrorLog() {
- GenerateLogs mGenerateLogs = new GenerateLogs(MainActivity.this);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- mGenerateLogs.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
- getFilesDir().getAbsolutePath());
- } else {
- mGenerateLogs.execute(getFilesDir().getAbsolutePath());
- }
-
+ new GenerateLogs(MainActivity.this).execute(getFilesDir().getAbsolutePath());
}
/**
diff --git a/shell/android/src/com/reicast/emulator/XMLParser.java b/shell/android/src/com/reicast/emulator/XMLParser.java
index 012c7e77a..7d4c4a432 100755
--- a/shell/android/src/com/reicast/emulator/XMLParser.java
+++ b/shell/android/src/com/reicast/emulator/XMLParser.java
@@ -196,12 +196,15 @@ public class XMLParser extends AsyncTask {
public boolean isNetworkAvailable() {
ConnectivityManager connectivityManager = (ConnectivityManager) mContext
- .getSystemService(Context.CONNECTIVITY_SERVICE);
-// NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
+ .getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mWifi = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
- NetworkInfo mMobile = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
-// return activeNetworkInfo != null && activeNetworkInfo.isConnected();
- return mMobile.isAvailable() || mWifi.isAvailable();
+ NetworkInfo mMobile = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
+ NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
+ if (mMobile != null && mWifi != null) {
+ return mMobile.isAvailable() || mWifi.isAvailable();
+ } else {
+ return activeNetworkInfo != null && activeNetworkInfo.isConnected();
+ }
}
public Drawable getGameIcon() {
diff --git a/shell/android/src/com/reicast/emulator/config/InputFragment.java b/shell/android/src/com/reicast/emulator/config/InputFragment.java
index b133a63c2..633076e49 100644
--- a/shell/android/src/com/reicast/emulator/config/InputFragment.java
+++ b/shell/android/src/com/reicast/emulator/config/InputFragment.java
@@ -71,6 +71,7 @@ public class InputFragment extends Fragment {
parentActivity = getActivity();
moga.onCreate(parentActivity, pad);
+ moga.mListener.setPlayerNum(1);
sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(parentActivity);
diff --git a/shell/android/src/com/reicast/emulator/periph/MOGAInput.java b/shell/android/src/com/reicast/emulator/periph/MOGAInput.java
index 5023f9fae..a587512ba 100644
--- a/shell/android/src/com/reicast/emulator/periph/MOGAInput.java
+++ b/shell/android/src/com/reicast/emulator/periph/MOGAInput.java
@@ -14,12 +14,14 @@ import android.os.Handler;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.util.Log;
-import com.bda.controller.KeyEvent;
+import com.bda.controller.KeyEvent;
import com.bda.controller.Controller;
import com.bda.controller.ControllerListener;
import com.bda.controller.MotionEvent;
import com.bda.controller.StateEvent;
+import com.reicast.emulator.GL2JNIActivity;
+import com.reicast.emulator.GL2JNINative;
import com.reicast.emulator.R;
/******************************************************************************/
@@ -39,6 +41,7 @@ public final class MOGAInput
static final int ACTION_VERSION_MOGAPRO = Controller.ACTION_VERSION_MOGAPRO;
public Controller mController = null;
+ public ExampleControllerListener mListener;
private String notify;
private Gamepad pad;
@@ -88,7 +91,8 @@ public final class MOGAInput
mController = Controller.getInstance(act);
mController.init();
- mController.setListener(new ExampleControllerListener(), new Handler());
+ mListener = new ExampleControllerListener();
+ mController.setListener(mListener, new Handler());
}
public void onDestroy()
@@ -129,19 +133,36 @@ public final class MOGAInput
*/
}
- class ExampleControllerListener implements ControllerListener
+ public class ExampleControllerListener implements ControllerListener
{
+ int playerNum;
+
+ public void setPlayerNum(int playerNum) {
+ this.playerNum = playerNum;
+ }
+
public void onKeyEvent(KeyEvent event)
{
- // Handled by the primary controller interface
-// act.dispatchKeyEvent(new android.view.KeyEvent(0, 0, event.getAction(),
-// event.getKeyCode(), 0));
+ boolean keydown = false;
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ keydown = true;
+ }
+ if (act instanceof GL2JNIActivity) {
+ ((GL2JNIActivity) act).handle_key(playerNum, event.getKeyCode(), keydown);
+ }
+ if (act instanceof GL2JNINative) {
+ ((GL2JNINative) act).handle_key(playerNum, event.getKeyCode(), keydown);
+ }
}
public void onMotionEvent(MotionEvent event)
{
- // Handled by the primary controller interface
-
+ if (act instanceof GL2JNIActivity) {
+ ((GL2JNIActivity) act).motionEventHandler(playerNum, event);
+ }
+ if (act instanceof GL2JNINative) {
+ ((GL2JNINative) act).motionEventHandler(playerNum, event);
+ }
}
private void getCompatibilityMap(int playerNum, String id) {