From 6927c44fba6e4fa9d892563b8131a515ea50c71d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 22 Dec 2022 11:38:36 +0100 Subject: [PATCH] Remove unused functions, log and comment fixes --- android/jni/app-android.cpp | 24 +++++-------------- .../org/ppsspp/ppsspp/InputDeviceState.java | 2 -- android/src/org/ppsspp/ppsspp/NativeApp.java | 2 -- .../src/org/ppsspp/ppsspp/NativeGLView.java | 2 +- .../src/org/ppsspp/ppsspp/NativeRenderer.java | 3 ++- .../src/org/ppsspp/ppsspp/PpssppActivity.java | 2 -- 6 files changed, 9 insertions(+), 26 deletions(-) diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index c0ddad6ff9..93ddb99cde 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -846,7 +846,6 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) { INFO_LOG(SYSTEM, "NativeApp.shutdown() -- begin"); if (renderer_inited) { INFO_LOG(G3D, "Shutting down renderer"); - // This will be from the wrong thread? :/ graphicsContext->Shutdown(); delete graphicsContext; graphicsContext = nullptr; @@ -947,10 +946,8 @@ static void recalculateDpi() { pixel_in_dps_x = (float)pixel_xres / dp_xres; pixel_in_dps_y = (float)pixel_yres / dp_yres; - INFO_LOG(G3D, "RecalcDPI: display_xres=%d display_yres=%d", display_xres, display_yres); - INFO_LOG(G3D, "RecalcDPI: g_dpi=%f g_dpi_scale_x=%f g_dpi_scale_y=%f", g_dpi, g_dpi_scale_x, g_dpi_scale_y); - INFO_LOG(G3D, "RecalcDPI: dp_xres=%d dp_yres=%d", dp_xres, dp_yres); - INFO_LOG(G3D, "RecalcDPI: pixel_xres=%d pixel_yres=%d", pixel_xres, pixel_yres); + INFO_LOG(G3D, "RecalcDPI: display_xres=%d display_yres=%d pixel_xres=%d pixel_yres=%d", display_xres, display_yres, pixel_xres, pixel_yres); + INFO_LOG(G3D, "RecalcDPI: g_dpi=%f g_dpi_scale_x=%f g_dpi_scale_y=%f dp_xres=%d dp_yres=%d", g_dpi, g_dpi_scale_x, g_dpi_scale_y, dp_xres, dp_yres); } extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv *, jclass, jint bufw, jint bufh, jint format) { @@ -1109,11 +1106,6 @@ extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_keyUp(JNIEnv *, jclass, jin return NativeKey(keyInput); } -extern "C" void Java_org_ppsspp_ppsspp_NativeApp_beginJoystickEvent( - JNIEnv *env, jclass) { - // mutex lock? -} - extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_joystickAxis( JNIEnv *env, jclass, jint deviceId, jint axisId, jfloat value) { if (!renderer_inited) @@ -1127,14 +1119,11 @@ extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_joystickAxis( return NativeAxis(axis); } -extern "C" void Java_org_ppsspp_ppsspp_NativeApp_endJoystickEvent( - JNIEnv *env, jclass) { - // mutex unlock? -} - - extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_mouseWheelEvent( JNIEnv *env, jclass, jint stick, jfloat x, jfloat y) { + if (!renderer_inited) + return false; + // TODO: Support mousewheel for android return true; } @@ -1376,6 +1365,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J display_xres, display_yres, desiredBackbufferSizeX, desiredBackbufferSizeY); if (!wnd) { + // This shouldn't ever happen. ERROR_LOG(G3D, "Error: Surface is null."); renderLoopRunning = false; return false; @@ -1401,9 +1391,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J } graphicsContext->ThreadStart(); renderer_inited = true; - } - if (!exitRenderLoop) { static bool hasSetThreadName = false; if (!hasSetThreadName) { hasSetThreadName = true; diff --git a/android/src/org/ppsspp/ppsspp/InputDeviceState.java b/android/src/org/ppsspp/ppsspp/InputDeviceState.java index 9c7317fa6c..b221032cd6 100644 --- a/android/src/org/ppsspp/ppsspp/InputDeviceState.java +++ b/android/src/org/ppsspp/ppsspp/InputDeviceState.java @@ -147,13 +147,11 @@ public class InputDeviceState { if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0) { return false; } - NativeApp.beginJoystickEvent(); for (int i = 0; i < mAxes.length; i++) { int axisId = mAxes[i]; float value = event.getAxisValue(axisId); NativeApp.joystickAxis(deviceId, axisId, value); } - NativeApp.endJoystickEvent(); return true; } } diff --git a/android/src/org/ppsspp/ppsspp/NativeApp.java b/android/src/org/ppsspp/ppsspp/NativeApp.java index 8b3f709130..2fb7fa45a4 100644 --- a/android/src/org/ppsspp/ppsspp/NativeApp.java +++ b/android/src/org/ppsspp/ppsspp/NativeApp.java @@ -41,9 +41,7 @@ public class NativeApp { public static native boolean keyDown(int deviceId, int key, boolean isRepeat); public static native boolean keyUp(int deviceId, int key); - public static native void beginJoystickEvent(); public static native void joystickAxis(int deviceId, int axis, float value); - public static native void endJoystickEvent(); public static native boolean mouseWheelEvent(float x, float y); diff --git a/android/src/org/ppsspp/ppsspp/NativeGLView.java b/android/src/org/ppsspp/ppsspp/NativeGLView.java index b56380358d..d899fa5ce4 100644 --- a/android/src/org/ppsspp/ppsspp/NativeGLView.java +++ b/android/src/org/ppsspp/ppsspp/NativeGLView.java @@ -48,7 +48,7 @@ public class NativeGLView extends GLSurfaceView implements SensorEventListener, Log.i(TAG, "MOGA initialized"); mController.setListener(this, new Handler()); } catch (Exception e) { - Log.i(TAG, "Moga failed to initialize"); + // Log.d(TAG, "MOGA failed to initialize"); } } diff --git a/android/src/org/ppsspp/ppsspp/NativeRenderer.java b/android/src/org/ppsspp/ppsspp/NativeRenderer.java index 58d4de48d8..87904645dd 100644 --- a/android/src/org/ppsspp/ppsspp/NativeRenderer.java +++ b/android/src/org/ppsspp/ppsspp/NativeRenderer.java @@ -10,6 +10,7 @@ import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.opengles.GL10; +// Only used for the OpenGL backend. public class NativeRenderer implements GLSurfaceView.Renderer { private static String TAG = "NativeRenderer"; private NativeActivity mActivity; @@ -35,7 +36,7 @@ public class NativeRenderer implements GLSurfaceView.Renderer { public void onSurfaceCreated(GL10 gl, EGLConfig config) { failed = false; - Log.i(TAG, "NativeRenderer: onSurfaceCreated"); + Log.i(TAG, "NativeRenderer (OpenGL): onSurfaceCreated"); EGL10 egl = (EGL10)EGLContext.getEGL(); if (egl != null) { diff --git a/android/src/org/ppsspp/ppsspp/PpssppActivity.java b/android/src/org/ppsspp/ppsspp/PpssppActivity.java index aa383a1568..a025926d67 100644 --- a/android/src/org/ppsspp/ppsspp/PpssppActivity.java +++ b/android/src/org/ppsspp/ppsspp/PpssppActivity.java @@ -107,7 +107,6 @@ public class PpssppActivity extends NativeActivity { } else { String param = getIntent().getStringExtra(SHORTCUT_EXTRA_KEY); String args = getIntent().getStringExtra(ARGS_EXTRA_KEY); - Log.e(TAG, "Got ACTION_VIEW without a valid uri, trying param"); if (param != null) { Log.i(TAG, "Found Shortcut Parameter in extra-data: " + param); super.setShortcutParam("\"" + param.replace("\\", "\\\\").replace("\"", "\\\"") + "\""); @@ -115,7 +114,6 @@ public class PpssppActivity extends NativeActivity { Log.i(TAG, "Found args parameter in extra-data: " + args); super.setShortcutParam(args); } else { - Log.e(TAG, "Shortcut missing parameter!"); super.setShortcutParam(""); } }