summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.java78
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt59
2 files changed, 59 insertions, 78 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.java
deleted file mode 100644
index 0b11b9cc0..000000000
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.yuzu.yuzu_emu.utils;
-
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-
-import org.yuzu.yuzu_emu.YuzuApplication;
-
-public class EmulationMenuSettings {
- private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
-
- // These must match what is defined in src/core/settings.h
- public static final int LayoutOption_Default = 0;
- public static final int LayoutOption_SingleScreen = 1;
- public static final int LayoutOption_LargeScreen = 2;
- public static final int LayoutOption_SideScreen = 3;
- public static final int LayoutOption_MobilePortrait = 4;
- public static final int LayoutOption_MobileLandscape = 5;
-
- public static boolean getJoystickRelCenter() {
- return mPreferences.getBoolean("EmulationMenuSettings_JoystickRelCenter", true);
- }
-
- public static void setJoystickRelCenter(boolean value) {
- final SharedPreferences.Editor editor = mPreferences.edit();
- editor.putBoolean("EmulationMenuSettings_JoystickRelCenter", value);
- editor.apply();
- }
-
- public static boolean getDpadSlideEnable() {
- return mPreferences.getBoolean("EmulationMenuSettings_DpadSlideEnable", true);
- }
-
- public static void setDpadSlideEnable(boolean value) {
- final SharedPreferences.Editor editor = mPreferences.edit();
- editor.putBoolean("EmulationMenuSettings_DpadSlideEnable", value);
- editor.apply();
- }
-
- public static int getLandscapeScreenLayout() {
- return mPreferences.getInt("EmulationMenuSettings_LandscapeScreenLayout", LayoutOption_MobileLandscape);
- }
-
- public static void setLandscapeScreenLayout(int value) {
- final SharedPreferences.Editor editor = mPreferences.edit();
- editor.putInt("EmulationMenuSettings_LandscapeScreenLayout", value);
- editor.apply();
- }
-
- public static boolean getShowFps() {
- return mPreferences.getBoolean("EmulationMenuSettings_ShowFps", false);
- }
-
- public static void setShowFps(boolean value) {
- final SharedPreferences.Editor editor = mPreferences.edit();
- editor.putBoolean("EmulationMenuSettings_ShowFps", value);
- editor.apply();
- }
-
- public static boolean getSwapScreens() {
- return mPreferences.getBoolean("EmulationMenuSettings_SwapScreens", false);
- }
-
- public static void setSwapScreens(boolean value) {
- final SharedPreferences.Editor editor = mPreferences.edit();
- editor.putBoolean("EmulationMenuSettings_SwapScreens", value);
- editor.apply();
- }
-
- public static boolean getShowOverlay() {
- return mPreferences.getBoolean("EmulationMenuSettings_ShowOverylay", true);
- }
-
- public static void setShowOverlay(boolean value) {
- final SharedPreferences.Editor editor = mPreferences.edit();
- editor.putBoolean("EmulationMenuSettings_ShowOverylay", value);
- editor.apply();
- }
-}
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt
new file mode 100644
index 000000000..ae654f596
--- /dev/null
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt
@@ -0,0 +1,59 @@
+package org.yuzu.yuzu_emu.utils
+
+import androidx.preference.PreferenceManager
+import org.yuzu.yuzu_emu.YuzuApplication
+import org.yuzu.yuzu_emu.features.settings.model.Settings
+
+object EmulationMenuSettings {
+ private val preferences =
+ PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
+
+ // These must match what is defined in src/core/settings.h
+ const val LayoutOption_Default = 0
+ const val LayoutOption_SingleScreen = 1
+ const val LayoutOption_LargeScreen = 2
+ const val LayoutOption_SideScreen = 3
+ const val LayoutOption_MobilePortrait = 4
+ const val LayoutOption_MobileLandscape = 5
+
+ var joystickRelCenter: Boolean
+ get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_JOYSTICK_REL_CENTER, true)
+ set(value) {
+ preferences.edit()
+ .putBoolean(Settings.PREF_MENU_SETTINGS_JOYSTICK_REL_CENTER, value)
+ .apply()
+ }
+ var dpadSlideEnable: Boolean
+ get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_DPAD_SLIDE, true)
+ set(value) {
+ preferences.edit()
+ .putBoolean(Settings.PREF_MENU_SETTINGS_DPAD_SLIDE, value)
+ .apply()
+ }
+
+ @JvmStatic
+ var landscapeScreenLayout: Int
+ get() = preferences.getInt(
+ Settings.PREF_MENU_SETTINGS_LANDSCAPE,
+ LayoutOption_MobileLandscape
+ )
+ set(value) {
+ preferences.edit()
+ .putInt(Settings.PREF_MENU_SETTINGS_LANDSCAPE, value)
+ .apply()
+ }
+ var showFps: Boolean
+ get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_SHOW_FPS, false)
+ set(value) {
+ preferences.edit()
+ .putBoolean(Settings.PREF_MENU_SETTINGS_SHOW_FPS, value)
+ .apply()
+ }
+ var showOverlay: Boolean
+ get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_SHOW_OVERLAY, true)
+ set(value) {
+ preferences.edit()
+ .putBoolean(Settings.PREF_MENU_SETTINGS_SHOW_OVERLAY, value)
+ .apply()
+ }
+}