[Android] Some minor cleanup.
This commit is contained in:
parent
9b20280bcf
commit
5d38a9c91e
Source
Android/src/org/dolphinemu/dolphinemu
Core/DolphinWX
|
@ -159,11 +159,8 @@ public class DolphinEmulator<MainActivity> extends Activity
|
||||||
GLview = new NativeGLSurfaceView(this);
|
GLview = new NativeGLSurfaceView(this);
|
||||||
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
String backend = NativeLibrary.GetConfig("Dolphin.ini", "Core", "GFXBackend", "Software Renderer");
|
String backend = NativeLibrary.GetConfig("Dolphin.ini", "Core", "GFXBackend", "Software Renderer");
|
||||||
if (backend.equals("OGL"))
|
NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight);
|
||||||
GLview.SetDimensions(screenHeight, screenWidth);
|
NativeLibrary.SetFilename(FileName);
|
||||||
else
|
|
||||||
GLview.SetDimensions(screenWidth, screenHeight);
|
|
||||||
GLview.SetFileName(FileName);
|
|
||||||
setContentView(GLview);
|
setContentView(GLview);
|
||||||
Running = true;
|
Running = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,9 @@ import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
|
|
||||||
public class NativeGLSurfaceView extends SurfaceView {
|
public class NativeGLSurfaceView extends SurfaceView {
|
||||||
static private String FileName;
|
|
||||||
static private Thread myRun;
|
static private Thread myRun;
|
||||||
static private boolean Running = false;
|
static private boolean Running = false;
|
||||||
static private boolean Created = false;
|
static private boolean Created = false;
|
||||||
static private float width;
|
|
||||||
static private float height;
|
|
||||||
|
|
||||||
public NativeGLSurfaceView(Context context) {
|
public NativeGLSurfaceView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
@ -20,7 +17,7 @@ public class NativeGLSurfaceView extends SurfaceView {
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
NativeLibrary.Run(FileName, getHolder().getSurface(), (int)width, (int)height);
|
NativeLibrary.Run(getHolder().getSurface());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getHolder().addCallback(new SurfaceHolder.Callback() {
|
getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||||
|
@ -47,15 +44,4 @@ public class NativeGLSurfaceView extends SurfaceView {
|
||||||
Created = true;
|
Created = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFileName(String file)
|
|
||||||
{
|
|
||||||
FileName = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetDimensions(float screenWidth, float screenHeight)
|
|
||||||
{
|
|
||||||
width = screenWidth;
|
|
||||||
height = screenHeight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,13 @@ public class NativeLibrary {
|
||||||
public static native void onGamePadMoveEvent(String Device, int Axis, float Value);
|
public static native void onGamePadMoveEvent(String Device, int Axis, float Value);
|
||||||
public static native String GetConfig(String configFile, String Key, String Value, String Default);
|
public static native String GetConfig(String configFile, String Key, String Value, String Default);
|
||||||
public static native void SetConfig(String configFile, String Key, String Value, String Default);
|
public static native void SetConfig(String configFile, String Key, String Value, String Default);
|
||||||
|
public static native void SetFilename(String filename);
|
||||||
|
public static native void SetDimensions(int width, int height);
|
||||||
public static native int[] GetBanner(String filename);
|
public static native int[] GetBanner(String filename);
|
||||||
public static native String GetTitle(String filename);
|
public static native String GetTitle(String filename);
|
||||||
public static native String GetVersionString();
|
public static native String GetVersionString();
|
||||||
|
|
||||||
public static native void Run(String File, Surface surf, int width, int height);
|
public static native void Run(Surface surf);
|
||||||
public static native void UnPauseEmulation();
|
public static native void UnPauseEmulation();
|
||||||
public static native void PauseEmulation();
|
public static native void PauseEmulation();
|
||||||
public static native void StopEmulation();
|
public static native void StopEmulation();
|
||||||
|
@ -27,7 +29,7 @@ public class NativeLibrary {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
System.loadLibrary("dolphin-emu-nogui");
|
System.loadLibrary("main");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -170,6 +170,7 @@ if(USE_UPNP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
|
set(DOLPHIN_EXE main)
|
||||||
add_library(${DOLPHIN_EXE} SHARED ${SRCS})
|
add_library(${DOLPHIN_EXE} SHARED ${SRCS})
|
||||||
target_link_libraries(${DOLPHIN_EXE}
|
target_link_libraries(${DOLPHIN_EXE}
|
||||||
log
|
log
|
||||||
|
@ -181,9 +182,12 @@ if(ANDROID)
|
||||||
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "mips")
|
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "mips")
|
||||||
set (SO_TARGET "mips")
|
set (SO_TARGET "mips")
|
||||||
endif()
|
endif()
|
||||||
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
|
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7-a")
|
||||||
set (SO_TARGET "armeabi-v7a")
|
set (SO_TARGET "armeabi-v7a")
|
||||||
endif()
|
endif()
|
||||||
|
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv5te")
|
||||||
|
set (SO_TARGET "armeabi")
|
||||||
|
endif()
|
||||||
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "i686")
|
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "i686")
|
||||||
set (SO_TARGET "x86")
|
set (SO_TARGET "x86")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
#include <android/native_window_jni.h>
|
#include <android/native_window_jni.h>
|
||||||
ANativeWindow* surf;
|
ANativeWindow* surf;
|
||||||
int g_width, g_height;
|
int g_width, g_height;
|
||||||
|
std::string g_filename;
|
||||||
|
static std::thread g_run_thread;
|
||||||
|
|
||||||
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "Dolphinemu", __VA_ARGS__))
|
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "Dolphinemu", __VA_ARGS__))
|
||||||
|
|
||||||
void Host_NotifyMapLoaded() {}
|
void Host_NotifyMapLoaded() {}
|
||||||
|
@ -66,7 +69,10 @@ void* Host_GetRenderHandle()
|
||||||
|
|
||||||
void* Host_GetInstance() { return NULL; }
|
void* Host_GetInstance() { return NULL; }
|
||||||
|
|
||||||
void Host_UpdateTitle(const char* title){};
|
void Host_UpdateTitle(const char* title)
|
||||||
|
{
|
||||||
|
LOGI(title);
|
||||||
|
};
|
||||||
|
|
||||||
void Host_UpdateLogDisplay(){}
|
void Host_UpdateLogDisplay(){}
|
||||||
|
|
||||||
|
@ -297,12 +303,23 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig(JN
|
||||||
env->ReleaseStringUTFChars(jDefault, Default);
|
env->ReleaseStringUTFChars(jDefault, Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj, jstring jFile, jobject _surf, jint _width, jint _height)
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename(JNIEnv *env, jobject obj, jstring jFile)
|
||||||
|
{
|
||||||
|
const char *File = env->GetStringUTFChars(jFile, NULL);
|
||||||
|
|
||||||
|
g_filename = std::string(File);
|
||||||
|
|
||||||
|
env->ReleaseStringUTFChars(jFile, File);
|
||||||
|
}
|
||||||
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetDimensions(JNIEnv *env, jobject obj, jint _width, jint _height)
|
||||||
{
|
{
|
||||||
surf = ANativeWindow_fromSurface(env, _surf);
|
|
||||||
g_width = (int)_width;
|
g_width = (int)_width;
|
||||||
g_height = (int)_height;
|
g_height = (int)_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj, jobject _surf)
|
||||||
|
{
|
||||||
|
surf = ANativeWindow_fromSurface(env, _surf);
|
||||||
// Install our callbacks
|
// Install our callbacks
|
||||||
OSD::AddCallback(OSD::OSD_INIT, OSDCallbacks, 0);
|
OSD::AddCallback(OSD::OSD_INIT, OSDCallbacks, 0);
|
||||||
OSD::AddCallback(OSD::OSD_SHUTDOWN, OSDCallbacks, 2);
|
OSD::AddCallback(OSD::OSD_SHUTDOWN, OSDCallbacks, 2);
|
||||||
|
@ -322,9 +339,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *
|
||||||
if (onscreencontrols)
|
if (onscreencontrols)
|
||||||
OSD::AddCallback(OSD::OSD_ONFRAME, OSDCallbacks, 1);
|
OSD::AddCallback(OSD::OSD_ONFRAME, OSDCallbacks, 1);
|
||||||
|
|
||||||
const char *File = env->GetStringUTFChars(jFile, NULL);
|
|
||||||
// No use running the loop when booting fails
|
// No use running the loop when booting fails
|
||||||
if ( BootManager::BootCore( File ) )
|
if ( BootManager::BootCore( g_filename.c_str() ) )
|
||||||
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
||||||
updateMainFrameEvent.Wait();
|
updateMainFrameEvent.Wait();
|
||||||
|
|
||||||
|
@ -333,7 +349,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *
|
||||||
SConfig::Shutdown();
|
SConfig::Shutdown();
|
||||||
LogManager::Shutdown();
|
LogManager::Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue