Merge pull request #9614 from JosJuice/okay-fine-i-give-in

Android: Add "Synchronize GPU Thread" setting (SyncOnSkipIdle/SyncGPU)
This commit is contained in:
LC 2021-03-28 09:29:08 -04:00 committed by GitHub
commit 7a16231e98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 83 additions and 0 deletions

View File

@ -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",

View File

@ -434,6 +434,71 @@ public final class SettingsFragmentPresenter
private void addAdvancedSettings(ArrayList<SettingsItem> 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<SettingsItem> sl)

View File

@ -447,6 +447,17 @@
<item>-1</item>
</integer-array>
<string-array name="synchronizeGpuThreadEntries">
<item>Never</item>
<item>On Idle Skipping</item>
<item>Always</item>
</string-array>
<integer-array name="synchronizeGpuThreadValues">
<item>0</item>
<item>1</item>
<item>2</item>
</integer-array>
<string-array name="motionControlsEntries">
<item>Use Device Sensors (With Pointer Emulation)</item>
<item>Use Device Sensors (Without Pointer Emulation)</item>

View File

@ -286,6 +286,8 @@
<string name="overclock_enable_description">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.</string>
<string name="overclock_title">Emulated CPU Clock Speed</string>
<string name="overclock_title_description">Adjusts the emulated CPU\'s clock rate if \"Override Emulated CPU Clock Speed\" is enabled.</string>
<string name="synchronize_gpu_thread">Synchronize GPU Thread</string>
<string name="synchronize_gpu_thread_description">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!</string>
<!-- Log Configuration -->
<string name="log_submenu">Log</string>