Fix special case for XFB & update EFB to match desktop

This commit is contained in:
sigmabeta 2016-01-23 11:51:24 -05:00
parent cee84d8e90
commit 2190496ce8
7 changed files with 59 additions and 78 deletions

View File

@ -126,7 +126,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
if (setting != null)
{
mView.addSetting(setting);
mView.putSetting(setting);
}
}
@ -187,10 +187,18 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
int value = getValueForSingleChoiceSelection(scSetting, which);
// Get the backing Setting, which may be null (if for example it was missing from the file)
IntSetting setting = scSetting.setSelectedValue(value);
if (setting != null)
{
mView.addSetting(setting);
mView.putSetting(setting);
}
else
{
if (scSetting.getKey().equals(SettingsFile.KEY_XFB_METHOD))
{
putXfbSetting(which);
}
}
closeDialog();
@ -214,7 +222,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
FloatSetting setting = sliderSetting.setSelectedValue(value);
if (setting != null)
{
mView.addSetting(setting);
mView.putSetting(setting);
}
}
else
@ -222,7 +230,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
IntSetting setting = sliderSetting.setSelectedValue(mSeekbarProgress);
if (setting != null)
{
mView.addSetting(setting);
mView.putSetting(setting);
}
}
}
@ -296,4 +304,31 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
return -1;
}
public void putXfbSetting(int which)
{
BooleanSetting xfbEnable = null;
BooleanSetting xfbReal = null;
switch (which)
{
case 0:
xfbEnable = new BooleanSetting(SettingsFile.KEY_XFB, SettingsFile.SECTION_GFX_SETTINGS, false);
xfbReal = new BooleanSetting(SettingsFile.KEY_XFB_REAL, SettingsFile.SECTION_GFX_SETTINGS, false);
break;
case 1:
xfbEnable = new BooleanSetting(SettingsFile.KEY_XFB, SettingsFile.SECTION_GFX_SETTINGS, true);
xfbReal = new BooleanSetting(SettingsFile.KEY_XFB_REAL, SettingsFile.SECTION_GFX_SETTINGS, false);
break;
case 2:
xfbEnable = new BooleanSetting(SettingsFile.KEY_XFB, SettingsFile.SECTION_GFX_SETTINGS, true);
xfbReal = new BooleanSetting(SettingsFile.KEY_XFB_REAL, SettingsFile.SECTION_GFX_SETTINGS, true);
break;
}
mView.putSetting(xfbEnable);
mView.putSetting(xfbReal);
}
}

View File

@ -119,9 +119,9 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
}
@Override
public void addSetting(Setting setting)
public void putSetting(Setting setting)
{
mPresenter.addSetting(setting);
mPresenter.putSetting(setting);
}
public static final String FRAGMENT_TAG = BuildConfig.APPLICATION_ID + ".fragment.settings";
@ -138,5 +138,4 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
fragment.setArguments(arguments);
return fragment;
}
}

View File

@ -54,7 +54,7 @@ public final class SettingsFragmentPresenter
}
}
public void addSetting(Setting setting)
public void putSetting(Setting setting)
{
mSettings.get(setting.getSection()).putSetting(setting.getKey(), setting);
}
@ -198,12 +198,11 @@ public final class SettingsFragmentPresenter
private void addHackSettings(ArrayList<SettingsItem> sl)
{
int efbCopyMethodValue = getEfbCopyMethodValue();
int xfbValue = getXfbValue();
Setting skipEFB = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_SKIP_EFB);
Setting ignoreFormat = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_IGNORE_FORMAT);
IntSetting efbCopyMethod = new IntSetting(SettingsFile.KEY_EFB_COPY_METHOD, null, efbCopyMethodValue);
Setting efbToTexture = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_EFB_TEXTURE);
Setting texCacheAccuracy = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_TEXCACHE_ACCURACY);
IntSetting xfb = new IntSetting(SettingsFile.KEY_XFB, SettingsFile.SECTION_GFX_HACKS, xfbValue);
Setting fastDepth = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_FAST_DEPTH);
@ -212,62 +211,27 @@ public final class SettingsFragmentPresenter
sl.add(new HeaderSetting(null, null, R.string.embedded_frame_buffer, 0));
sl.add(new CheckBoxSetting(SettingsFile.KEY_SKIP_EFB, SettingsFile.SECTION_GFX_HACKS, R.string.skip_efb_access, R.string.skip_efb_access_descrip, false, skipEFB));
sl.add(new CheckBoxSetting(SettingsFile.KEY_IGNORE_FORMAT, SettingsFile.SECTION_GFX_HACKS, R.string.ignore_format_changes, R.string.ignore_format_changes_descrip, false, ignoreFormat));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_EFB_COPY_METHOD, SettingsFile.SECTION_GFX_HACKS, R.string.efb_copy_method, R.string.efb_copy_method_descrip, R.array.efbCopyMethodEntries, R.array.efbCopyMethodValues, 1, efbCopyMethod));
sl.add(new CheckBoxSetting(SettingsFile.KEY_EFB_TEXTURE, SettingsFile.SECTION_GFX_HACKS, R.string.efb_copy_method, R.string.efb_copy_method_descrip, true, efbToTexture));
sl.add(new HeaderSetting(null, null, R.string.texture_cache, 0));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_TEXCACHE_ACCURACY, SettingsFile.SECTION_GFX_HACKS, R.string.texture_cache_accuracy, R.string.texture_cache_accuracy_descrip, R.array.textureCacheAccuracyEntries, R.array.textureCacheAccuracyValues, 128, texCacheAccuracy));
sl.add(new HeaderSetting(null, null, R.string.external_frame_buffer, 0));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_XFB, SettingsFile.SECTION_GFX_HACKS, R.string.external_frame_buffer, R.string.external_frame_buffer_descrip, R.array.externalFrameBufferEntries, R.array.externalFrameBufferValues, 0, xfb));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_XFB_METHOD, SettingsFile.SECTION_GFX_HACKS, R.string.external_frame_buffer, R.string.external_frame_buffer_descrip, R.array.externalFrameBufferEntries, R.array.externalFrameBufferValues, 0, xfb));
sl.add(new HeaderSetting(null, null, R.string.other, 0));
sl.add(new CheckBoxSetting(SettingsFile.KEY_FAST_DEPTH, SettingsFile.SECTION_GFX_HACKS, R.string.fast_depth_calculation, R.string.fast_depth_calculation_descrip, true, fastDepth));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_ASPECT_RATIO, SettingsFile.SECTION_GFX_HACKS, R.string.aspect_ratio, R.string.aspect_ratio_descrip, R.array.aspectRatioEntries, R.array.aspectRatioValues, 0, aspectRatio));
}
private int getEfbCopyMethodValue()
{
int efbCopyMethodValue;
try
{
boolean efbCopyOn = ((BooleanSetting) mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_EFB_COPY)).getValue();
boolean efbCopyTexture = ((BooleanSetting) mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_EFB_TEXTURE)).getValue();
boolean efbCopyCache = ((BooleanSetting) mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_EFB_CACHE)).getValue();
if (!efbCopyOn)
{
efbCopyMethodValue = 0;
}
else if (efbCopyTexture)
{
efbCopyMethodValue = 1;
}
else if (!efbCopyCache)
{
efbCopyMethodValue = 2;
}
else
{
efbCopyMethodValue = 3;
}
}
catch (NullPointerException ex)
{
efbCopyMethodValue = 1;
}
return efbCopyMethodValue;
}
private int getXfbValue()
{
int xfbValue;
try
{
boolean usingXFB = ((BooleanSetting) mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_XFB)).getValue();
boolean usingRealXFB = ((BooleanSetting) mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_XFB_REAL)).getValue();
boolean usingXFB = ((BooleanSetting) mSettings.get(SettingsFile.SECTION_GFX_SETTINGS).getSetting(SettingsFile.KEY_XFB)).getValue();
boolean usingRealXFB = ((BooleanSetting) mSettings.get(SettingsFile.SECTION_GFX_SETTINGS).getSetting(SettingsFile.KEY_XFB_REAL)).getValue();
if (!usingXFB)
{
@ -290,3 +254,4 @@ public final class SettingsFragmentPresenter
return xfbValue;
}
}

View File

@ -60,10 +60,9 @@ public interface SettingsFragmentView
void showToastMessage(String message);
/**
* Have the fragment add a setting to the Hashmap. Useful if the setting
* was missing from the .ini file, but included in the UI.
* Have the fragment add a setting to the Hashmap.
*
* @param setting The (possibly missing) new setting.
* @param setting The (possibly previously missing) new setting.
*/
void addSetting(Setting setting);
void putSetting(Setting setting);
}

View File

@ -74,7 +74,7 @@ public final class SettingsFile
public static final String KEY_ASPECT_RATIO= "AspectRatio";
// Internal only, not actually found in settings file.
public static final String KEY_EFB_COPY_METHOD = "EFBCopyMethod";
public static final String KEY_XFB_METHOD = "XFBMethod";
private SettingsFile()
{

View File

@ -71,20 +71,6 @@
<item>Turntable</item>
</string-array>
<!-- EFB Copy Method Preference -->
<string-array name="efbCopyMethodEntries" translatable="false">
<item>@string/disabled</item>
<item>@string/efb_copy_texture</item>
<item>@string/efb_copy_ram_uncached</item>
<item>@string/efb_copy_ram_cached</item>
</string-array>
<string-array name="efbCopyMethodValues" translatable="false">
<item>Off</item>
<item>Texture</item>
<item>RAM (cached)</item>
<item>RAM (uncached)</item>
</string-array>
<!-- Texture Cache Accuracy Preference -->
<string-array name="textureCacheAccuracyEntries" translatable="false">
<item>@string/texture_cache_accuracy_low</item>
@ -103,11 +89,11 @@
<item>@string/external_frame_buffer_virtual</item>
<item>@string/external_frame_buffer_real</item>
</string-array>
<string-array name="externalFrameBufferValues" translatable="false">
<item>Disabled</item>
<item>Virtual</item>
<item>Real</item>
</string-array>
<integer-array name="externalFrameBufferValues" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</integer-array>
<!-- Internal Resolution Preference -->
<string-array name="internalResolutionEntries" translatable="false">

View File

@ -286,11 +286,8 @@
<string name="skip_efb_access_descrip">Ignore any requests from the CPU to read/write to the EFB.</string>
<string name="ignore_format_changes">Ignore Format Changes</string>
<string name="ignore_format_changes_descrip">Ignore any changes to the EFB format.</string>
<string name="efb_copy_method">EFB Copy Method</string>
<string name="efb_copy_method_descrip">Determines how EFB copies will be emulated.</string>
<string name="efb_copy_texture">Texture</string>
<string name="efb_copy_ram_uncached">RAM (uncached)</string>
<string name="efb_copy_ram_cached">RAM (cached)</string>
<string name="efb_copy_method">Store EFB Copies to Texture Only</string>
<string name="efb_copy_method_descrip">Stores EFB Copies exclusively on the GPU, bypassing system memory. Causes graphical defects in a small number of games. If unsure, leave this checked.</string>
<string name="texture_cache">Texture Cache</string>
<string name="texture_cache_accuracy">Texture Cache Accuracy</string>
<string name="texture_cache_accuracy_descrip">The safer the selection, the less likely the emulator will be missing any texture updates from RAM.</string>