Quantcast
Channel: ARM Mali Graphics
Viewing all articles
Browse latest Browse all 266

Building an Unreal Engine Application with Mali Graphics Debugger Support

$
0
0

In a previous blog we talked about running Mali Graphics Debugger on a non-rooted device. In this blog we will focus on how you can add support for Mali Graphics Debugger, on a non-rooted device, to your Unreal Engine application. The plan we are going to follow is very simple:

  1. Add the interceptor library to the build system
  2. Edit the activity to load the interceptor library
  3. Install the MGD Daemon application on the target device

 

For our first step, we will need to download a version of Unreal Engine from the sources available on Github. For more information on this step, please see Epic’s guide.

 

Once you have a working copy of the engine, we can focus on getting MGD working. You will first need to locate the android-non-root folder in your MGD installation directory, and your Unreal Engine installation folder (where you cloned the repository). Copy the android-non-root folder to Engine\Build\Android\Java\.

 

Next, we will need to change the Android makefile to ensure that the interceptor is properly packaged inside the engine build. For this, edit the Android.mk file under “Engine/Build/Android/Java/jni/”  add this line at the end, include $(LOCAL_PATH)/../android-non-root/MGD.mk. It should look like this:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := UE4
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libUE4.so
include $(PREBUILT_SHARED_LIBRARY)


include $(LOCAL_PATH)/../android-non-root/MGD.mk

 

We will now specify to the main game activity that it needs to load the MGD library, locate GameActivity.java inside Engine\Build\Android\Java\src\com\epicgames\ue4\ and edit the onCreate function to look like so:

@Override
public void onCreate(Bundle savedInstanceState)
{     super.onCreate(savedInstanceState);     try {          System.loadLibrary("MGD");     }     catch( UnsatisfiedLinkError e ){          Log.debug( "libMGD not loaded" );     }     // create splashscreen dialog (if launched by SplashActivity)     Bundle intentBundle = getIntent().getExtras();         // Unreal Engine code continues there

 

Engine wise we are all set, we will now prepare our device. Install the MGD daemon on the target phone using the following command whilst being in the android-non-root folder:

adb install -r MGDDaemon.apk

 

Now before running your app you will need to run this command from the host PC (please ensure that the device is visible by running adb devices first):

adb forward tcp:5002 tcp:5002

 

Run the MGD daemon application on the target phone and activate the daemon itself:

mgddaemon.PNG

 

At that point you can connect it to MGD on the host PC, start your application and begin debugging it. Please refer to the MGD manual for more in-depth information on how to use it.

Following these steps you should be able to use MGD with Unreal applications on any Mali based platform. If you have any issues please raise them on the community and someone will be more than happy to assist you through the process.


Viewing all articles
Browse latest Browse all 266

Trending Articles