Browse files

Android: lock screen to landscape by default

A new setting has been added to the general config to allow rotation. This should
resolve a lot of crash complaints due to screen rotation.
  • Loading branch information...
zackhow committed Oct 20, 2018
1 parent 4d62037 commit 9e44df1d3aa062a39f32b87e9b3802170d571bc4
@@ -4,6 +4,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.os.Handler;
@@ -237,6 +239,17 @@ protected void onCreate(Bundle savedInstanceState)
int themeId;
if (mDeviceHasTouchScreen)
// Force landscape
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
BooleanSetting lockLandscape =
(BooleanSetting) mSettings.getSection(Settings.SECTION_INI_CORE)
if (lockLandscape == null || lockLandscape.getValue())
new Handler().postDelayed(
() -> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE),
themeId =;
// Get a handle to the Window containing the UI.
@@ -212,6 +212,7 @@ private void addGeneralSettings(ArrayList<SettingsItem> sl)
Setting audioStretch = null;
Setting analytics = null;
Setting enableSaveState;
Setting lockToLandscape;
SettingSection coreSection = mSettings.getSection(Settings.SECTION_INI_CORE);
SettingSection analyticsSection = mSettings.getSection(Settings.SECTION_ANALYTICS);
@@ -223,6 +224,7 @@ private void addGeneralSettings(ArrayList<SettingsItem> sl)
audioStretch = coreSection.getSetting(SettingsFile.KEY_AUDIO_STRETCH);
analytics = analyticsSection.getSetting(SettingsFile.KEY_ANALYTICS_ENABLED);
enableSaveState = coreSection.getSetting(SettingsFile.KEY_ENABLE_SAVE_STATES);
lockToLandscape = coreSection.getSetting(SettingsFile.KEY_LOCK_LANDSCAPE);
// TODO: Having different emuCoresEntries/emuCoresValues for each architecture is annoying.
// The proper solution would be to have one emuCoresEntries and one emuCoresValues
@@ -262,6 +264,9 @@ else if (defaultCpuCore == 4) // AArch64
sl.add(new CheckBoxSetting(SettingsFile.KEY_ENABLE_SAVE_STATES, Settings.SECTION_INI_CORE,
R.string.enable_save_states, R.string.enable_save_states_description, false,
sl.add(new CheckBoxSetting(SettingsFile.KEY_LOCK_LANDSCAPE, Settings.SECTION_INI_CORE,
R.string.lock_emulation_landscape, R.string.lock_emulation_landscape_desc, true,
sl.add(new CheckBoxSetting(SettingsFile.KEY_ANALYTICS_ENABLED, Settings.SECTION_ANALYTICS,, 0, false, analytics));
@@ -50,6 +50,7 @@
public static final String KEY_SLOT_A_DEVICE = "SlotA";
public static final String KEY_SLOT_B_DEVICE = "SlotB";
public static final String KEY_ENABLE_SAVE_STATES = "EnableSaveStates";
public static final String KEY_LOCK_LANDSCAPE = "LockLandscape";
public static final String KEY_ANALYTICS_ENABLED = "Enabled";
public static final String KEY_ANALYTICS_PERMISSION_ASKED = "PermissionAsked";
@@ -137,6 +137,8 @@
<string name="audio_stretch_description">Stretches audio to reduce stuttering. Increases latency.</string>
<string name="enable_save_states">Enable Savestates</string>
<string name="enable_save_states_description">WARNING: Savestates may not be compatible with future versions of Dolphin and can make it impossible to create normal saves in some cases. Never use savestates as the only way of saving your progress.</string>
<string name="lock_emulation_landscape">Lock screen to landscape</string>
<string name="lock_emulation_landscape_desc">Some touch controls will require additional tweaking if played in portrait</string>
<string name="analytics">Enable usage statistics reporting</string>
<string name="analytics_desc">If authorized, Dolphin can collect data on its performance, feature usage, and configuration, as well as data on your system\'s hardware and operating system.\n\nNo private data is ever collected. This data helps us understand how people and emulated games use Dolphin and prioritize our efforts. It also helps us identify rare configurations that are causing bugs, performance and stability issues. This authorization can be revoked at any time through Dolphin\'s settings.</string>
<string name="gametdb_thanks">Thanks to for providing GameCube and Wii covers!</string>

0 comments on commit 9e44df1

Please sign in to comment.