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 d4bb8accce..4d26c39aa8 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 @@ -11,6 +11,7 @@ public enum BooleanSetting implements AbstractBooleanSetting MAIN_DSP_HLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "DSPHLE", true), MAIN_FASTMEM(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "Fastmem", true), MAIN_CPU_THREAD(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "CPUThread", true), + MAIN_SYNC_ON_SKIP_IDLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SyncOnSkipIdle", true), MAIN_OVERRIDE_REGION_SETTINGS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "OverrideRegionSettings", false), MAIN_AUDIO_STRETCH(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AudioStretch", false), @@ -19,6 +20,7 @@ public enum BooleanSetting implements AbstractBooleanSetting "WiimoteContinuousScanning", false), MAIN_WIIMOTE_ENABLE_SPEAKER(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "WiimoteEnableSpeaker", false), + MAIN_SYNC_GPU(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SyncGPU", false), MAIN_OVERCLOCK_ENABLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "OverclockEnable", false), MAIN_AUTO_DISC_CHANGE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AutoDiscChange", false), MAIN_ALLOW_SD_WRITES(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "WiiSDCardAllowWrites", 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 3ff8e963c3..bbfccfd2e8 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 @@ -434,6 +434,71 @@ public final class SettingsFragmentPresenter private void addAdvancedSettings(ArrayList sl) { + final int SYNC_GPU_NEVER = 0; + final int SYNC_GPU_ON_IDLE_SKIP = 1; + final int SYNC_GPU_ALWAYS = 2; + + AbstractIntSetting synchronizeGpuThread = new AbstractIntSetting() + { + @Override + public int getInt(Settings settings) + { + if (BooleanSetting.MAIN_SYNC_GPU.getBoolean(settings)) + { + return SYNC_GPU_ALWAYS; + } + else + { + boolean syncOnSkipIdle = BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.getBoolean(settings); + return syncOnSkipIdle ? SYNC_GPU_ON_IDLE_SKIP : SYNC_GPU_NEVER; + } + } + + @Override + public void setInt(Settings settings, int newValue) + { + switch (newValue) + { + case SYNC_GPU_NEVER: + BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.setBoolean(settings, false); + BooleanSetting.MAIN_SYNC_GPU.setBoolean(settings, false); + break; + + case SYNC_GPU_ON_IDLE_SKIP: + BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.setBoolean(settings, true); + BooleanSetting.MAIN_SYNC_GPU.setBoolean(settings, false); + break; + + case SYNC_GPU_ALWAYS: + BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.setBoolean(settings, true); + BooleanSetting.MAIN_SYNC_GPU.setBoolean(settings, true); + break; + } + } + + @Override + public boolean isOverridden(Settings settings) + { + return BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.isOverridden(settings) || + BooleanSetting.MAIN_SYNC_GPU.isOverridden(settings); + } + + @Override + public boolean isRuntimeEditable() + { + return BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.isRuntimeEditable() && + BooleanSetting.MAIN_SYNC_GPU.isRuntimeEditable(); + } + + @Override + public boolean delete(Settings settings) + { + // Not short circuiting + return BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.delete(settings) & + BooleanSetting.MAIN_SYNC_GPU.delete(settings); + } + }; + // TODO: Having different emuCoresEntries/emuCoresValues for each architecture is annoying. // The proper solution would be to have one set of entries and one set of values // and exclude the values that aren't present in PowerPC::AvailableCPUCores(). @@ -461,6 +526,9 @@ public final class SettingsFragmentPresenter R.string.overclock_enable_description)); sl.add(new PercentSliderSetting(FloatSetting.MAIN_OVERCLOCK, R.string.overclock_title, R.string.overclock_title_description, 0, 400, "%")); + sl.add(new SingleChoiceSetting(synchronizeGpuThread, R.string.synchronize_gpu_thread, + R.string.synchronize_gpu_thread_description, R.array.synchronizeGpuThreadEntries, + R.array.synchronizeGpuThreadValues)); } private void addGcPadSettings(ArrayList sl) diff --git a/Source/Android/app/src/main/res/values/arrays.xml b/Source/Android/app/src/main/res/values/arrays.xml index c08a518e5f..b8371321ec 100644 --- a/Source/Android/app/src/main/res/values/arrays.xml +++ b/Source/Android/app/src/main/res/values/arrays.xml @@ -447,6 +447,17 @@ -1 + + Never + On Idle Skipping + Always + + + 0 + 1 + 2 + + Use Device Sensors (With Pointer Emulation) Use Device Sensors (Without Pointer Emulation) diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 95d74afdb6..0b939e0faa 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -286,6 +286,8 @@ Higher values can make variable-framerate games run at a higher framerate, requiring a powerful device. Lower values make games run at a lower framerate, increasing emulation speed, but reducing the emulated console\'s performance. Emulated CPU Clock Speed Adjusts the emulated CPU\'s clock rate if \"Override Emulated CPU Clock Speed\" is enabled. + Synchronize GPU Thread + Synchronizing the GPU thread reduces the risk of games crashing or becoming unstable with dual core enabled, but can also reduce the performance gain of dual core. If unsure, select \"On Idle Skipping\". Selecting \"Never\" is risky and not recommended! Log