diff --git a/src/android/app/src/main/jni/CMakeLists.txt b/src/android/app/src/main/jni/CMakeLists.txt index 5d727c92c..28b2995d2 100644 --- a/src/android/app/src/main/jni/CMakeLists.txt +++ b/src/android/app/src/main/jni/CMakeLists.txt @@ -29,6 +29,8 @@ add_library(lime-android SHARED ndk_motion.h system_save_game.cpp native_log.cpp + util.cpp + util.h ) target_link_libraries(lime-android PRIVATE audio_core lime_common lime_core input_common network) diff --git a/src/android/app/src/main/jni/emu_window/emu_window.cpp b/src/android/app/src/main/jni/emu_window/emu_window.cpp index 677de440b..08b4f9d62 100644 --- a/src/android/app/src/main/jni/emu_window/emu_window.cpp +++ b/src/android/app/src/main/jni/emu_window/emu_window.cpp @@ -13,14 +13,10 @@ #include "jni/emu_window/emu_window.h" #include "jni/id_cache.h" #include "jni/input_manager.h" +#include "jni/util.h" #include "network/network.h" #include "video_core/renderer_base.h" -static bool IsPortraitMode() { - return JNI_FALSE != IDCache::GetEnvForThread()->CallStaticBooleanMethod( - IDCache::GetNativeLibraryClass(), IDCache::GetIsPortraitMode()); -} - bool EmuWindow_Android::OnSurfaceChanged(ANativeWindow* surface) { if (render_window == surface) { return false; diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 9b2b839d2..e09430cb2 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -54,6 +54,7 @@ #include "jni/id_cache.h" #include "jni/input_manager.h" #include "jni/ndk_motion.h" +#include "jni/util.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/gpu.h" #include "video_core/renderer_base.h" @@ -364,7 +365,7 @@ void Java_io_github_lime3ds_android_NativeLibrary_swapScreens([[maybe_unused]] J Settings::values.swap_screen = swap_screens; auto& system = Core::System::GetInstance(); if (system.IsPoweredOn()) { - system.GPU().Renderer().UpdateCurrentFramebufferLayout(!(rotation % 2)); + system.GPU().Renderer().UpdateCurrentFramebufferLayout(IsPortraitMode()); } InputManager::screen_rotation = rotation; Camera::NDK::g_rotation = rotation; diff --git a/src/android/app/src/main/jni/util.cpp b/src/android/app/src/main/jni/util.cpp new file mode 100644 index 000000000..83a71c5a6 --- /dev/null +++ b/src/android/app/src/main/jni/util.cpp @@ -0,0 +1,10 @@ +// Copyright Citra Emulator Project / Lime3DS Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "jni/id_cache.h" + +bool IsPortraitMode() { + return JNI_FALSE != IDCache::GetEnvForThread()->CallStaticBooleanMethod( + IDCache::GetNativeLibraryClass(), IDCache::GetIsPortraitMode()); +} diff --git a/src/android/app/src/main/jni/util.h b/src/android/app/src/main/jni/util.h new file mode 100644 index 000000000..ad86ddf82 --- /dev/null +++ b/src/android/app/src/main/jni/util.h @@ -0,0 +1,8 @@ +// Copyright Citra Emulator Project / Lime3DS Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +/// Calls and returns the value of NativeLibrary.isPortraitMode +bool IsPortraitMode();