Permalink
Browse files

Merge branch 'master' into gliden64-integration

  • Loading branch information...
littleguy77 committed May 6, 2015
2 parents 6caccc0 + cd7a8e0 commit 0ad20b38cc18bfaea21a6274fa6ab72f276fb0fb
Showing with 612 additions and 567 deletions.
  1. +6 −5 AndroidManifest.xml
  2. +8 −8 doc/GameActivity.ucls
  3. +5 −0 jni/SDL2/src/core/android/SDL_android.c
  4. +6 −0 jni/ae-bridge/ae_exports.cpp
  5. +1 −4 jni/mupen64plus-video-gliden64/.gitignore
  6. +2 −2 res/layout/game_activity.xml
  7. +1 −1 res/layout/touchscreen_profile_activity.xml
  8. +1 −1 res/xml/preferences_game.xml
  9. +190 −0 src/paulscode/android/mupen64plusae/ActivityHelper.java
  10. +96 −66 src/paulscode/android/mupen64plusae/GalleryActivity.java
  11. +0 −58 src/paulscode/android/mupen64plusae/Keys.java
  12. +19 −26 src/paulscode/android/mupen64plusae/SplashActivity.java
  13. +8 −8 src/paulscode/android/mupen64plusae/cheat/CheatEditorActivity.java
  14. +2 −1 src/paulscode/android/mupen64plusae/{ → game}/GameActivity.java
  15. +2 −1 src/paulscode/android/mupen64plusae/{ → game}/GameActivityXperiaPlay.java
  16. +32 −30 src/paulscode/android/mupen64plusae/{ → game}/GameLifecycleHandler.java
  17. +14 −12 src/paulscode/android/mupen64plusae/{ → game}/GameMenuHandler.java
  18. +2 −1 src/paulscode/android/mupen64plusae/{ → game}/GameOverlay.java
  19. +1 −1 src/paulscode/android/mupen64plusae/{ → game}/GameSurface.java
  20. +2 −2 src/paulscode/android/mupen64plusae/input/DiagnosticActivity.java
  21. +1 −1 src/paulscode/android/mupen64plusae/input/PeripheralController.java
  22. +1 −1 src/paulscode/android/mupen64plusae/input/map/VisibleTouchMap.java
  23. +14 −19 src/paulscode/android/mupen64plusae/{ → jni}/CoreInterface.java
  24. +18 −18 src/paulscode/android/mupen64plusae/jni/NativeConfigFiles.java
  25. +0 −1 src/paulscode/android/mupen64plusae/jni/NativeExports.java
  26. +0 −1 src/paulscode/android/mupen64plusae/jni/NativeImports.java
  27. +0 −1 src/paulscode/android/mupen64plusae/jni/NativeInput.java
  28. +0 −1 src/paulscode/android/mupen64plusae/jni/NativeSDL.java
  29. +55 −18 src/paulscode/android/mupen64plusae/persistent/GamePrefs.java
  30. +31 −141 src/paulscode/android/mupen64plusae/{PlayMenuActivity.java → persistent/GamePrefsActivity.java}
  31. +4 −4 src/paulscode/android/mupen64plusae/persistent/{UserPrefs.java → GlobalPrefs.java}
  32. +19 −23 ...ulscode/android/mupen64plusae/{SettingsGlobalActivity.java → persistent/GlobalPrefsActivity.java}
  33. +3 −3 src/paulscode/android/mupen64plusae/preference/PlayerMapPreference.java
  34. +14 −14 src/paulscode/android/mupen64plusae/profile/ControllerProfileActivity.java
  35. +4 −4 src/paulscode/android/mupen64plusae/profile/EmulationProfileActivity.java
  36. +5 −8 src/paulscode/android/mupen64plusae/profile/ManageControllerProfilesActivity.java
  37. +7 −10 src/paulscode/android/mupen64plusae/profile/ManageEmulationProfilesActivity.java
  38. +4 −4 src/paulscode/android/mupen64plusae/profile/ManageProfilesActivity.java
  39. +5 −8 src/paulscode/android/mupen64plusae/profile/ManageTouchscreenProfilesActivity.java
  40. +4 −4 src/paulscode/android/mupen64plusae/profile/ProfileActivity.java
  41. +22 −26 src/paulscode/android/mupen64plusae/profile/TouchscreenProfileActivity.java
  42. +3 −3 src/paulscode/android/mupen64plusae/util/CrashHandler.java
  43. +0 −27 src/paulscode/android/mupen64plusae/util/Utility.java
View
@@ -60,10 +60,11 @@
android:name="paulscode.android.mupen64plusae.GalleryActivity"
android:exported="false"
android:label="@string/GalleryActivity_title"
- android:launchMode="singleTask" >
+ android:launchMode="singleTask"
+ android:theme="@style/Theme.AppCompat.NoActionBar" >
</activity>
<activity
- android:name="paulscode.android.mupen64plusae.PlayMenuActivity"
+ android:name="paulscode.android.mupen64plusae.persistent.GamePrefsActivity"
android:exported="false"
android:label="@string/PlayMenuActivity_title" >
<intent-filter>
@@ -73,7 +74,7 @@
</intent-filter>
</activity>
<activity
- android:name="paulscode.android.mupen64plusae.SettingsGlobalActivity"
+ android:name="paulscode.android.mupen64plusae.persistent.GlobalPrefsActivity"
android:exported="false"
android:label="@string/SettingsGlobalActivity_title" >
<intent-filter>
@@ -168,13 +169,13 @@
This behavior is specified in android:configChanges below.
-->
<activity
- android:name="paulscode.android.mupen64plusae.GameActivity"
+ android:name="paulscode.android.mupen64plusae.game.GameActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/GameActivity_title"
android:theme="@style/appTheme.Black" >
</activity>
<activity
- android:name="paulscode.android.mupen64plusae.GameActivityXperiaPlay"
+ android:name="paulscode.android.mupen64plusae.game.GameActivityXperiaPlay"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/GameActivity_title"
android:theme="@style/appTheme.Black" >
View
@@ -1,6 +1,6 @@
<class-diagram version="1.0.11" icons="true" automaticImage="PNG" always-add-relationships="false"
generalizations="true" realizations="true" associations="true" dependencies="false" nesting-relationships="true">
- <class id="1" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.GameLifecycleHandler"
+ <class id="1" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.game.GameLifecycleHandler"
project="mupen64plus" file="/mupen64plus/src/paulscode/android/mupen64plusae/GameLifecycleHandler.java"
binary="false">
<position height="-1" width="-1" x="501" y="458"/>
@@ -9,23 +9,23 @@
<operations public="true" package="false" protected="true" private="false"/>
</display>
</class>
- <class id="2" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.GameMenuHandler"
+ <class id="2" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.game.GameMenuHandler"
project="mupen64plus" file="/mupen64plus/src/paulscode/android/mupen64plusae/GameMenuHandler.java" binary="false">
<position height="-1" width="-1" x="257" y="415"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true" visibility="true">
<attributes public="false" package="false" protected="false" private="false"/>
<operations public="true" package="false" protected="true" private="false"/>
</display>
</class>
- <class id="3" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.GameOverlay"
+ <class id="3" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.game.GameOverlay"
project="mupen64plus" file="/mupen64plus/src/paulscode/android/mupen64plusae/GameOverlay.java" binary="false">
<position height="-1" width="-1" x="188" y="673"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true" visibility="true">
<attributes public="false" package="false" protected="false" private="false"/>
<operations public="true" package="false" protected="true" private="false"/>
</display>
</class>
- <class id="4" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.GameSurface"
+ <class id="4" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.game.GameSurface"
project="mupen64plus" file="/mupen64plus/src/paulscode/android/mupen64plusae/GameSurface.java" binary="false">
<position height="-1" width="-1" x="501" y="690"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true" visibility="true">
@@ -34,7 +34,7 @@
</display>
</class>
<interface id="5" corner="BOTTOM_RIGHT" language="java"
- name="paulscode.android.mupen64plusae.GameSurface.OnFpsChangedListener" project="mupen64plus"
+ name="paulscode.android.mupen64plusae.game.GameSurface.OnFpsChangedListener" project="mupen64plus"
file="/mupen64plus/src/paulscode/android/mupen64plusae/GameSurface.java" binary="false">
<position height="-1" width="-1" x="404" y="833"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true" visibility="true">
@@ -43,7 +43,7 @@
</display>
</interface>
<interface id="6" corner="BOTTOM_RIGHT" language="java"
- name="paulscode.android.mupen64plusae.GameSurface.CoreLifecycleListener" project="mupen64plus"
+ name="paulscode.android.mupen64plusae.game.GameSurface.CoreLifecycleListener" project="mupen64plus"
file="/mupen64plus/src/paulscode/android/mupen64plusae/GameSurface.java" binary="false">
<position height="-1" width="-1" x="600" y="842"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true" visibility="true">
@@ -60,7 +60,7 @@
<operations public="true" package="false" protected="true" private="false"/>
</display>
</class>
- <class id="8" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.GameActivityXperiaPlay"
+ <class id="8" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.game.GameActivityXperiaPlay"
project="mupen64plus" file="/mupen64plus/src/paulscode/android/mupen64plusae/GameActivityXperiaPlay.java"
binary="false">
<position height="-1" width="-1" x="358" y="156"/>
@@ -69,7 +69,7 @@
<operations public="true" package="false" protected="true" private="false"/>
</display>
</class>
- <class id="9" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.GameActivity"
+ <class id="9" corner="BOTTOM_RIGHT" language="java" name="paulscode.android.mupen64plusae.game.GameActivity"
project="mupen64plus" file="/mupen64plus/src/paulscode/android/mupen64plusae/GameActivity.java" binary="false">
<position height="-1" width="-1" x="379" y="190"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true" visibility="true">
@@ -107,6 +107,11 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
return JNI_VERSION_1_4;
}
+void JNI_OnUnload(JavaVM *vm, void *reserved)
+{
+ pthread_key_delete(mThreadKey);
+}
+
// Called before SDL_main() to initialize JNI bindings
void SDL_Android_Init(JNIEnv* mEnv, jclass cls)
{
@@ -48,6 +48,7 @@ static void *handleFront; // libmupen64plus-ui-console.so
// Function types
typedef jint (*pJNI_OnLoad) (JavaVM* vm, void* reserved);
+typedef void (*pJNI_OnUnload) (JavaVM *vm, void *reserved);
typedef int (*pAeiInit) (JNIEnv* env, jclass cls);
typedef int (*pSdlInit) (JNIEnv* env, jclass cls);
typedef void (*pSdlSetScreen) (int width, int height, Uint32 format);
@@ -175,6 +176,11 @@ extern "C" DECLSPEC void SDLCALL Java_paulscode_android_mupen64plusae_jni_Native
// Clear stale error messages
dlerror();
+ // Find and call the JNI_OnUnLoad functions from the SDL2 library
+ pJNI_OnUnload JNI_OnUnLoad = (pJNI_OnUnload) locateFunction(handleSDL, "SDL2", "JNI_OnUnload");
+ JNI_OnUnLoad(mVm, mReserved);
+ JNI_OnUnLoad = NULL;
+
// Nullify function pointers so that they can no longer be used
aeiInit = NULL;
sdlInit = NULL;
@@ -1,4 +1 @@
-*.cpp
-*.h
-*.sh
-*.txt
+*
@@ -4,14 +4,14 @@
android:layout_height="match_parent"
android:orientation="vertical" >
- <paulscode.android.mupen64plusae.GameSurface
+ <paulscode.android.mupen64plusae.game.GameSurface
android:id="@+id/gameSurface"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="false"
android:focusableInTouchMode="false" />
- <paulscode.android.mupen64plusae.GameOverlay
+ <paulscode.android.mupen64plusae.game.GameOverlay
android:id="@+id/gameOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -14,7 +14,7 @@
android:focusableInTouchMode="false"
tools:ignore="ContentDescription" />
- <paulscode.android.mupen64plusae.GameOverlay
+ <paulscode.android.mupen64plusae.game.GameOverlay
android:id="@+id/gameOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mupen64="http://schemas.android.com/apk/res/org.mupen64plusae.v3.alpha"
- android:key="screenPlayMenuActivity" >
+ android:key="screenRoot" >
<paulscode.android.mupen64plusae.preference.ProfilePreference
android:icon="@drawable/ic_circuit"
@@ -0,0 +1,190 @@
+/**
+ * Mupen64PlusAE, an N64 emulator for the Android platform
+ *
+ * Copyright (C) 2012 Paul Lamb
+ *
+ * This file is part of Mupen64PlusAE.
+ *
+ * Mupen64PlusAE is free software: you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation, either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Mupen64PlusAE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU General Public License for more details. You should have received a copy of the GNU
+ * General Public License along with Mupen64PlusAE. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: littleguy77
+ */
+
+package paulscode.android.mupen64plusae;
+
+import paulscode.android.mupen64plusae.game.GameActivity;
+import paulscode.android.mupen64plusae.game.GameActivityXperiaPlay;
+import paulscode.android.mupen64plusae.input.DiagnosticActivity;
+import paulscode.android.mupen64plusae.persistent.GamePrefsActivity;
+import paulscode.android.mupen64plusae.persistent.GlobalPrefsActivity;
+import paulscode.android.mupen64plusae.profile.ControllerProfileActivity;
+import paulscode.android.mupen64plusae.profile.EmulationProfileActivity;
+import paulscode.android.mupen64plusae.profile.ManageControllerProfilesActivity;
+import paulscode.android.mupen64plusae.profile.ManageEmulationProfilesActivity;
+import paulscode.android.mupen64plusae.profile.ManageTouchscreenProfilesActivity;
+import paulscode.android.mupen64plusae.profile.TouchscreenProfileActivity;
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.text.TextUtils;
+
+/**
+ * Utility class that encapsulates and standardizes interactions between activities.
+ */
+public class ActivityHelper
+{
+ /**
+ * Keys used to pass data to activities via the intent extras bundle. It's good practice to
+ * namespace the keys to avoid conflicts with other apps. By convention this is usually the
+ * package name but it's not a strict requirement. We'll use the fully qualified name of this
+ * class since it's easy to get.
+ */
+ public static class Keys
+ {
+ private static final String NAMESPACE = Keys.class.getCanonicalName() + ".";
+ //@formatter:off
+ public static final String ROM_PATH = NAMESPACE + "ROM_PATH";
+ public static final String ROM_MD5 = NAMESPACE + "ROM_MD5";
+ public static final String CHEAT_ARGS = NAMESPACE + "CHEAT_ARGS";
+ public static final String DO_RESTART = NAMESPACE + "DO_RESTART";
+ public static final String PROFILE_NAME = NAMESPACE + "PROFILE_NAME";
+ public static final String MENU_DISPLAY_MODE = NAMESPACE + "MENU_DISPLAY_MODE";
+ //@formatter:on
+ }
+
+ public static void launchUri( Context context, int resId )
+ {
+ launchUri( context, context.getString( resId ) );
+ }
+
+ public static void launchUri( Context context, String uriString )
+ {
+ launchUri( context, Uri.parse( uriString ) );
+ }
+
+ public static void launchUri( Context context, Uri uri )
+ {
+ context.startActivity( new Intent( Intent.ACTION_VIEW, uri ) );
+ }
+
+ @SuppressLint( "InlinedApi" )
+ public static void launchPlainText( Context context, String text, CharSequence chooserTitle )
+ {
+ // See http://android-developers.blogspot.com/2012/02/share-with-intents.html
+ Intent intent = new Intent( android.content.Intent.ACTION_SEND );
+ intent.setType( "text/plain" );
+ intent.addFlags( Intent.FLAG_ACTIVITY_NEW_DOCUMENT );
+ intent.putExtra( Intent.EXTRA_TEXT, text );
+ // intent.putExtra( Intent.EXTRA_SUBJECT, subject );
+ // intent.putExtra( Intent.EXTRA_EMAIL, new String[] { emailTo } );
+ context.startActivity( Intent.createChooser( intent, chooserTitle ) );
+ }
+
+ public static void restartActivity( Activity activity )
+ {
+ activity.finish();
+ activity.startActivity( activity.getIntent() );
+ }
+
+ public static void startSplashActivity( Context context )
+ {
+ context.startActivity( new Intent( context, SplashActivity.class ) );
+ }
+
+ public static void startGalleryActivity( Context context, Uri romPath )
+ {
+ startGalleryActivity( context, romPath == null ? null : romPath.getPath() );
+ }
+
+ public static void startGalleryActivity( Context context, String romPath )
+ {
+ Intent intent = new Intent( context, GalleryActivity.class );
+ if( !TextUtils.isEmpty( romPath ) )
+ intent.putExtra( ActivityHelper.Keys.ROM_PATH, romPath );
+ context.startActivity( intent );
+ }
+
+ public static void startGameActivity( Context context, String romPath, String romMd5,
+ String cheatArgs, boolean doRestart, boolean isXperiaPlay )
+ {
+ Intent intent = isXperiaPlay
+ ? new Intent( context, GameActivityXperiaPlay.class )
+ : new Intent( context, GameActivity.class );
+ intent.putExtra( ActivityHelper.Keys.ROM_PATH, romPath );
+ intent.putExtra( ActivityHelper.Keys.ROM_MD5, romMd5 );
+ intent.putExtra( ActivityHelper.Keys.CHEAT_ARGS, cheatArgs );
+ intent.putExtra( ActivityHelper.Keys.DO_RESTART, doRestart );
+ context.startActivity( intent );
+ }
+
+ public static void startGlobalPrefsActivity( Context context )
+ {
+ startGlobalPrefsActivity( context, 0 );
+ }
+
+ public static void startGlobalPrefsActivity( Context context, int menuDisplayMode )
+ {
+ Intent intent = new Intent( context, GlobalPrefsActivity.class );
+ intent.putExtra( ActivityHelper.Keys.MENU_DISPLAY_MODE, menuDisplayMode );
+ context.startActivity( intent );
+ }
+
+ public static void startGamePrefsActivity( Context context, String romPath, String romMd5 )
+ {
+ Intent intent = new Intent( context, GamePrefsActivity.class );
+ intent.putExtra( ActivityHelper.Keys.ROM_PATH, romPath );
+ intent.putExtra( ActivityHelper.Keys.ROM_MD5, romMd5 );
+ context.startActivity( intent );
+ }
+
+ public static void startManageEmulationProfilesActivity( Context context )
+ {
+ context.startActivity( new Intent( context, ManageEmulationProfilesActivity.class ) );
+ }
+
+ public static void startManageTouchscreenProfilesActivity( Context context )
+ {
+ context.startActivity( new Intent( context, ManageTouchscreenProfilesActivity.class ) );
+ }
+
+ public static void startManageControllerProfilesActivity( Context context )
+ {
+ context.startActivity( new Intent( context, ManageControllerProfilesActivity.class ) );
+ }
+
+ public static void startEmulationProfileActivity( Context context, String profileName )
+ {
+ Intent intent = new Intent( context, EmulationProfileActivity.class );
+ intent.putExtra( ActivityHelper.Keys.PROFILE_NAME, profileName );
+ context.startActivity( intent );
+ }
+
+ public static void startTouchscreenProfileActivity( Context context, String profileName )
+ {
+ Intent intent = new Intent( context, TouchscreenProfileActivity.class );
+ intent.putExtra( ActivityHelper.Keys.PROFILE_NAME, profileName );
+ context.startActivity( intent );
+ }
+
+ public static void startControllerProfileActivity( Context context, String profileName )
+ {
+ Intent intent = new Intent( context, ControllerProfileActivity.class );
+ intent.putExtra( ActivityHelper.Keys.PROFILE_NAME, profileName );
+ context.startActivity( intent );
+ }
+
+ public static void startDiagnosticActivity( Context context )
+ {
+ context.startActivity( new Intent( context, DiagnosticActivity.class ) );
+ }
+}
Oops, something went wrong.

0 comments on commit 0ad20b3

Please sign in to comment.