Skip to content

Commit

Permalink
Fix special case for XFB & update EFB to match desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmabeta committed Jan 23, 2016
1 parent cee84d8 commit 2190496
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 78 deletions.
Expand Up @@ -126,7 +126,7 @@ public void onBooleanClick(CheckBoxSetting item, int position, boolean checked)

if (setting != null)
{
mView.addSetting(setting);
mView.putSetting(setting);
}
}

Expand Down Expand Up @@ -187,10 +187,18 @@ public void onClick(DialogInterface dialog, int which)

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();
Expand All @@ -214,15 +222,15 @@ else if (mClickedItem instanceof SliderSetting)
FloatSetting setting = sliderSetting.setSelectedValue(value);
if (setting != null)
{
mView.addSetting(setting);
mView.putSetting(setting);
}
}
else
{
IntSetting setting = sliderSetting.setSelectedValue(mSeekbarProgress);
if (setting != null)
{
mView.addSetting(setting);
mView.putSetting(setting);
}
}
}
Expand Down Expand Up @@ -296,4 +304,31 @@ private int getSelectionForSingleChoiceValue(SingleChoiceSetting item)

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);
}
}
Expand Up @@ -119,9 +119,9 @@ public void showToastMessage(String message)
}

@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";
Expand All @@ -138,5 +138,4 @@ public static Fragment newInstance(String menuTag)
fragment.setArguments(arguments);
return fragment;
}

}
Expand Up @@ -54,7 +54,7 @@ public void onAttach()
}
}

public void addSetting(Setting setting)
public void putSetting(Setting setting)
{
mSettings.get(setting.getSection()).putSetting(setting.getKey(), setting);
}
Expand Down Expand Up @@ -198,12 +198,11 @@ private void addEnhanceSettings(ArrayList<SettingsItem> sl)

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);
Expand All @@ -212,62 +211,27 @@ private void addHackSettings(ArrayList<SettingsItem> sl)
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)
{
Expand All @@ -290,3 +254,4 @@ else if (!usingRealXFB)
return xfbValue;
}
}

Expand Up @@ -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);
}
Expand Up @@ -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()
{
Expand Down
24 changes: 5 additions & 19 deletions Source/Android/app/src/main/res/values/arrays.xml
Expand Up @@ -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>
Expand All @@ -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">
Expand Down
7 changes: 2 additions & 5 deletions Source/Android/app/src/main/res/values/strings.xml
Expand Up @@ -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>
Expand Down

0 comments on commit 2190496

Please sign in to comment.