Minor fixes

This commit is contained in:
Henrik Rydgard 2015-12-17 19:38:23 +01:00
parent 38263c9073
commit ebf9bd74c6
3 changed files with 16 additions and 13 deletions

View File

@ -38,13 +38,16 @@ void cInterfaceEGL::DetectMode()
// attributes for a visual in RGBA format with at least
// 8 bits per color
int attribs[] = {
EGL_RENDERABLE_TYPE, renderable_type,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, 8,
EGL_RENDERABLE_TYPE, renderable_type,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_TRANSPARENT_TYPE, EGL_NONE,
EGL_SAMPLES, 0,
EGL_NONE
};

View File

@ -569,20 +569,20 @@ extern "C" jint JNICALL Java_org_ppsspp_ppsspp_NativeApp_getDesiredBackbufferHei
return desiredBackbufferSizeY;
}
extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(JNIEnv *env, jobject obj, jobject _surf) {
extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(JNIEnv *env, jobject obj, jobject _surf) {
ANativeWindow *wnd = ANativeWindow_fromSurface(env, _surf);
WLOG("runEGLRenderLoop. display_xres=%d display_yres=%d", display_xres, display_yres);
if (wnd == nullptr) {
ELOG("Error: Surface is null.");
return;
return false;
}
cInterfaceBase *gl = HostGL_CreateGLInterface();
if (!gl) {
ELOG("ERROR: Failed to create GL interface");
return;
return false;
}
ILOG("EGL interface created. Desired backbuffer size: %dx%d", desiredBackbufferSizeX, desiredBackbufferSizeY);
@ -600,7 +600,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J
if (!gl->Create(wnd, false, use565)) {
ELOG("EGL creation failed");
// TODO: What do we do now?
return;
return false;
}
gl->MakeCurrent();
@ -671,4 +671,5 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J
ANativeWindow_release(wnd);
renderLoopRunning = false;
WLOG("Render loop exited;");
return true;
}

View File

@ -299,12 +299,15 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback {
Log.i(TAG, "Starting the render loop: " + mSurface);
// Start emulation using the provided Surface.
runEGLRenderLoop(mSurface);
if (!runEGLRenderLoop(mSurface)) {
// TODO: Add an alert dialog or something
Log.e(TAG, "Failed to start up OpenGL");
}
Log.i(TAG, "Left the render loop: " + mSurface);
}
};
public native void runEGLRenderLoop(Surface surface);
public native boolean runEGLRenderLoop(Surface surface);
// Tells the render loop thread to exit, so we can restart it.
public native void exitEGLRenderLoop();
@ -335,9 +338,7 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback {
}
// OK, config should be initialized, we can query for screen rotation.
if (Build.VERSION.SDK_INT >= 9) {
updateScreenRotation();
}
updateScreenRotation();
// Keep the screen bright - very annoying if it goes dark when tilting away
Window window = this.getWindow();
@ -457,9 +458,7 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback {
updateSystemUiVisibility();
}
// OK, config should be initialized, we can query for screen rotation.
if (Build.VERSION.SDK_INT >= 9) {
updateScreenRotation();
}
updateScreenRotation();
Log.i(TAG, "onResume");
if (mSurfaceView != null) {