From 5675e8a816bb316d70884ebe81e02cded232b77c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 16 Nov 2017 14:59:37 +0100 Subject: [PATCH] Minor cleanup, and more terrifying orientation hackery --- UI/NativeApp.cpp | 9 ++------- android/src/org/ppsspp/ppsspp/NativeActivity.java | 9 ++++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index f9e8a5fb03ff..a5d9e0605ab1 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -302,12 +302,6 @@ bool CheckFontIsUsable(const wchar_t *fontFace) { #endif void NativeInit(int argc, const char *argv[], const char *savegame_dir, const char *external_dir, const char *cache_dir, bool fs) { -#ifdef ANDROID_NDK_PROFILER - setenv("CPUPROFILE_FREQUENCY", "500", 1); - setenv("CPUPROFILE", "/sdcard/gmon.out", 1); - monstartup("ppsspp_jni.so"); -#endif - net::Init(); // This needs to happen before we load the config. So on Windows we also run it in Main. It's fine to call multiple times. InitFastMath(cpu_info.bNEON); @@ -442,6 +436,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch } } else { if (boot_filename.empty()) { + ILOG("Boot filename found in args: %s", argv[i]); boot_filename = argv[i]; #ifdef _WIN32 boot_filename = ReplaceAll(boot_filename, "\\", "/"); @@ -460,7 +455,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch } } - if (fileToLog != NULL) + if (fileToLog) LogManager::GetInstance()->ChangeFileLog(fileToLog); #ifndef _WIN32 diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index 1f0848036d10..58e748410f82 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -520,7 +520,7 @@ public void onCreate(Bundle savedInstanceState) { } private Point desiredSize = new Point(); - + private int badOrientationCount = 0; @Override public void surfaceCreated(SurfaceHolder holder) { pixelWidth = holder.getSurfaceFrame().width(); @@ -530,10 +530,13 @@ public void surfaceCreated(SurfaceHolder holder) { int requestedOr = getRequestedOrientation(); boolean requestedPortrait = requestedOr == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT || requestedOr == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; boolean detectedPortrait = pixelHeight > pixelWidth; - if (requestedPortrait != detectedPortrait) { - Log.e(TAG, "Bad orientation detected! Recreating activity."); + if (badOrientationCount < 3 && requestedPortrait != detectedPortrait) { + Log.e(TAG, "Bad orientation detected (w=" + pixelWidth + " h=" + pixelHeight + "! Recreating activity."); + badOrientationCount++; recreate();; return; + } else if (requestedPortrait == detectedPortrait) { + badOrientationCount = 0; } Log.d(TAG, "Surface created. pixelWidth=" + pixelWidth + ", pixelHeight=" + pixelHeight + " holder: " + holder.toString() + " or: " + requestedOr);