From b924445e4894499a315769852fe5df7f747b739a Mon Sep 17 00:00:00 2001 From: mahdihijazi Date: Sun, 28 Jan 2018 01:51:42 +0100 Subject: [PATCH] Android: Support Post Processing Shaders --- .../model/settings/view/SettingsItem.java | 1 + .../view/StringSingleChoiceSetting.java | 97 +++++++++++++++++++ .../DirectoryInitializationService.java | 16 +++ .../ui/settings/SettingsAdapter.java | 26 +++++ .../settings/SettingsFragmentPresenter.java | 54 ++++++++++- .../viewholder/SingleChoiceViewHolder.java | 14 ++- .../app/src/main/res/values/strings.xml | 2 + 7 files changed, 204 insertions(+), 6 deletions(-) create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/settings/view/StringSingleChoiceSetting.java diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/settings/view/SettingsItem.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/settings/view/SettingsItem.java index 094e8be91d..95a926038a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/settings/view/SettingsItem.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/settings/view/SettingsItem.java @@ -17,6 +17,7 @@ public abstract class SettingsItem public static final int TYPE_SLIDER = 3; public static final int TYPE_SUBMENU = 4; public static final int TYPE_INPUT_BINDING = 5; + public static final int TYPE_STRING_SINGLE_CHOICE = 6; private String mKey; private String mSection; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/settings/view/StringSingleChoiceSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/settings/view/StringSingleChoiceSetting.java new file mode 100644 index 0000000000..161ee0f567 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/settings/view/StringSingleChoiceSetting.java @@ -0,0 +1,97 @@ +package org.dolphinemu.dolphinemu.model.settings.view; + +import org.dolphinemu.dolphinemu.model.settings.Setting; +import org.dolphinemu.dolphinemu.model.settings.StringSetting; + +public class StringSingleChoiceSetting extends SettingsItem +{ + private String mDefaultValue; + + private String[] mChoicesId; + private String[] mValuesId; + + public StringSingleChoiceSetting(String key, String section, int file, int titleId, int descriptionId, String[] choicesId, String[] valuesId, String defaultValue, Setting setting) + { + super(key, section, file, setting, titleId, descriptionId); + mValuesId = valuesId; + mChoicesId = choicesId; + mDefaultValue = defaultValue; + } + + public String[] getChoicesId() + { + return mChoicesId; + } + + public String[] getValuesId() + { + return mValuesId; + } + + public String getValueAt(int index) + { + if (mValuesId == null) + return null; + + if (index >= 0 && index < mValuesId.length) + { + return mValuesId[index]; + } + + return ""; + } + + public String getSelectedValue() + { + if (getSetting() != null) + { + StringSetting setting = (StringSetting) getSetting(); + return setting.getValue(); + } + else + { + return mDefaultValue; + } + } + + public int getSelectValueIndex() { + String selectedValue = getSelectedValue(); + for(int i=0;i 0) + { + name = name.substring(0, extensionIndex); + } + result[i+1] = name; + } + + return result; + } + } + catch (Exception ex) + { + Log.debug("[Settings] Unable to find shader files"); + // return empty list + } + + return new String[]{}; + } + private void addHackSettings(ArrayList sl) { boolean skipEFBValue = getInvertedBooleanValue(SettingsFile.SETTINGS_GFX, SettingsFile.SECTION_GFX_HACKS, SettingsFile.KEY_SKIP_EFB, false); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/viewholder/SingleChoiceViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/viewholder/SingleChoiceViewHolder.java index add1b76637..c44d64b79b 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/viewholder/SingleChoiceViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/viewholder/SingleChoiceViewHolder.java @@ -6,11 +6,12 @@ import android.widget.TextView; import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.model.settings.view.SettingsItem; import org.dolphinemu.dolphinemu.model.settings.view.SingleChoiceSetting; +import org.dolphinemu.dolphinemu.model.settings.view.StringSingleChoiceSetting; import org.dolphinemu.dolphinemu.ui.settings.SettingsAdapter; public final class SingleChoiceViewHolder extends SettingViewHolder { - private SingleChoiceSetting mItem; + private SettingsItem mItem; private TextView mTextSettingName; private TextView mTextSettingDescription; @@ -30,7 +31,7 @@ public final class SingleChoiceViewHolder extends SettingViewHolder @Override public void bind(SettingsItem item) { - mItem = (SingleChoiceSetting) item; + mItem = item; mTextSettingName.setText(item.getNameId()); @@ -43,6 +44,13 @@ public final class SingleChoiceViewHolder extends SettingViewHolder @Override public void onClick(View clicked) { - getAdapter().onSingleChoiceClick(mItem); + if (mItem instanceof SingleChoiceSetting) + { + getAdapter().onSingleChoiceClick((SingleChoiceSetting) mItem); + } + else if (mItem instanceof StringSingleChoiceSetting) + { + getAdapter().onStringSingleChoiceClick((StringSingleChoiceSetting) mItem); + } } } diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 9055965d97..23206afdd1 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -152,6 +152,8 @@ Reduces the amount of aliasing caused by rasterizing 3D graphics. This makes the rendered picture look less blocky. Heavily decreases emulation speed and sometimes causes issues. Anisotropic Filtering Enhances visual quality of textures that are at oblique viewing angles. Might cause issues in a small number of games. + Post-Processing Effect + Apply a post-processing effect after finishing a frame Post Processing Shader Apply a post-processing effect after finishing a frame. Scaled EFB Copy