Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'master' into gliden64-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
littleguy77 committed May 6, 2015
2 parents 6caccc0 + cd7a8e0 commit 0ad20b3
Show file tree
Hide file tree
Showing 43 changed files with 612 additions and 567 deletions.
11 changes: 6 additions & 5 deletions AndroidManifest.xml
Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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" >
Expand Down
16 changes: 8 additions & 8 deletions doc/GameActivity.ucls
@@ -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"/>
Expand All @@ -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">
Expand All @@ -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">
Expand All @@ -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">
Expand All @@ -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"/>
Expand All @@ -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">
Expand Down
5 changes: 5 additions & 0 deletions jni/SDL2/src/core/android/SDL_android.c
Expand Up @@ -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)
{
Expand Down
6 changes: 6 additions & 0 deletions jni/ae-bridge/ae_exports.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions jni/mupen64plus-video-gliden64/.gitignore
@@ -1,4 +1 @@
*.cpp
*.h
*.sh
*.txt
*
4 changes: 2 additions & 2 deletions res/layout/game_activity.xml
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion res/layout/touchscreen_profile_activity.xml
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion res/xml/preferences_game.xml
@@ -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"
Expand Down
190 changes: 190 additions & 0 deletions src/paulscode/android/mupen64plusae/ActivityHelper.java
@@ -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 ) );
}
}

0 comments on commit 0ad20b3

Please sign in to comment.