mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Big commit. Fix running the APK, I had missed a view in the manifest. Clean up the Android EGL context creation to fit more in line with how Dolphin works. This breaks input at the moment as well. Change the memarena from 768MB to 64MB to allow 1GB phones to potentially run it. Rename EGL_X11 back to EGL since this merge brings in some of soreau's changes to more easily allow different platforms like Wayland and Android. Not quite all of the code because some needs to be cleaned up still.
This commit is contained in:
@ -24,6 +24,12 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".NativeListView"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme"
|
||||
android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
@ -18,7 +18,6 @@ import android.view.WindowManager;
|
||||
public class DolphinEmulator<MainActivity> extends Activity {
|
||||
|
||||
static private NativeGLSurfaceView GLview = null;
|
||||
static private NativeRenderer Renderer = null;
|
||||
static private boolean Running = false;
|
||||
|
||||
private float screenWidth;
|
||||
@ -42,21 +41,21 @@ public class DolphinEmulator<MainActivity> extends Activity {
|
||||
{
|
||||
super.onStop();
|
||||
if (Running)
|
||||
Renderer.StopEmulation();
|
||||
NativeGLSurfaceView.StopEmulation();
|
||||
}
|
||||
@Override
|
||||
public void onPause()
|
||||
{
|
||||
super.onPause();
|
||||
if (Running)
|
||||
Renderer.PauseEmulation();
|
||||
NativeGLSurfaceView.PauseEmulation();
|
||||
}
|
||||
@Override
|
||||
public void onResume()
|
||||
{
|
||||
super.onResume();
|
||||
if (Running)
|
||||
Renderer.UnPauseEmulation();
|
||||
NativeGLSurfaceView.UnPauseEmulation();
|
||||
}
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@ -84,15 +83,10 @@ public class DolphinEmulator<MainActivity> extends Activity {
|
||||
screenWidth = displayMetrics.widthPixels;
|
||||
screenHeight = displayMetrics.heightPixels;
|
||||
|
||||
|
||||
String FileName = data.getStringExtra("Select");
|
||||
Renderer = new NativeRenderer();
|
||||
Renderer.setContext(getApplicationContext());
|
||||
|
||||
GLview = new NativeGLSurfaceView(this);
|
||||
GLview.setEGLContextClientVersion(2);
|
||||
GLview.setRenderer(Renderer);
|
||||
|
||||
GLview.SetDimensions(screenWidth, screenHeight);
|
||||
GLview.SetFileName(FileName);
|
||||
setContentView(GLview);
|
||||
Running = true;
|
||||
@ -108,10 +102,10 @@ public class DolphinEmulator<MainActivity> extends Activity {
|
||||
Y = event.getY();
|
||||
Action = event.getActionMasked();
|
||||
|
||||
int Button = Renderer.ButtonPressed(Action, ((X / screenWidth) * 2.0f) - 1.0f, ((Y / screenHeight) * 2.0f) - 1.0f);
|
||||
//int Button = Renderer.ButtonPressed(Action, ((X / screenWidth) * 2.0f) - 1.0f, ((Y / screenHeight) * 2.0f) - 1.0f);
|
||||
|
||||
if (Button != -1)
|
||||
SetKey(Action, Button);
|
||||
//if (Button != -1)
|
||||
//SetKey(Action, Button);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -5,14 +5,21 @@ import android.opengl.GLSurfaceView;
|
||||
import android.util.Log;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
|
||||
public class NativeGLSurfaceView extends GLSurfaceView {
|
||||
public class NativeGLSurfaceView extends SurfaceView {
|
||||
static private String FileName;
|
||||
static private Thread myRun;
|
||||
static private boolean Running = false;
|
||||
static private boolean Created = false;
|
||||
static private float width;
|
||||
static private float height;
|
||||
|
||||
public static native void main(String File, Surface surf);
|
||||
public static native void main(String File, Surface surf, int width, int height);
|
||||
|
||||
public static native void UnPauseEmulation();
|
||||
public static native void PauseEmulation();
|
||||
public static native void StopEmulation();
|
||||
|
||||
static
|
||||
{
|
||||
@ -35,27 +42,41 @@ public class NativeGLSurfaceView extends GLSurfaceView {
|
||||
{
|
||||
@Override
|
||||
public void run() {
|
||||
main(FileName, getHolder().getSurface());
|
||||
main(FileName, getHolder().getSurface(), (int)width, (int)height);
|
||||
}
|
||||
};
|
||||
getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||
|
||||
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
// TODO Auto-generated method stub
|
||||
myRun.start();
|
||||
}
|
||||
|
||||
public void surfaceChanged(SurfaceHolder arg0, int arg1,
|
||||
int arg2, int arg3) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void surfaceDestroyed(SurfaceHolder arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
Created = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void surfaceCreated(SurfaceHolder holder)
|
||||
{
|
||||
super.surfaceCreated(holder);
|
||||
if (!Running)
|
||||
{
|
||||
myRun.start();
|
||||
Running = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFileName(String file)
|
||||
{
|
||||
FileName = file;
|
||||
}
|
||||
public void SetDimensions(float screenWidth, float screenHeight)
|
||||
{
|
||||
width = screenWidth;
|
||||
height = screenHeight;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -33,9 +33,6 @@ public class NativeRenderer implements GLSurfaceView.Renderer {
|
||||
public static native void DrawButton(int GLTex, int ID);
|
||||
public static native void SetButtonCoords(float[] Coords);
|
||||
public static native void PrepareME();
|
||||
public static native void UnPauseEmulation();
|
||||
public static native void PauseEmulation();
|
||||
public static native void StopEmulation();
|
||||
|
||||
// Texture loading
|
||||
private static int buttonA = -1;
|
||||
|
Reference in New Issue
Block a user