forked from moonpower/azahar-UWP
Refactored layout code in preparation for Android custom layout GUI
This commit is contained in:
committed by
OpenSauce04
parent
c78e893cd7
commit
b293a253f5
@@ -158,8 +158,9 @@ object NativeLibrary {
|
||||
/**
|
||||
* Notifies the core emulation that the orientation has changed.
|
||||
*/
|
||||
external fun notifyOrientationChange(layoutOption: Int, rotation: Int)
|
||||
external fun notifyOrientationChange(layoutOption: Int, rotation: Int, isPortrait: Boolean)
|
||||
|
||||
external fun notifyPortraitLayoutChange(layoutOption: Int, rotation: Int, isPortrait: Boolean)
|
||||
/**
|
||||
* Swaps the top and bottom screens.
|
||||
*/
|
||||
@@ -266,6 +267,10 @@ object NativeLibrary {
|
||||
@JvmStatic
|
||||
fun landscapeScreenLayout(): Int = EmulationMenuSettings.landscapeScreenLayout
|
||||
|
||||
@Keep
|
||||
@JvmStatic
|
||||
fun portraitScreenLayout(): Int = EmulationMenuSettings.portraitScreenLayout
|
||||
|
||||
@Keep
|
||||
@JvmStatic
|
||||
fun displayAlertMsg(title: String, message: String, yesNo: Boolean): Boolean {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2023 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
package org.citra.citra_emu.display
|
||||
|
||||
enum class PortraitScreenLayout(val int: Int) {
|
||||
// These must match what is defined in src/common/settings.h
|
||||
TOP_FULL_WIDTH(0),
|
||||
CUSTOM_PORTRAIT_LAYOUT(1);
|
||||
|
||||
companion object {
|
||||
fun from(int: Int): PortraitScreenLayout {
|
||||
return entries.firstOrNull { it.int == int } ?: TOP_FULL_WIDTH;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,10 @@ import org.citra.citra_emu.features.settings.model.Settings
|
||||
import org.citra.citra_emu.features.settings.utils.SettingsFile
|
||||
import org.citra.citra_emu.utils.EmulationMenuSettings
|
||||
|
||||
class ScreenAdjustmentUtil(private val windowManager: WindowManager,
|
||||
private val settings: Settings) {
|
||||
class ScreenAdjustmentUtil(
|
||||
private val windowManager: WindowManager,
|
||||
private val settings: Settings
|
||||
) {
|
||||
fun swapScreen() {
|
||||
val isEnabled = !EmulationMenuSettings.swapScreens
|
||||
EmulationMenuSettings.swapScreens = isEnabled
|
||||
@@ -25,18 +27,39 @@ class ScreenAdjustmentUtil(private val windowManager: WindowManager,
|
||||
settings.saveSetting(BooleanSetting.SWAP_SCREEN, SettingsFile.FILE_NAME_CONFIG)
|
||||
}
|
||||
|
||||
// TODO: Consider how cycling should handle custom layout
|
||||
// right now it simply skips it
|
||||
fun cycleLayouts() {
|
||||
val nextLayout = (EmulationMenuSettings.landscapeScreenLayout + 1) % ScreenLayout.entries.size
|
||||
changeScreenOrientation(ScreenLayout.from(nextLayout))
|
||||
val nextLayout = if (NativeLibrary.isPortraitMode) {
|
||||
(EmulationMenuSettings.portraitScreenLayout + 1) % (PortraitScreenLayout.entries.size - 1)
|
||||
} else {
|
||||
(EmulationMenuSettings.landscapeScreenLayout + 1) % (ScreenLayout.entries.size - 1)
|
||||
}
|
||||
settings.loadSettings()
|
||||
|
||||
changeScreenOrientation(nextLayout)
|
||||
}
|
||||
|
||||
fun changeScreenOrientation(layoutOption: ScreenLayout) {
|
||||
EmulationMenuSettings.landscapeScreenLayout = layoutOption.int
|
||||
fun changePortraitOrientation(layoutOption: Int) {
|
||||
EmulationMenuSettings.portraitScreenLayout = layoutOption
|
||||
NativeLibrary.notifyPortraitLayoutChange(
|
||||
EmulationMenuSettings.portraitScreenLayout,
|
||||
windowManager.defaultDisplay.rotation,
|
||||
NativeLibrary::isPortraitMode.get()
|
||||
)
|
||||
IntSetting.PORTRAIT_SCREEN_LAYOUT.int = layoutOption
|
||||
settings.saveSetting(IntSetting.PORTRAIT_SCREEN_LAYOUT, SettingsFile.FILE_NAME_CONFIG)
|
||||
}
|
||||
|
||||
fun changeScreenOrientation(layoutOption: Int) {
|
||||
EmulationMenuSettings.landscapeScreenLayout = layoutOption
|
||||
NativeLibrary.notifyOrientationChange(
|
||||
EmulationMenuSettings.landscapeScreenLayout,
|
||||
windowManager.defaultDisplay.rotation
|
||||
windowManager.defaultDisplay.rotation,
|
||||
NativeLibrary::isPortraitMode.get()
|
||||
)
|
||||
IntSetting.SCREEN_LAYOUT.int = layoutOption.int
|
||||
IntSetting.SCREEN_LAYOUT.int = layoutOption
|
||||
settings.saveSetting(IntSetting.SCREEN_LAYOUT, SettingsFile.FILE_NAME_CONFIG)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,18 @@ package org.citra.citra_emu.display
|
||||
|
||||
enum class ScreenLayout(val int: Int) {
|
||||
// These must match what is defined in src/common/settings.h
|
||||
DEFAULT(0),
|
||||
TOP_BOTTOM(0),
|
||||
SINGLE_SCREEN(1),
|
||||
LARGE_SCREEN(2),
|
||||
SIDE_SCREEN(3),
|
||||
HYBRID_SCREEN(4),
|
||||
MOBILE_PORTRAIT(5),
|
||||
CUSTOM_LAYOUT(5),
|
||||
MOBILE_LANDSCAPE(6);
|
||||
|
||||
|
||||
companion object {
|
||||
fun from(int: Int): ScreenLayout {
|
||||
return entries.firstOrNull { it.int == int } ?: DEFAULT
|
||||
return entries.firstOrNull { it.int == int } ?: MOBILE_LANDSCAPE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ enum class BooleanSetting(
|
||||
ALLOW_PLUGIN_LOADER("allow_plugin_loader", Settings.SECTION_SYSTEM, true),
|
||||
SWAP_SCREEN("swap_screen", Settings.SECTION_LAYOUT, false),
|
||||
INSTANT_DEBUG_LOG("instant_debug_log", Settings.SECTION_DEBUG, false),
|
||||
CUSTOM_LAYOUT("custom_layout",Settings.SECTION_LAYOUT,false),
|
||||
ADRENO_GPU_BOOST("adreno_gpu_boost", Settings.SECTION_RENDERER, false);
|
||||
|
||||
override var boolean: Boolean = defaultValue
|
||||
|
||||
@@ -24,6 +24,7 @@ enum class IntSetting(
|
||||
CARDBOARD_X_SHIFT("cardboard_x_shift", Settings.SECTION_LAYOUT, 0),
|
||||
CARDBOARD_Y_SHIFT("cardboard_y_shift", Settings.SECTION_LAYOUT, 0),
|
||||
SCREEN_LAYOUT("layout_option", Settings.SECTION_LAYOUT, 0),
|
||||
PORTRAIT_SCREEN_LAYOUT("portrait_layout_option",Settings.SECTION_LAYOUT,0),
|
||||
AUDIO_INPUT_TYPE("output_type", Settings.SECTION_AUDIO, 0),
|
||||
NEW_3DS("is_new_3ds", Settings.SECTION_SYSTEM, 1),
|
||||
LLE_APPLETS("lle_applets", Settings.SECTION_SYSTEM, 0),
|
||||
|
||||
@@ -131,7 +131,6 @@ class Settings {
|
||||
const val KEY_CSTICK_AXIS_HORIZONTAL = "cstick_axis_horizontal"
|
||||
const val KEY_DPAD_AXIS_VERTICAL = "dpad_axis_vertical"
|
||||
const val KEY_DPAD_AXIS_HORIZONTAL = "dpad_axis_horizontal"
|
||||
|
||||
const val HOTKEY_SCREEN_SWAP = "hotkey_screen_swap"
|
||||
const val HOTKEY_CYCLE_LAYOUT = "hotkey_toggle_layout"
|
||||
const val HOTKEY_CLOSE_GAME = "hotkey_close_game"
|
||||
|
||||
@@ -51,6 +51,7 @@ import org.citra.citra_emu.activities.EmulationActivity
|
||||
import org.citra.citra_emu.databinding.DialogCheckboxBinding
|
||||
import org.citra.citra_emu.databinding.DialogSliderBinding
|
||||
import org.citra.citra_emu.databinding.FragmentEmulationBinding
|
||||
import org.citra.citra_emu.display.PortraitScreenLayout
|
||||
import org.citra.citra_emu.display.ScreenAdjustmentUtil
|
||||
import org.citra.citra_emu.display.ScreenLayout
|
||||
import org.citra.citra_emu.features.settings.model.SettingsViewModel
|
||||
@@ -142,7 +143,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
||||
retainInstance = true
|
||||
emulationState = EmulationState(game.path)
|
||||
emulationActivity = requireActivity() as EmulationActivity
|
||||
screenAdjustmentUtil = ScreenAdjustmentUtil(emulationActivity.windowManager, settingsViewModel.settings)
|
||||
screenAdjustmentUtil =
|
||||
ScreenAdjustmentUtil(emulationActivity.windowManager, settingsViewModel.settings)
|
||||
EmulationLifecycleUtil.addShutdownHook(hook = { emulationState.stop() })
|
||||
EmulationLifecycleUtil.addPauseResumeHook(hook = { togglePause() })
|
||||
}
|
||||
@@ -207,16 +209,18 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
||||
}
|
||||
})
|
||||
binding.inGameMenu.menu.findItem(R.id.menu_lock_drawer).apply {
|
||||
val titleId = if (EmulationMenuSettings.drawerLockMode == DrawerLayout.LOCK_MODE_LOCKED_CLOSED) {
|
||||
R.string.unlock_drawer
|
||||
} else {
|
||||
R.string.lock_drawer
|
||||
}
|
||||
val iconId = if (EmulationMenuSettings.drawerLockMode == DrawerLayout.LOCK_MODE_UNLOCKED) {
|
||||
R.drawable.ic_unlocked
|
||||
} else {
|
||||
R.drawable.ic_lock
|
||||
}
|
||||
val titleId =
|
||||
if (EmulationMenuSettings.drawerLockMode == DrawerLayout.LOCK_MODE_LOCKED_CLOSED) {
|
||||
R.string.unlock_drawer
|
||||
} else {
|
||||
R.string.lock_drawer
|
||||
}
|
||||
val iconId =
|
||||
if (EmulationMenuSettings.drawerLockMode == DrawerLayout.LOCK_MODE_UNLOCKED) {
|
||||
R.drawable.ic_unlocked
|
||||
} else {
|
||||
R.drawable.ic_lock
|
||||
}
|
||||
|
||||
title = getString(titleId)
|
||||
icon = ResourcesCompat.getDrawable(
|
||||
@@ -267,7 +271,12 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
||||
}
|
||||
|
||||
R.id.menu_landscape_screen_layout -> {
|
||||
showScreenLayoutMenu()
|
||||
showLandscapeScreenLayoutMenu()
|
||||
true
|
||||
}
|
||||
|
||||
R.id.menu_portrait_screen_layout -> {
|
||||
showPortraitScreenLayoutMenu()
|
||||
true
|
||||
}
|
||||
|
||||
@@ -423,7 +432,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
||||
}
|
||||
|
||||
private fun togglePause() {
|
||||
if(emulationState.isPaused) {
|
||||
if (emulationState.isPaused) {
|
||||
emulationState.unpause()
|
||||
} else {
|
||||
emulationState.pause()
|
||||
@@ -791,7 +800,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
||||
popupMenu.show()
|
||||
}
|
||||
|
||||
private fun showScreenLayoutMenu() {
|
||||
private fun showLandscapeScreenLayoutMenu() {
|
||||
val popupMenu = PopupMenu(
|
||||
requireContext(),
|
||||
binding.inGameMenu.findViewById(R.id.menu_landscape_screen_layout)
|
||||
@@ -806,12 +815,12 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
||||
ScreenLayout.SIDE_SCREEN.int ->
|
||||
R.id.menu_screen_layout_sidebyside
|
||||
|
||||
ScreenLayout.MOBILE_PORTRAIT.int ->
|
||||
R.id.menu_screen_layout_portrait
|
||||
|
||||
ScreenLayout.HYBRID_SCREEN.int ->
|
||||
R.id.menu_screen_layout_hybrid
|
||||
|
||||
ScreenLayout.CUSTOM_LAYOUT.int ->
|
||||
R.id.menu_screen_layout_custom
|
||||
|
||||
else -> R.id.menu_screen_layout_landscape
|
||||
}
|
||||
popupMenu.menu.findItem(layoutOptionMenuItem).setChecked(true)
|
||||
@@ -819,27 +828,68 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
||||
popupMenu.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.menu_screen_layout_landscape -> {
|
||||
screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.MOBILE_LANDSCAPE)
|
||||
true
|
||||
}
|
||||
|
||||
R.id.menu_screen_layout_portrait -> {
|
||||
screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.MOBILE_PORTRAIT)
|
||||
screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.MOBILE_LANDSCAPE.int)
|
||||
true
|
||||
}
|
||||
|
||||
R.id.menu_screen_layout_single -> {
|
||||
screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.SINGLE_SCREEN)
|
||||
screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.SINGLE_SCREEN.int)
|
||||
true
|
||||
}
|
||||
|
||||
R.id.menu_screen_layout_sidebyside -> {
|
||||
screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.SIDE_SCREEN)
|
||||
screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.SIDE_SCREEN.int)
|
||||
true
|
||||
}
|
||||
|
||||
R.id.menu_screen_layout_hybrid -> {
|
||||
screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.HYBRID_SCREEN)
|
||||
screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.HYBRID_SCREEN.int)
|
||||
true
|
||||
}
|
||||
|
||||
R.id.menu_screen_layout_custom -> {
|
||||
screenAdjustmentUtil.changeScreenOrientation(ScreenLayout.CUSTOM_LAYOUT.int)
|
||||
true
|
||||
}
|
||||
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
popupMenu.show()
|
||||
}
|
||||
|
||||
private fun showPortraitScreenLayoutMenu() {
|
||||
val popupMenu = PopupMenu(
|
||||
requireContext(),
|
||||
binding.inGameMenu.findViewById(R.id.menu_portrait_screen_layout)
|
||||
)
|
||||
|
||||
popupMenu.menuInflater.inflate(R.menu.menu_portrait_screen_layout, popupMenu.menu)
|
||||
|
||||
val layoutOptionMenuItem = when (EmulationMenuSettings.portraitScreenLayout) {
|
||||
PortraitScreenLayout.TOP_FULL_WIDTH.int ->
|
||||
R.id.menu_portrait_layout_top_full
|
||||
|
||||
PortraitScreenLayout.CUSTOM_PORTRAIT_LAYOUT.int ->
|
||||
R.id.menu_portrait_layout_custom
|
||||
|
||||
else ->
|
||||
R.id.menu_portrait_layout_top_full
|
||||
|
||||
}
|
||||
|
||||
popupMenu.menu.findItem(layoutOptionMenuItem).setChecked(true)
|
||||
|
||||
popupMenu.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.menu_portrait_layout_top_full -> {
|
||||
screenAdjustmentUtil.changePortraitOrientation(PortraitScreenLayout.TOP_FULL_WIDTH.int)
|
||||
true
|
||||
}
|
||||
|
||||
R.id.menu_portrait_layout_custom -> {
|
||||
screenAdjustmentUtil.changePortraitOrientation(PortraitScreenLayout.CUSTOM_PORTRAIT_LAYOUT.int)
|
||||
true
|
||||
}
|
||||
|
||||
@@ -981,7 +1031,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
||||
resetScale("controlScale-" + NativeLibrary.ButtonType.BUTTON_SWAP)
|
||||
binding.surfaceInputOverlay.refreshControls()
|
||||
}
|
||||
|
||||
|
||||
private fun setControlOpacity(opacity: Int) {
|
||||
preferences.edit()
|
||||
.putInt("controlOpacity", opacity)
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.citra.citra_emu.utils
|
||||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
import androidx.preference.PreferenceManager
|
||||
import org.citra.citra_emu.CitraApplication
|
||||
import org.citra.citra_emu.display.PortraitScreenLayout
|
||||
import org.citra.citra_emu.display.ScreenLayout
|
||||
|
||||
object EmulationMenuSettings {
|
||||
@@ -30,13 +31,23 @@ object EmulationMenuSettings {
|
||||
var landscapeScreenLayout: Int
|
||||
get() = preferences.getInt(
|
||||
"EmulationMenuSettings_LandscapeScreenLayout",
|
||||
ScreenLayout.MOBILE_LANDSCAPE.int
|
||||
ScreenLayout.LARGE_SCREEN.int
|
||||
)
|
||||
set(value) {
|
||||
preferences.edit()
|
||||
.putInt("EmulationMenuSettings_LandscapeScreenLayout", value)
|
||||
.apply()
|
||||
}
|
||||
var portraitScreenLayout: Int
|
||||
get() = preferences.getInt(
|
||||
"EmulationMenuSettings_PortraitScreenLayout",
|
||||
PortraitScreenLayout.TOP_FULL_WIDTH.int
|
||||
)
|
||||
set(value) {
|
||||
preferences.edit()
|
||||
.putInt("EmulationMenuSettings_PortraitScreenLayout", value)
|
||||
.apply()
|
||||
}
|
||||
var showFps: Boolean
|
||||
get() = preferences.getBoolean("EmulationMenuSettings_ShowFps", false)
|
||||
set(value) {
|
||||
|
||||
@@ -175,7 +175,7 @@ void Config::ReadValues() {
|
||||
|
||||
// Layout
|
||||
Settings::values.layout_option = static_cast<Settings::LayoutOption>(sdl2_config->GetInteger(
|
||||
"Layout", "layout_option", static_cast<int>(Settings::LayoutOption::MobileLandscape)));
|
||||
"Layout", "layout_option", static_cast<int>(Settings::LayoutOption::LargeScreen)));
|
||||
ReadSetting("Layout", Settings::values.custom_layout);
|
||||
ReadSetting("Layout", Settings::values.custom_top_x);
|
||||
ReadSetting("Layout", Settings::values.custom_top_y);
|
||||
@@ -189,7 +189,10 @@ void Config::ReadValues() {
|
||||
ReadSetting("Layout", Settings::values.cardboard_x_shift);
|
||||
ReadSetting("Layout", Settings::values.cardboard_y_shift);
|
||||
|
||||
ReadSetting("Layout", Settings::values.custom_portrait_layout);
|
||||
Settings::values.portrait_layout_option =
|
||||
static_cast<Settings::PortraitLayoutOption>(sdl2_config->GetInteger(
|
||||
"Layout", "portrait_layout_option",
|
||||
static_cast<int>(Settings::PortraitLayoutOption::PortraitTopFullWidth)));
|
||||
ReadSetting("Layout", Settings::values.custom_portrait_top_x);
|
||||
ReadSetting("Layout", Settings::values.custom_portrait_top_y);
|
||||
ReadSetting("Layout", Settings::values.custom_portrait_top_width);
|
||||
|
||||
@@ -183,15 +183,15 @@ filter_mode =
|
||||
delay_game_render_thread_us =
|
||||
|
||||
[Layout]
|
||||
# Layout for the screen inside the render window.
|
||||
# 0 (default): Default Top Bottom Screen, 1: Single Screen Only, 2: Large Screen Small Screen, 3: Side by Side
|
||||
# Layout for the screen inside the render window, landscape mode
|
||||
# 0 (default): Default Top Bottom Screen,
|
||||
# 1: Single Screen Only,
|
||||
# 2: Large Screen Small Screen
|
||||
# 3: Side by Side
|
||||
# 4: Hybrid
|
||||
# 5: Custom Layout
|
||||
layout_option =
|
||||
|
||||
# Toggle custom layout (using the settings below) on or off.
|
||||
# Only applies to landscape on Android
|
||||
# 0 (default): Off, 1: On
|
||||
custom_layout =
|
||||
|
||||
# Screen placement when using Custom layout option
|
||||
# 0x, 0y is the top left corner of the render window.
|
||||
custom_top_x =
|
||||
@@ -203,12 +203,12 @@ custom_bottom_y =
|
||||
custom_bottom_width =
|
||||
custom_bottom_height =
|
||||
|
||||
# Custom Layout Options for Android Portrait Mode
|
||||
# Toggle custom layout (using the settings below) on or off.
|
||||
# 0 (default): Off, 1: On
|
||||
custom_portrait_layout =
|
||||
# Layout for the portrait mode
|
||||
# 0 (default): Top and bottom screens at top, full width
|
||||
# 1: Custom Layout
|
||||
portrait_layout_option =
|
||||
|
||||
# Screen placement when using Custom layout option
|
||||
# Screen placement when using Portrait Custom layout option
|
||||
# 0x, 0y is the top left corner of the render window.
|
||||
custom_portrait_top_x =
|
||||
custom_portrait_top_y =
|
||||
|
||||
@@ -27,6 +27,12 @@ static void UpdateLandscapeScreenLayout() {
|
||||
IDCache::GetNativeLibraryClass(), IDCache::GetLandscapeScreenLayout()));
|
||||
}
|
||||
|
||||
static void UpdatePortraitScreenLayout() {
|
||||
Settings::values.portrait_layout_option =
|
||||
static_cast<Settings::PortraitLayoutOption>(IDCache::GetEnvForThread()->CallStaticIntMethod(
|
||||
IDCache::GetNativeLibraryClass(), IDCache::GetPortraitScreenLayout()));
|
||||
}
|
||||
|
||||
bool EmuWindow_Android::OnSurfaceChanged(ANativeWindow* surface) {
|
||||
if (render_window == surface) {
|
||||
return false;
|
||||
@@ -56,6 +62,7 @@ void EmuWindow_Android::OnTouchMoved(int x, int y) {
|
||||
|
||||
void EmuWindow_Android::OnFramebufferSizeChanged() {
|
||||
UpdateLandscapeScreenLayout();
|
||||
UpdatePortraitScreenLayout();
|
||||
const bool is_portrait_mode{IsPortraitMode()};
|
||||
|
||||
const int bigger{window_width > window_height ? window_width : window_height};
|
||||
|
||||
@@ -27,6 +27,7 @@ static jclass s_native_library_class;
|
||||
static jmethodID s_on_core_error;
|
||||
static jmethodID s_is_portrait_mode;
|
||||
static jmethodID s_landscape_screen_layout;
|
||||
static jmethodID s_portrait_screen_layout;
|
||||
static jmethodID s_exit_emulation_activity;
|
||||
static jmethodID s_request_camera_permission;
|
||||
static jmethodID s_request_mic_permission;
|
||||
@@ -90,6 +91,10 @@ jmethodID GetLandscapeScreenLayout() {
|
||||
return s_landscape_screen_layout;
|
||||
}
|
||||
|
||||
jmethodID GetPortraitScreenLayout() {
|
||||
return s_portrait_screen_layout;
|
||||
}
|
||||
|
||||
jmethodID GetExitEmulationActivity() {
|
||||
return s_exit_emulation_activity;
|
||||
}
|
||||
@@ -174,6 +179,8 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
||||
s_is_portrait_mode = env->GetStaticMethodID(s_native_library_class, "isPortraitMode", "()Z");
|
||||
s_landscape_screen_layout =
|
||||
env->GetStaticMethodID(s_native_library_class, "landscapeScreenLayout", "()I");
|
||||
s_portrait_screen_layout =
|
||||
env->GetStaticMethodID(s_native_library_class, "portraitScreenLayout", "()I");
|
||||
s_exit_emulation_activity =
|
||||
env->GetStaticMethodID(s_native_library_class, "exitEmulationActivity", "(I)V");
|
||||
s_request_camera_permission =
|
||||
|
||||
@@ -27,6 +27,7 @@ jmethodID GetDisplayAlertPrompt();
|
||||
jmethodID GetAlertPromptButton();
|
||||
jmethodID GetIsPortraitMode();
|
||||
jmethodID GetLandscapeScreenLayout();
|
||||
jmethodID GetPortraitScreenLayout();
|
||||
jmethodID GetExitEmulationActivity();
|
||||
jmethodID GetRequestCameraPermission();
|
||||
jmethodID GetRequestMicPermission();
|
||||
|
||||
@@ -350,9 +350,23 @@ void JNICALL Java_org_citra_citra_1emu_NativeLibrary_enableAdrenoTurboMode(JNIEn
|
||||
void Java_org_citra_citra_1emu_NativeLibrary_notifyOrientationChange([[maybe_unused]] JNIEnv* env,
|
||||
[[maybe_unused]] jobject obj,
|
||||
jint layout_option,
|
||||
jint rotation) {
|
||||
jint rotation,
|
||||
jboolean portrait) {
|
||||
Settings::values.layout_option = static_cast<Settings::LayoutOption>(layout_option);
|
||||
auto& system = Core::System::GetInstance();
|
||||
if (system.IsPoweredOn()) {
|
||||
|
||||
system.GPU().Renderer().UpdateCurrentFramebufferLayout(portrait);
|
||||
}
|
||||
InputManager::screen_rotation = rotation;
|
||||
Camera::NDK::g_rotation = rotation;
|
||||
}
|
||||
|
||||
void Java_io_github_lime3ds_android_NativeLibrary_notifyPortraitLayoutChange(
|
||||
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, jint layout_option, jint rotation) {
|
||||
Settings::values.portrait_layout_option =
|
||||
static_cast<Settings::PortraitLayoutOption>(layout_option);
|
||||
auto& system = Core::System::GetInstance();
|
||||
if (system.IsPoweredOn()) {
|
||||
system.GPU().Renderer().UpdateCurrentFramebufferLayout(!(rotation % 2));
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<menu>
|
||||
<group android:checkableBehavior="single">
|
||||
<item
|
||||
android:id="@+id/menu_screen_layout_landscape"
|
||||
android:id="@+id/menu_portrait_layout_top_full"
|
||||
android:title="@string/emulation_screen_layout_landscape" />
|
||||
|
||||
<item
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
android:icon="@drawable/ic_fit_screen"
|
||||
android:title="@string/emulation_switch_screen_layout" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_portrait_screen_layout"
|
||||
android:icon="@drawable/ic_fit_screen"
|
||||
android:title="@string/emulation_switch_portrait_layout" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_swap_screens"
|
||||
android:icon="@drawable/ic_splitscreen"
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
android:id="@+id/menu_screen_layout_landscape"
|
||||
android:title="@string/emulation_screen_layout_landscape" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_screen_layout_portrait"
|
||||
android:title="@string/emulation_screen_layout_portrait" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_screen_layout_single"
|
||||
android:title="@string/emulation_screen_layout_single" />
|
||||
@@ -23,6 +19,9 @@
|
||||
android:id="@+id/menu_screen_layout_hybrid"
|
||||
android:title="@string/emulation_screen_layout_hybrid" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_screen_layout_custom"
|
||||
android:title="@string/emulation_screen_layout_custom" />
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<group android:checkableBehavior="single">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_portrait_layout_top_full"
|
||||
android:title="@string/emulation_portrait_layout_top_full" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_portrait_layout_custom"
|
||||
android:title="@string/emulation_screen_layout_custom" />
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
@@ -363,12 +363,15 @@
|
||||
<string name="emulation_open_settings">Open Settings</string>
|
||||
<string name="emulation_open_cheats">Open Cheats</string>
|
||||
<string name="emulation_switch_screen_layout">Landscape Screen Layout</string>
|
||||
<string name="emulation_switch_portrait_layout">Portrait Screen Layout</string>
|
||||
<string name="emulation_screen_layout_landscape">Default</string>
|
||||
<string name="emulation_screen_layout_portrait">Portrait</string>
|
||||
<string name="emulation_screen_layout_single">Single Screen</string>
|
||||
<string name="emulation_screen_layout_sidebyside">Side by Side Screens</string>
|
||||
<string name="emulation_screen_layout_hybrid">Hybrid Screens</string>
|
||||
<string name="emulation_cycle_landscape_layouts">Cycle Landscape Layouts</string>
|
||||
<string name="emulation_portrait_layout_top_full">Default</string>
|
||||
<string name="emulation_screen_layout_custom">Custom Layout</string>
|
||||
<string name="emulation_cycle_landscape_layouts">Cycle Layouts</string>
|
||||
<string name="emulation_swap_screens">Swap Screens</string>
|
||||
<string name="emulation_touch_overlay_reset">Reset Overlay</string>
|
||||
<string name="emulation_show_overlay">Show Overlay</string>
|
||||
|
||||
Reference in New Issue
Block a user