From fb2e633e1e808b3763a62779422d371d5300ad42 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 16 Sep 2020 11:59:18 +0200 Subject: [PATCH 1/4] Android: Don't assume SliderSetting minimum is 0 --- .../settings/model/view/FloatSliderSetting.java | 6 +++--- .../settings/model/view/IntSliderSetting.java | 6 +++--- .../settings/model/view/PercentSliderSetting.java | 6 +++--- .../features/settings/model/view/SliderSetting.java | 9 ++++++++- .../features/settings/ui/SettingsAdapter.java | 1 + .../settings/ui/SettingsFragmentPresenter.java | 13 +++++++------ 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.java index 7d9df45056..525ee7341b 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.java @@ -8,10 +8,10 @@ public class FloatSliderSetting extends SliderSetting { protected AbstractFloatSetting mSetting; - public FloatSliderSetting(AbstractFloatSetting setting, int titleId, int descriptionId, int max, - String units) + public FloatSliderSetting(AbstractFloatSetting setting, int titleId, int descriptionId, int min, + int max, String units) { - super(titleId, descriptionId, max, units); + super(titleId, descriptionId, min, max, units); mSetting = setting; } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.java index 9c54346bba..7ca8c4df93 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.java @@ -8,10 +8,10 @@ public final class IntSliderSetting extends SliderSetting { private AbstractIntSetting mSetting; - public IntSliderSetting(AbstractIntSetting setting, int titleId, int descriptionId, int max, - String units) + public IntSliderSetting(AbstractIntSetting setting, int titleId, int descriptionId, int min, + int max, String units) { - super(titleId, descriptionId, max, units); + super(titleId, descriptionId, min, max, units); mSetting = setting; } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.java index e0dbbc29d3..8811fb8f16 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.java @@ -6,10 +6,10 @@ import org.dolphinemu.dolphinemu.features.settings.model.Settings; public final class PercentSliderSetting extends FloatSliderSetting { - public PercentSliderSetting(AbstractFloatSetting setting, int titleId, int descriptionId, int max, - String units) + public PercentSliderSetting(AbstractFloatSetting setting, int titleId, int descriptionId, int min, + int max, String units) { - super(setting, titleId, descriptionId, max, units); + super(setting, titleId, descriptionId, min, max, units); } @Override diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.java index a50d5203a6..c922a7b156 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.java @@ -4,18 +4,25 @@ import org.dolphinemu.dolphinemu.features.settings.model.Settings; public abstract class SliderSetting extends SettingsItem { + private int mMin; private int mMax; private String mUnits; - public SliderSetting(int nameId, int descriptionId, int max, String units) + public SliderSetting(int nameId, int descriptionId, int min, int max, String units) { super(nameId, descriptionId); + mMin = min; mMax = max; mUnits = units; } public abstract int getSelectedValue(Settings settings); + public int getMin() + { + return mMin; + } + public int getMax() { return mMax; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java index 01ecfd3ffc..605c23854e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java @@ -239,6 +239,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter sl) @@ -407,7 +408,7 @@ public final class SettingsFragmentPresenter sl.add(new CheckBoxSetting(BooleanSetting.MAIN_OVERCLOCK_ENABLE, R.string.overclock_enable, R.string.overclock_enable_description)); sl.add(new PercentSliderSetting(FloatSetting.MAIN_OVERCLOCK, R.string.overclock_title, - R.string.overclock_title_description, 400, "%")); + R.string.overclock_title_description, 0, 400, "%")); } private void addGcPadSettings(ArrayList sl) @@ -649,9 +650,9 @@ public final class SettingsFragmentPresenter sl.add(new SingleChoiceSetting(IntSetting.GFX_STEREO_MODE, R.string.stereoscopy_mode, 0, R.array.stereoscopyEntries, R.array.stereoscopyValues)); sl.add(new IntSliderSetting(IntSetting.GFX_STEREO_DEPTH, R.string.stereoscopy_depth, - R.string.stereoscopy_depth_description, 100, "%")); + R.string.stereoscopy_depth_description, 0, 100, "%")); sl.add(new IntSliderSetting(IntSetting.GFX_STEREO_CONVERGENCE_PERCENTAGE, - R.string.stereoscopy_convergence, R.string.stereoscopy_convergence_description, 200, + R.string.stereoscopy_convergence, R.string.stereoscopy_convergence_description, 0, 200, "%")); sl.add(new CheckBoxSetting(BooleanSetting.GFX_STEREO_SWAP_EYES, R.string.stereoscopy_swap_eyes, R.string.stereoscopy_swap_eyes_description)); From 9c97654603e9d8c01dcff9ae06981fa9bf23d29a Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 16 Sep 2020 12:15:33 +0200 Subject: [PATCH 2/4] Config: Add SYSCONF to IsSettingSaveable SYSCONF very much is saveable. Whether it's in IsSettingSaveable or not hasn't mattered until now since the SYSCONF settings use separate config loader code that doesn't check IsSettingSaveable, but the next commit will require SYSCONF to be marked as saveable. --- Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp index 4e9dcc7005..7195dfd97b 100644 --- a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp +++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp @@ -16,8 +16,8 @@ namespace ConfigLoaders { bool IsSettingSaveable(const Config::Location& config_location) { - for (Config::System system : - {Config::System::GFX, Config::System::DualShockUDPClient, Config::System::Logger}) + for (Config::System system : {Config::System::SYSCONF, Config::System::GFX, + Config::System::DualShockUDPClient, Config::System::Logger}) { if (config_location.system == system) return true; From 6e6446be83f6c2bc9f0ce74edf0669d1a7cd63a6 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 16 Sep 2020 11:49:02 +0200 Subject: [PATCH 3/4] Android: Add Wii SYSCONF settings to GUI Now that PR 8975 is merged, we can finally add this without hacks. https://bugs.dolphin-emu.org/issues/11605 --- .../settings/model/BooleanSetting.java | 9 ++++ .../features/settings/model/IntSetting.java | 10 ++++ .../features/settings/model/Settings.java | 1 + .../ui/SettingsFragmentPresenter.java | 22 ++++++++- .../app/src/main/res/values/arrays.xml | 48 +++++++++++++++++++ .../app/src/main/res/values/strings.xml | 13 ++++- Source/Android/jni/NativeConfig.cpp | 4 ++ 7 files changed, 104 insertions(+), 3 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java index 29269e40d3..59a7a7161c 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java @@ -39,6 +39,12 @@ public enum BooleanSetting implements AbstractBooleanSetting MAIN_RECURSIVE_ISO_PATHS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_GENERAL, "RecursiveISOPaths", false), + SYSCONF_SCREENSAVER(Settings.FILE_SYSCONF, "IPL", "SSV", false), + SYSCONF_WIDESCREEN(Settings.FILE_SYSCONF, "IPL", "AR", true), + SYSCONF_PAL60(Settings.FILE_SYSCONF, "IPL", "E60", true), + + SYSCONF_WIIMOTE_MOTOR(Settings.FILE_SYSCONF, "BT", "MOT", true), + GFX_WIDESCREEN_HACK(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "wideScreenHack", false), GFX_SHOW_FPS(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "ShowFPS", false), GFX_ENABLE_GPU_TEXTURE_DECODING(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, @@ -134,6 +140,9 @@ public enum BooleanSetting implements AbstractBooleanSetting @Override public boolean isRuntimeEditable() { + if (mFile.equals(Settings.FILE_SYSCONF)) + return false; + for (BooleanSetting setting : NOT_RUNTIME_EDITABLE) { if (setting == this) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java index 7fc265d38f..b6e0c6c290 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java @@ -20,6 +20,13 @@ public enum IntSetting implements AbstractIntSetting MAIN_LAST_PLATFORM_TAB(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID, "LastPlatformTab", 0), + SYSCONF_LANGUAGE(Settings.FILE_SYSCONF, "IPL", "LNG", 0x01), + SYSCONF_SOUND_MODE(Settings.FILE_SYSCONF, "IPL", "SND", 0x01), + + SYSCONF_SENSOR_BAR_POSITION(Settings.FILE_SYSCONF, "BT", "BAR", 0x01), + SYSCONF_SENSOR_BAR_SENSITIVITY(Settings.FILE_SYSCONF, "BT", "SENS", 0x03), + SYSCONF_SPEAKER_VOLUME(Settings.FILE_SYSCONF, "BT", "SPKV", 0x58), + GFX_ASPECT_RATIO(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "AspectRatio", 0), GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "SafeTextureCacheColorSamples", 128), @@ -73,6 +80,9 @@ public enum IntSetting implements AbstractIntSetting @Override public boolean isRuntimeEditable() { + if (mFile.equals(Settings.FILE_SYSCONF)) + return false; + for (IntSetting setting : NOT_RUNTIME_EDITABLE) { if (setting == this) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java index 5d650371c4..46222ed2e6 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java @@ -17,6 +17,7 @@ import java.util.Map; public class Settings implements Closeable { public static final String FILE_DOLPHIN = "Dolphin"; + public static final String FILE_SYSCONF = "SYSCONF"; public static final String FILE_GFX = "GFX"; public static final String FILE_LOGGER = "Logger"; public static final String FILE_GCPAD = "GCPadNew"; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java index fc60ec0ebe..f3855edc84 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java @@ -360,8 +360,8 @@ public final class SettingsFragmentPresenter private void addGameCubeSettings(ArrayList sl) { - sl.add(new SingleChoiceSetting(IntSetting.MAIN_GC_LANGUAGE, R.string.gamecube_system_language, - 0, R.array.gameCubeSystemLanguageEntries, R.array.gameCubeSystemLanguageValues)); + sl.add(new SingleChoiceSetting(IntSetting.MAIN_GC_LANGUAGE, R.string.system_language, 0, + R.array.gameCubeSystemLanguageEntries, R.array.gameCubeSystemLanguageValues)); sl.add(new SingleChoiceSetting(IntSetting.MAIN_SLOT_A, R.string.slot_a_device, 0, R.array.slotDeviceEntries, R.array.slotDeviceValues)); sl.add(new SingleChoiceSetting(IntSetting.MAIN_SLOT_B, R.string.slot_b_device, 0, @@ -370,10 +370,28 @@ public final class SettingsFragmentPresenter private void addWiiSettings(ArrayList sl) { + sl.add(new SingleChoiceSetting(IntSetting.SYSCONF_LANGUAGE, R.string.system_language, 0, + R.array.wiiSystemLanguageEntries, R.array.wiiSystemLanguageValues)); + sl.add(new CheckBoxSetting(BooleanSetting.SYSCONF_WIDESCREEN, R.string.wii_widescreen, + R.string.wii_widescreen_description)); + sl.add(new CheckBoxSetting(BooleanSetting.SYSCONF_PAL60, R.string.wii_pal60, + R.string.wii_pal60_description)); + sl.add(new CheckBoxSetting(BooleanSetting.SYSCONF_SCREENSAVER, R.string.wii_screensaver, + R.string.wii_screensaver_description)); + sl.add(new SingleChoiceSetting(IntSetting.SYSCONF_SOUND_MODE, R.string.sound_mode, 0, + R.array.soundModeEntries, R.array.soundModeValues)); sl.add(new CheckBoxSetting(BooleanSetting.MAIN_WII_SD_CARD, R.string.insert_sd_card, R.string.insert_sd_card_description)); sl.add(new CheckBoxSetting(BooleanSetting.MAIN_ALLOW_SD_WRITES, R.string.wii_sd_card_allow_writes, 0)); + sl.add(new CheckBoxSetting(BooleanSetting.SYSCONF_WIIMOTE_MOTOR, R.string.wiimote_rumble, 0)); + sl.add(new IntSliderSetting(IntSetting.SYSCONF_SPEAKER_VOLUME, R.string.wiimote_volume, 0, 0, + 127, "")); + sl.add(new IntSliderSetting(IntSetting.SYSCONF_SENSOR_BAR_SENSITIVITY, + R.string.sensor_bar_sensitivity, 0, 1, 5, "")); + sl.add(new SingleChoiceSetting(IntSetting.SYSCONF_SENSOR_BAR_POSITION, + R.string.sensor_bar_position, 0, R.array.sensorBarPositionEntries, + R.array.sensorBarPositionValues)); sl.add(new CheckBoxSetting(BooleanSetting.MAIN_WIIMOTE_CONTINUOUS_SCANNING, R.string.wiimote_scanning, R.string.wiimote_scanning_description)); sl.add(new CheckBoxSetting(BooleanSetting.MAIN_WIIMOTE_ENABLE_SPEAKER, R.string.wiimote_speaker, diff --git a/Source/Android/app/src/main/res/values/arrays.xml b/Source/Android/app/src/main/res/values/arrays.xml index 5adc40229d..275f6257a6 100644 --- a/Source/Android/app/src/main/res/values/arrays.xml +++ b/Source/Android/app/src/main/res/values/arrays.xml @@ -85,6 +85,54 @@ 8 + + + Japanese + English + German + French + Spanish + Italian + Dutch + Simplified Chinese + Traditional Chinese + Korean + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + + + + + Mono + Stereo + Surround + + + 0 + 1 + 2 + + + + + Top + Bottom + + + 1 + 0 + + Notice diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 7ced055909..a600725e6e 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -128,13 +128,24 @@ Speed Limit (0% = Unlimited) WARNING: Changing this from the default (100%) WILL break games and cause glitches. Please do not report bugs that occur with a non-default clock. GameCube - System Language + System Language GameCube Slot A Device GameCube Slot B Device Wii + Widescreen + Changes aspect ratio from 4:3 to 16:9 in games that support it. + Use PAL60 Mode (EuRGB60) + Changes refresh rate from 50 Hz to 60 Hz in PAL games that support it. + Enable Screen Saver + Dims the screen after five minutes of inactivity. + Sound Insert SD Card Supports SD and SDHC. Default size is 128 MB. Allow Writes to SD Card + Wii Remote Rumble + Wii Remote Speaker Volume + Sensor Bar Sensitivity + Sensor Bar Position Wii Remote Continuous Scanning Leave this on if you are using a DolphinBar for real Wiimote support. Wii Remote Speaker diff --git a/Source/Android/jni/NativeConfig.cpp b/Source/Android/jni/NativeConfig.cpp index 3a3a5289c3..dfc90329af 100644 --- a/Source/Android/jni/NativeConfig.cpp +++ b/Source/Android/jni/NativeConfig.cpp @@ -25,6 +25,10 @@ static Config::Location GetLocation(JNIEnv* env, jstring file, jstring section, { system = Config::System::Main; } + else if (decoded_file == "SYSCONF") + { + system = Config::System::SYSCONF; + } else if (decoded_file == "GFX") { system = Config::System::GFX; From 7749e8c10c65dfb7c8f31d0e3793bcc143ea9c14 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 16 Sep 2020 12:44:32 +0200 Subject: [PATCH 4/4] Only automatically override SYSCONF settings when it has an effect Any call to Config::SetCurrent will cause the relevant setting to show up as overridden in the Android GUI, which can be confusing, so let's not do it when the new value is the same as the original. --- Source/Core/Core/BootManager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index 23de16583b..20925f8685 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -401,7 +401,8 @@ bool BootCore(std::unique_ptr boot, const WindowSystemInfo& wsi) { const u32 wii_language = static_cast(StartUp.GetLanguageAdjustedForRegion(true, StartUp.m_region)); - Config::SetCurrent(Config::SYSCONF_LANGUAGE, wii_language); + if (wii_language != Config::Get(Config::SYSCONF_LANGUAGE)) + Config::SetCurrent(Config::SYSCONF_LANGUAGE, wii_language); const u8 country_code = static_cast(Config::Get(Config::SYSCONF_COUNTRY)); if (StartUp.m_region != DiscIO::SysConfCountryToRegion(country_code)) @@ -429,7 +430,7 @@ bool BootCore(std::unique_ptr boot, const WindowSystemInfo& wsi) // Some NTSC Wii games such as Doc Louis's Punch-Out!! and // 1942 (Virtual Console) crash if the PAL60 option is enabled - if (StartUp.bWii && DiscIO::IsNTSC(StartUp.m_region)) + if (StartUp.bWii && DiscIO::IsNTSC(StartUp.m_region) && Config::Get(Config::SYSCONF_PAL60)) Config::SetCurrent(Config::SYSCONF_PAL60, false); // Ensure any new settings are written to the SYSCONF