Implement video settings + support for missing files / settings

This commit is contained in:
sigmabeta 2016-01-21 17:36:48 -05:00
parent c8e4008b83
commit d90dce6d12
42 changed files with 514 additions and 5027 deletions

View File

@ -58,7 +58,7 @@
<activity
android:name=".ui.settings.SettingsActivity"
android:theme="@style/DolphinSettingsGamecube"
android:label="@string/grid_menu_settings"/>
android:label="@string/grid_menu_core_settings"/>
<activity
android:name=".activities.EmulationActivity"

View File

@ -4,7 +4,7 @@ public final class BooleanSetting extends Setting
{
private boolean mValue;
public BooleanSetting(String key, SettingSection section, boolean value)
public BooleanSetting(String key, String section, boolean value)
{
super(key, section);
mValue = value;

View File

@ -4,7 +4,7 @@ public final class FloatSetting extends Setting
{
private float mValue;
public FloatSetting(String key, SettingSection section, float value)
public FloatSetting(String key, String section, float value)
{
super(key, section);
mValue = value;

View File

@ -4,7 +4,7 @@ public final class IntSetting extends Setting
{
private int mValue;
public IntSetting(String key, SettingSection section, int value)
public IntSetting(String key, String section, int value)
{
super(key, section);
mValue = value;

View File

@ -3,10 +3,9 @@ package org.dolphinemu.dolphinemu.model.settings;
public abstract class Setting
{
private String mKey;
private String mSection;
private SettingSection mSection;
public Setting(String key, SettingSection section)
public Setting(String key, String section)
{
mKey = key;
mSection = section;
@ -17,7 +16,7 @@ public abstract class Setting
return mKey;
}
public SettingSection getSection()
public String getSection()
{
return mSection;
}

View File

@ -4,7 +4,7 @@ public final class StringSetting extends Setting
{
private String mValue;
public StringSetting(String key, SettingSection section, String value)
public StringSetting(String key, String section, String value)
{
super(key, section);
mValue = value;

View File

@ -6,21 +6,46 @@ import org.dolphinemu.dolphinemu.model.settings.Setting;
public class CheckBoxSetting extends SettingsItem
{
public CheckBoxSetting(String key, Setting setting, int titleId, int descriptionId)
private boolean mDefaultValue;
public CheckBoxSetting(String key, String section, int titleId, int descriptionId, boolean defaultValue, Setting setting)
{
super(key, setting, titleId, descriptionId);
super(key, section, setting, titleId, descriptionId);
mDefaultValue = defaultValue;
}
public boolean isChecked()
{
if (getSetting() == null)
{
return mDefaultValue;
}
BooleanSetting setting = (BooleanSetting) getSetting();
return setting.getValue();
}
public void setChecked(boolean checked)
/**
* Write a value to the backing boolean. If that boolean was previously null,
* initializes a new one and returns it, so it can be added to the Hashmap.
*
* @param checked Pretty self explanatory.
* @return null if overwritten successfully; otherwise, a newly created BooleanSetting.
*/
public BooleanSetting setChecked(boolean checked)
{
BooleanSetting setting = (BooleanSetting) getSetting();
setting.setValue(checked);
if (getSetting() == null)
{
BooleanSetting setting = new BooleanSetting(getKey(), getSection(), checked);
setSetting(setting);
return setting;
}
else
{
BooleanSetting setting = (BooleanSetting) getSetting();
setting.setValue(checked);
return null;
}
}
@Override

View File

@ -7,7 +7,7 @@ public class HeaderSetting extends SettingsItem
{
public HeaderSetting(String key, Setting setting, int titleId, int descriptionId)
{
super(key, setting, titleId, descriptionId);
super(key, null, setting, titleId, descriptionId);
}
@Override

View File

@ -11,14 +11,17 @@ public abstract class SettingsItem
public static final int TYPE_SUBMENU = 4;
private String mKey;
private String mSection;
private Setting mSetting;
private int mTitleId;
private int mDescriptionId;
public SettingsItem(String key, Setting setting, int titleId, int descriptionId)
public SettingsItem(String key, String section, Setting setting, int titleId, int descriptionId)
{
mKey = key;
mSection = section;
mSetting = setting;
mTitleId = titleId;
mDescriptionId = descriptionId;
@ -29,11 +32,21 @@ public abstract class SettingsItem
return mKey;
}
public String getSection()
{
return mSection;
}
public Setting getSetting()
{
return mSetting;
}
public void setSetting(Setting setting)
{
mSetting = setting;
}
public int getNameId()
{
return mTitleId;

View File

@ -1,18 +1,22 @@
package org.dolphinemu.dolphinemu.model.settings.view;
import org.dolphinemu.dolphinemu.model.settings.IntSetting;
import org.dolphinemu.dolphinemu.model.settings.Setting;
public class SingleChoiceSetting extends SettingsItem
{
private int mDefaultValue;
private int mChoicesId;
private int mValuesId;
public SingleChoiceSetting(String key, Setting setting, int titleId, int descriptionId, int choicesId, int valuesId)
public SingleChoiceSetting(String key, String section, int titleId, int descriptionId, int choicesId, int valuesId, int defaultValue, Setting setting)
{
super(key, setting, titleId, descriptionId);
mChoicesId = choicesId;
super(key, section, setting, titleId, descriptionId);
mValuesId = valuesId;
mChoicesId = choicesId;
mDefaultValue = defaultValue;
}
public int getChoicesId()
@ -27,14 +31,38 @@ public class SingleChoiceSetting extends SettingsItem
public int getSelectedValue()
{
IntSetting setting = (IntSetting) getSetting();
return setting.getValue();
if (getSetting() != null)
{
IntSetting setting = (IntSetting) getSetting();
return setting.getValue();
}
else
{
return mDefaultValue;
}
}
public void setSelectedValue(int selection)
/**
* Write a value to the backing int. If that int was previously null,
* initializes a new one and returns it, so it can be added to the Hashmap.
*
* @param selection New value of the int.
* @return null if overwritten successfully otherwise; a newly created IntSetting.
*/
public IntSetting setSelectedValue(int selection)
{
IntSetting setting = (IntSetting) getSetting();
setting.setValue(selection);
if (getSetting() == null)
{
IntSetting setting = new IntSetting(getKey(), getSection(), selection);
setSetting(setting);
return setting;
}
else
{
IntSetting setting = (IntSetting) getSetting();
setting.setValue(selection);
return null;
}
}
@Override

View File

@ -9,14 +9,16 @@ import org.dolphinemu.dolphinemu.utils.SettingsFile;
public class SliderSetting extends SettingsItem
{
private int mMax;
private int mDefaultValue;
private String mUnits;
public SliderSetting(String key, Setting setting, int titleId, int descriptionId, int max, String units)
public SliderSetting(String key, String section, int titleId, int descriptionId, int max, String units, int defaultValue, Setting setting)
{
super(key, setting, titleId, descriptionId);
super(key, section, setting, titleId, descriptionId);
mMax = max;
mUnits = units;
mDefaultValue = defaultValue;
}
public int getMax()
@ -28,6 +30,11 @@ public class SliderSetting extends SettingsItem
{
Setting setting = getSetting();
if (setting == null)
{
return mDefaultValue;
}
if (setting instanceof IntSetting)
{
IntSetting intSetting = (IntSetting) setting;
@ -52,16 +59,50 @@ public class SliderSetting extends SettingsItem
}
}
public void setSelectedValue(int selection)
/**
* Write a value to the backing int. If that int was previously null,
* initializes a new one and returns it, so it can be added to the Hashmap.
*
* @param selection New value of the int.
* @return null if overwritten successfully otherwise; a newly created IntSetting.
*/
public IntSetting setSelectedValue(int selection)
{
IntSetting setting = (IntSetting) getSetting();
setting.setValue(selection);
if (getSetting() == null)
{
IntSetting setting = new IntSetting(getKey(), getSection(), selection);
setSetting(setting);
return setting;
}
else
{
IntSetting setting = (IntSetting) getSetting();
setting.setValue(selection);
return null;
}
}
public void setSelectedValue(float selection)
/**
* Write a value to the backing float. If that float was previously null,
* initializes a new one and returns it, so it can be added to the Hashmap.
*
* @param selection New value of the float.
* @return null if overwritten successfully otherwise; a newly created FloatSetting.
*/
public FloatSetting setSelectedValue(float selection)
{
FloatSetting setting = (FloatSetting) getSetting();
setting.setValue(selection);
if (getSetting() == null)
{
FloatSetting setting = new FloatSetting(getKey(), getSection(), selection);
setSetting(setting);
return setting;
}
else
{
FloatSetting setting = (FloatSetting) getSetting();
setting.setValue(selection);
return null;
}
}
public String getUnits()

View File

@ -8,7 +8,7 @@ public class SubmenuSetting extends SettingsItem
public SubmenuSetting(String key, Setting setting, int titleId, int descriptionId, String menuKey)
{
super(key, setting, titleId, descriptionId);
super(key, null, setting, titleId, descriptionId);
mMenuKey = menuKey;
}

View File

@ -20,7 +20,6 @@ import org.dolphinemu.dolphinemu.adapters.PlatformPagerAdapter;
import org.dolphinemu.dolphinemu.model.GameProvider;
import org.dolphinemu.dolphinemu.ui.platform.PlatformGamesView;
import org.dolphinemu.dolphinemu.ui.settings.SettingsActivity;
import org.dolphinemu.dolphinemu.utils.SettingsFile;
import org.dolphinemu.dolphinemu.utils.StartupHandler;
/**
@ -116,9 +115,9 @@ public final class MainActivity extends AppCompatActivity implements MainView
}
@Override
public void launchSettingsActivity()
public void launchSettingsActivity(String menuTag)
{
SettingsActivity.launch(this, SettingsFile.FILE_NAME_DOLPHIN);
SettingsActivity.launch(this, menuTag);
}
@Override

View File

@ -7,6 +7,7 @@ import org.dolphinemu.dolphinemu.DolphinApplication;
import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.model.GameDatabase;
import org.dolphinemu.dolphinemu.utils.SettingsFile;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
@ -41,8 +42,12 @@ public final class MainPresenter
{
switch (itemId)
{
case R.id.menu_settings:
mView.launchSettingsActivity();
case R.id.menu_settings_core:
mView.launchSettingsActivity(SettingsFile.FILE_NAME_DOLPHIN);
return true;
case R.id.menu_settings_video:
mView.launchSettingsActivity(SettingsFile.FILE_NAME_GFX);
return true;
case R.id.menu_refresh:

View File

@ -32,7 +32,7 @@ public interface MainView
void refreshFragmentScreenshot(int fragmentPosition);
void launchSettingsActivity();
void launchSettingsActivity(String menuTag);
void launchFileListActivity();

View File

@ -113,7 +113,7 @@ public final class TvMainActivity extends Activity implements MainView
}
@Override
public void launchSettingsActivity()
public void launchSettingsActivity(String menuTag)
{
SettingsActivity.launch(this, SettingsFile.FILE_NAME_DOLPHIN);
}
@ -230,9 +230,13 @@ public final class TvMainActivity extends Activity implements MainView
R.drawable.ic_refresh_tv,
R.string.grid_menu_refresh));
rowItems.add(new TvSettingsItem(R.id.menu_settings,
R.drawable.ic_settings_tv,
R.string.grid_menu_settings));
rowItems.add(new TvSettingsItem(R.id.menu_settings_core,
R.drawable.ic_settings_core_tv,
R.string.grid_menu_core_settings));
rowItems.add(new TvSettingsItem(R.id.menu_settings_video,
R.drawable.ic_settings_graphics_tv,
R.string.grid_menu_core_settings));
rowItems.add(new TvSettingsItem(R.id.button_add_directory,
R.drawable.ic_add_tv,

View File

@ -25,7 +25,7 @@ public class SettingsActivityPresenter
mView = view;
}
public void onCreate(Bundle savedInstanceState, String filename)
public void onCreate(Bundle savedInstanceState, final String filename)
{
mFileName = filename;
@ -35,14 +35,23 @@ public class SettingsActivityPresenter
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<HashMap<String, SettingSection>>()
{
@Override
public void call(HashMap<String, SettingSection> settingsBySection)
{
mSettingsBySection = settingsBySection;
mView.onSettingsFileLoaded(settingsBySection);
}
});
{
@Override
public void call(HashMap<String, SettingSection> settingsBySection)
{
mSettingsBySection = settingsBySection;
mView.onSettingsFileLoaded(settingsBySection);
}
},
new Action1<Throwable>()
{
@Override
public void call(Throwable throwable)
{
Log.error("[SettingsActivityPresenter] Error reading file " + filename + ".ini: "+ throwable.getMessage());
mView.onSettingsFileLoaded(null);
}
});
mView.showSettingsFragment(mFileName, false);
}

View File

@ -9,10 +9,12 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.model.settings.BooleanSetting;
import org.dolphinemu.dolphinemu.model.settings.FloatSetting;
import org.dolphinemu.dolphinemu.model.settings.IntSetting;
import org.dolphinemu.dolphinemu.model.settings.view.CheckBoxSetting;
import org.dolphinemu.dolphinemu.model.settings.view.SettingsItem;
import org.dolphinemu.dolphinemu.model.settings.view.SingleChoiceSetting;
import org.dolphinemu.dolphinemu.model.settings.view.SliderSetting;
@ -117,6 +119,17 @@ public class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolder>
notifyDataSetChanged();
}
public void onBooleanClick(CheckBoxSetting item, int position, boolean checked)
{
BooleanSetting setting = item.setChecked(checked);
notifyItemChanged(position);
if (setting != null)
{
mView.addSetting(setting);
}
}
public void onSingleChoiceClick(SingleChoiceSetting item)
{
mClickedItem = item;
@ -162,7 +175,7 @@ public class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolder>
public void onSubmenuClick(SubmenuSetting item)
{
Toast.makeText(mContext, "Submenu item clicked", Toast.LENGTH_SHORT).show();
mView.loadSubMenu(item.getMenuKey());
}
@Override
@ -174,7 +187,12 @@ public class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolder>
int value = getValueForSingleChoiceSelection(scSetting, which);
scSetting.setSelectedValue(value);
IntSetting setting = scSetting.setSelectedValue(value);
if (setting != null)
{
mView.addSetting(setting);
}
closeDialog();
}
else if (mClickedItem instanceof SliderSetting)
@ -193,11 +211,19 @@ public class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolder>
value = (float) mSeekbarProgress;
}
sliderSetting.setSelectedValue(value);
FloatSetting setting = sliderSetting.setSelectedValue(value);
if (setting != null)
{
mView.addSetting(setting);
}
}
else
{
sliderSetting.setSelectedValue(mSeekbarProgress);
IntSetting setting = sliderSetting.setSelectedValue(mSeekbarProgress);
if (setting != null)
{
mView.addSetting(setting);
}
}
}

View File

@ -12,6 +12,7 @@ import android.view.ViewGroup;
import org.dolphinemu.dolphinemu.BuildConfig;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.model.settings.Setting;
import org.dolphinemu.dolphinemu.model.settings.SettingSection;
import org.dolphinemu.dolphinemu.model.settings.view.SettingsItem;
import org.dolphinemu.dolphinemu.ui.DividerItemDecoration;
@ -22,7 +23,7 @@ import java.util.HashMap;
public final class SettingsFragment extends Fragment implements SettingsFragmentView
{
private SettingsFragmentPresenter mPresenter = new SettingsFragmentPresenter(this);
private SettingsActivityView mView;
private SettingsActivityView mActivity;
private SettingsAdapter mAdapter;
@ -31,7 +32,7 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
{
super.onAttach(context);
mView = (SettingsActivityView) context;
mActivity = (SettingsActivityView) context;
mPresenter.onAttach();
}
@ -76,7 +77,7 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
public void onDetach()
{
super.onDetach();
mView = null;
mActivity = null;
if (mAdapter != null)
{
@ -91,11 +92,11 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
}
@Override
public void passOptionsToActivity(HashMap<String, SettingSection> settings)
public void passSettingsToActivity(HashMap<String, SettingSection> settings)
{
if (mView != null)
if (mActivity != null)
{
mView.setSettings(settings);
mActivity.setSettings(settings);
}
}
@ -105,6 +106,24 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
mAdapter.setSettings(settingsList);
}
@Override
public void loadSubMenu(String menuKey)
{
mActivity.showSettingsFragment(menuKey, true);
}
@Override
public void showToastMessage(String message)
{
mActivity.showToastMessage(message);
}
@Override
public void addSetting(Setting setting)
{
mPresenter.addSetting(setting);
}
public static final String FRAGMENT_TAG = BuildConfig.APPLICATION_ID + ".fragment.settings";
public static final String ARGUMENT_MENU_TAG = FRAGMENT_TAG + ".menu_tag";

View File

@ -1,12 +1,17 @@
package org.dolphinemu.dolphinemu.ui.settings;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.model.settings.BooleanSetting;
import org.dolphinemu.dolphinemu.model.settings.IntSetting;
import org.dolphinemu.dolphinemu.model.settings.Setting;
import org.dolphinemu.dolphinemu.model.settings.SettingSection;
import org.dolphinemu.dolphinemu.model.settings.view.CheckBoxSetting;
import org.dolphinemu.dolphinemu.model.settings.view.HeaderSetting;
import org.dolphinemu.dolphinemu.model.settings.view.SettingsItem;
import org.dolphinemu.dolphinemu.model.settings.view.SingleChoiceSetting;
import org.dolphinemu.dolphinemu.model.settings.view.SliderSetting;
import org.dolphinemu.dolphinemu.model.settings.view.SubmenuSetting;
import org.dolphinemu.dolphinemu.utils.EGLHelper;
import org.dolphinemu.dolphinemu.utils.SettingsFile;
import java.util.ArrayList;
@ -45,23 +50,22 @@ public class SettingsFragmentPresenter
{
if (mSettings != null)
{
mView.passOptionsToActivity(mSettings);
mView.passSettingsToActivity(mSettings);
}
}
public void addSetting(Setting setting)
{
mSettings.get(setting.getSection()).putSetting(setting.getKey(), setting);
}
public void setSettings(HashMap<String, SettingSection> settings)
{
if (mSettingsList == null)
{
if (settings != null)
{
mSettings = settings;
}
mSettings = settings;
if (mSettings != null)
{
loadSettingsList();
}
loadSettingsList();
}
else
{
@ -77,8 +81,23 @@ public class SettingsFragmentPresenter
{
case SettingsFile.FILE_NAME_DOLPHIN:
addCoreSettings(sl);
break;
case SettingsFile.FILE_NAME_GFX:
addGraphicsSettings(sl);
break;
case SettingsFile.SECTION_GFX_ENHANCEMENTS:
addEnhanceSettings(sl);
break;
case SettingsFile.SECTION_GFX_HACKS:
addHackSettings(sl);
break;
default:
mView.showToastMessage("Unimplemented menu.");
return;
}
mSettingsList = sl;
@ -87,16 +106,187 @@ public class SettingsFragmentPresenter
private void addCoreSettings(ArrayList<SettingsItem> sl)
{
Setting cpuCore = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_CPU_CORE);
sl.add(new SingleChoiceSetting(cpuCore.getKey(), cpuCore, R.string.cpu_core, 0, R.array.string_emu_cores, R.array.int_emu_cores));
Setting cpuCore = null;
Setting dualCore = null;
Setting overclockEnable = null;
Setting overclock = null;
Setting dualCore = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_DUAL_CORE);
sl.add(new CheckBoxSetting(dualCore.getKey(), dualCore, R.string.dual_core, R.string.dual_core_descrip));
if (mSettings != null)
{
cpuCore = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_CPU_CORE);
dualCore = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_DUAL_CORE);
overclockEnable = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_ENABLE);
overclock = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_PERCENT);
}
else
{
mSettings = new HashMap<>();
mSettings.put(SettingsFile.SECTION_CORE, new SettingSection(SettingsFile.SECTION_CORE));
Setting overclockEnable = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_ENABLE);
sl.add(new CheckBoxSetting(overclockEnable.getKey(), overclockEnable, R.string.overclock_enable, R.string.overclock_enable_description));
mView.passSettingsToActivity(mSettings);
}
Setting overclock = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_PERCENT);
sl.add(new SliderSetting(overclock.getKey(), overclock, R.string.overclock_title, 0, 400, "%"));
// TODO Set default value for cpuCore based on arch.
sl.add(new SingleChoiceSetting(SettingsFile.KEY_CPU_CORE, SettingsFile.SECTION_CORE, R.string.cpu_core, 0, R.array.string_emu_cores, R.array.int_emu_cores, 4, cpuCore));
sl.add(new CheckBoxSetting(SettingsFile.KEY_DUAL_CORE, SettingsFile.SECTION_CORE, R.string.dual_core, R.string.dual_core_descrip, true, dualCore));
sl.add(new CheckBoxSetting(SettingsFile.KEY_OVERCLOCK_ENABLE, SettingsFile.SECTION_CORE, R.string.overclock_enable, R.string.overclock_enable_description, false, overclockEnable));
sl.add(new SliderSetting(SettingsFile.KEY_OVERCLOCK_PERCENT, SettingsFile.SECTION_CORE, R.string.overclock_title, 0, 400, "%", 100, overclock));
}
private void addGraphicsSettings(ArrayList<SettingsItem> sl)
{
Setting showFps = null;
if (mSettings != null)
{
showFps = mSettings.get(SettingsFile.SECTION_GFX_SETTINGS).getSetting(SettingsFile.KEY_SHOW_FPS);
}
else
{
mSettings = new HashMap<>();
mSettings.put(SettingsFile.SECTION_GFX_SETTINGS, new SettingSection(SettingsFile.SECTION_GFX_SETTINGS));
mSettings.put(SettingsFile.SECTION_GFX_ENHANCEMENTS, new SettingSection(SettingsFile.SECTION_GFX_ENHANCEMENTS));
mSettings.put(SettingsFile.SECTION_GFX_HACKS, new SettingSection(SettingsFile.SECTION_GFX_HACKS));
mView.passSettingsToActivity(mSettings);
}
sl.add(new CheckBoxSetting(SettingsFile.KEY_SHOW_FPS, SettingsFile.SECTION_GFX_SETTINGS, R.string.show_fps, 0, true, showFps));
sl.add(new SubmenuSetting(null, null, R.string.enhancements, 0, SettingsFile.SECTION_GFX_ENHANCEMENTS));
sl.add(new SubmenuSetting(null, null, R.string.hacks, 0, SettingsFile.SECTION_GFX_HACKS));
}
private void addEnhanceSettings(ArrayList<SettingsItem> sl)
{
Setting resolution = mSettings.get(SettingsFile.SECTION_GFX_SETTINGS).getSetting(SettingsFile.KEY_INTERNAL_RES);
Setting fsaa = mSettings.get(SettingsFile.SECTION_GFX_SETTINGS).getSetting(SettingsFile.KEY_FSAA);
Setting anisotropic = mSettings.get(SettingsFile.SECTION_GFX_ENHANCEMENTS).getSetting(SettingsFile.KEY_ANISOTROPY);
Setting efbScaledCopy = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_SCALED_EFB);
Setting perPixel = mSettings.get(SettingsFile.SECTION_GFX_SETTINGS).getSetting(SettingsFile.KEY_PER_PIXEL);
Setting forceFilter = mSettings.get(SettingsFile.SECTION_GFX_ENHANCEMENTS).getSetting(SettingsFile.KEY_FORCE_FILTERING);
Setting disableFog = mSettings.get(SettingsFile.SECTION_GFX_SETTINGS).getSetting(SettingsFile.KEY_DISABLE_FOG);
sl.add(new SingleChoiceSetting(SettingsFile.KEY_INTERNAL_RES, SettingsFile.SECTION_GFX_SETTINGS, R.string.internal_resolution, R.string.internal_resolution_descrip, R.array.internalResolutionEntries, R.array.internalResolutionValues, 0, resolution));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_FSAA, SettingsFile.SECTION_GFX_SETTINGS, R.string.FSAA, R.string.FSAA_descrip, R.array.FSAAEntries, R.array.FSAAValues, 0, fsaa));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_ANISOTROPY, SettingsFile.SECTION_GFX_ENHANCEMENTS, R.string.anisotropic_filtering, R.string.anisotropic_filtering_descrip, R.array.anisotropicFilteringEntries, R.array.anisotropicFilteringValues, 0, anisotropic));
// TODO
// Setting shader = mSettings.get(SettingsFile.SECTION_GFX_ENHANCEMENTS).getSetting(SettingsFile.KEY_POST_SHADER)
// sl.add(new SingleChoiceSetting(.getKey(), , R.string., R.string._descrip, R.array., R.array.));
sl.add(new CheckBoxSetting(SettingsFile.KEY_SCALED_EFB, SettingsFile.SECTION_GFX_HACKS, R.string.scaled_efb_copy, R.string.scaled_efb_copy_descrip, true, efbScaledCopy));
sl.add(new CheckBoxSetting(SettingsFile.KEY_PER_PIXEL, SettingsFile.SECTION_GFX_SETTINGS, R.string.per_pixel_lighting, R.string.per_pixel_lighting_descrip, false, perPixel));
sl.add(new CheckBoxSetting(SettingsFile.KEY_FORCE_FILTERING, SettingsFile.SECTION_GFX_ENHANCEMENTS, R.string.force_texture_filtering, R.string.force_texture_filtering_descrip, false, forceFilter));
sl.add(new CheckBoxSetting(SettingsFile.KEY_DISABLE_FOG, SettingsFile.SECTION_GFX_SETTINGS, R.string.disable_fog, R.string.disable_fog_descrip, false, disableFog));
/*
Check if we support stereo
If we support desktop GL then we must support at least OpenGL 3.2
If we only support OpenGLES then we need both OpenGLES 3.1 and AEP
*/
EGLHelper helper = new EGLHelper(EGLHelper.EGL_OPENGL_ES2_BIT);
if ((helper.supportsOpenGL() && helper.GetVersion() >= 320) ||
(helper.supportsGLES3() && helper.GetVersion() >= 310 && helper.SupportsExtension("GL_ANDROID_extension_pack_es31a")))
{
sl.add(new SubmenuSetting(null, null, R.string.stereoscopy, 0, SettingsFile.SECTION_STEREOSCOPY));
}
}
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 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);
Setting aspectRatio = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_ASPECT_RATIO);
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 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 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();
if (!usingXFB)
{
xfbValue = 0;
}
else if (!usingRealXFB)
{
xfbValue = 1;
}
else
{
xfbValue = 2;
}
}
catch (NullPointerException ex)
{
xfbValue = 0;
}
return xfbValue;
}
}

View File

@ -2,6 +2,7 @@ package org.dolphinemu.dolphinemu.ui.settings;
import android.app.Activity;
import org.dolphinemu.dolphinemu.model.settings.Setting;
import org.dolphinemu.dolphinemu.model.settings.SettingSection;
import org.dolphinemu.dolphinemu.model.settings.view.SettingsItem;
@ -12,9 +13,15 @@ public interface SettingsFragmentView
{
void onSettingsFileLoaded(HashMap<String, SettingSection> settings);
void passOptionsToActivity(HashMap<String, SettingSection> settings);
void passSettingsToActivity(HashMap<String, SettingSection> settings);
void showSettingsList(ArrayList<SettingsItem> settingsList);
Activity getActivity();
void loadSubMenu(String menuKey);
void showToastMessage(String message);
void addSetting(Setting setting);
}

View File

@ -51,7 +51,7 @@ public class CheckBoxSettingViewHolder extends SettingViewHolder
public void onClick(View clicked)
{
mCheckbox.toggle();
mItem.setChecked(mCheckbox.isChecked());
getAdapter().notifyItemChanged(getAdapterPosition());
getAdapter().onBooleanClick(mItem, getAdapterPosition(), mCheckbox.isChecked());
}
}

View File

@ -36,39 +36,43 @@ public final class SettingsFile
public static final String SECTION_GFX_ENHANCEMENTS = "Enhancements";
public static final String SECTION_GFX_HACKS = "Hacks";
public static final String SECTION_STEREOSCOPY = "Stereoscopy";
public static final String KEY_CPU_CORE= "CPUCore";
public static final String KEY_DUAL_CORE= "CPUThread";
public static final String KEY_OVERCLOCK_ENABLE= "OverclockEnable";
public static final String KEY_OVERCLOCK_PERCENT= "Overclock";
public static final String KEY_VIDEO_BACKEND= "GFXBackend";
public static final String KEY_CPU_CORE = "CPUCore";
public static final String KEY_DUAL_CORE = "CPUThread";
public static final String KEY_OVERCLOCK_ENABLE = "OverclockEnable";
public static final String KEY_OVERCLOCK_PERCENT = "Overclock";
public static final String KEY_VIDEO_BACKEND = "GFXBackend";
public static final String KEY_SHOW_FPS= "ShowFPS";
public static final String KEY_INTERNAL_RES= "EFBScale";
public static final String KEY_FSAA= "MSAA";
public static final String KEY_ANISOTROPY= "MaxAnisotropy";
public static final String KEY_POST_SHADER= "PostProcessingShader";
public static final String KEY_SCALED_EFB= "EFBScaledCopy";
public static final String KEY_PER_PIXEL= "EnablePixelLighting";
public static final String KEY_FORCE_FILTERING= "ForceFiltering";
public static final String KEY_DISABLE_FOG= "DisableFog";
public static final String KEY_SHOW_FPS = "ShowFPS";
public static final String KEY_INTERNAL_RES = "EFBScale";
public static final String KEY_FSAA = "MSAA";
public static final String KEY_ANISOTROPY = "MaxAnisotropy";
public static final String KEY_POST_SHADER = "PostProcessingShader";
public static final String KEY_SCALED_EFB = "EFBScaledCopy";
public static final String KEY_PER_PIXEL = "EnablePixelLighting";
public static final String KEY_FORCE_FILTERING = "ForceFiltering";
public static final String KEY_DISABLE_FOG = "DisableFog";
public static final String KEY_STEREO_MODE= "StereoMode";
public static final String KEY_STEREO_DEPTH= "StereoDepth";
public static final String KEY_STEREO_CONV= "StereoConvergencePercentage";
public static final String KEY_STEREO_SWAP= "StereoSwapEyes";
public static final String KEY_STEREO_MODE = "StereoMode";
public static final String KEY_STEREO_DEPTH = "StereoDepth";
public static final String KEY_STEREO_CONV = "StereoConvergencePercentage";
public static final String KEY_STEREO_SWAP = "StereoSwapEyes";
public static final String KEY_SKIP_EFB= "EFBAccessEnable";
public static final String KEY_IGNORE_FORMAT= "EFBEmulateFormatChanges";
public static final String KEY_EFB_COPY= "EFBCopyEnable";
public static final String KEY_EFB_TEXTURE= "EFBToTextureEnable";
public static final String KEY_EFB_CACHE= "EFBCopyCacheEnable";
public static final String KEY_TEXCACHE_ACCURACY= "SafeTextureCacheColorSamples";
public static final String KEY_XFB= "UseXFB";
public static final String KEY_XFB_REAL= "UseRealXFB";
public static final String KEY_SKIP_EFB = "EFBAccessEnable";
public static final String KEY_IGNORE_FORMAT = "EFBEmulateFormatChanges";
public static final String KEY_EFB_COPY = "EFBCopyEnable";
public static final String KEY_EFB_TEXTURE = "EFBToTextureEnable";
public static final String KEY_EFB_CACHE = "EFBCopyCacheEnable";
public static final String KEY_TEXCACHE_ACCURACY = "SafeTextureCacheColorSamples";
public static final String KEY_XFB = "UseXFB";
public static final String KEY_XFB_REAL = "UseRealXFB";
public static final String KEY_FAST_DEPTH= "FastDepthCalc";
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";
private SettingsFile()
{
}
@ -206,7 +210,7 @@ public final class SettingsFile
{
int valueAsInt = Integer.valueOf(value);
return new IntSetting(key, current, valueAsInt);
return new IntSetting(key, current.getName(), valueAsInt);
}
catch (NumberFormatException ex)
{
@ -216,7 +220,7 @@ public final class SettingsFile
{
float valueAsFloat = Float.valueOf(value);
return new FloatSetting(key, current, valueAsFloat);
return new FloatSetting(key, current.getName(), valueAsFloat);
}
catch (NumberFormatException ex)
{
@ -225,11 +229,11 @@ public final class SettingsFile
switch (value)
{
case "True":
return new BooleanSetting(key, current, true);
return new BooleanSetting(key, current.getName(), true);
case "False":
return new BooleanSetting(key, current, false);
return new BooleanSetting(key, current.getName(), false);
default:
return new StringSetting(key, current, value);
return new StringSetting(key, current.getName(), value);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -7,9 +7,14 @@
android:icon="@drawable/ic_refresh"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_settings"
android:title="@string/grid_menu_settings"
android:icon="@drawable/ic_settings"
android:id="@+id/menu_settings_core"
android:title="@string/grid_menu_core_settings"
android:icon="@drawable/ic_settings_core"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_settings_video"
android:title="@string/grid_menu_video_settings"
android:icon="@drawable/ic_settings_graphics"
app:showAsAction="ifRoom"/>
</menu>

View File

@ -20,66 +20,38 @@
<item>@string/interpreter</item>
<item>@string/jit_arm_recompiler</item>
</string-array>
<string-array name="emuCoreValuesARM" translatable="false">
<integer-array name="emuCoreValuesARM" translatable="false">
<item>0</item>
<item>3</item>
</string-array>
</integer-array>
<!-- CPU core selection - ARM64 -->
<string-array name="emuCoreEntriesARM64" translatable="false">
<item>@string/interpreter</item>
<item>@string/jit_arm64_recompiler</item>
</string-array>
<string-array name="emuCoreValuesARM64" translatable="false">
<integer-array name="emuCoreValuesARM64" translatable="false">
<item>0</item>
<item>4</item>
</string-array>
</integer-array>
<!-- CPU core selection - Other -->
<string-array name="emuCoreEntriesOther" translatable="false">
<item>@string/interpreter</item>
</string-array>
<string-array name="emuCoreValuesOther" translatable="false">
<integer-array name="emuCoreValuesOther" translatable="false">
<item>0</item>
</string-array>
</integer-array>
<!-- New UI CPU Core selection - Default -->
<string-array name="string_emu_cores" translatable="false">
<item>@string/interpreter</item>
<item>@string/cached_interpreter</item>
</string-array>
<string-array name="int_emu_cores" translatable="false">
<integer-array name="int_emu_cores" translatable="false">
<item>0</item>
<item>5</item>
</string-array>
<!-- Video Backend Selection - Supports OpenGL ES 3 -->
<string-array name="videoBackendEntriesGLES3" translatable="false">
<item>@string/software_renderer</item>
<item>@string/opengl_es3</item>
</string-array>
<string-array name="videoBackendValuesGLES3" translatable="false">
<item>Software Renderer</item>
<item>OGL</item>
</string-array>
<!-- Video Backend Selection - Supports desktop OpenGL -->
<string-array name="videoBackendEntriesGL" translatable="false">
<item>@string/software_renderer</item>
<item>@string/opengl</item>
</string-array>
<string-array name="videoBackendValuesGL" translatable="false">
<item>Software Renderer</item>
<item>OGL</item>
</string-array>
<!-- Video Backend Selection - No OpenGL ES 3 support -->
<string-array name="videoBackendEntriesNoGLES3" translatable="false">
<item>@string/software_renderer</item>
</string-array>
<string-array name="videoBackendValuesNoGLES3" translatable="false">
<item>Software Renderer</item>
</string-array>
</integer-array>
<!-- Wiimote extensions -->
<string-array name="wiimoteExtEntries" translatable="false">
@ -119,37 +91,11 @@
<item>@string/texture_cache_accuracy_medium</item>
<item>@string/texture_cache_accuracy_high</item>
</string-array>
<string-array name="textureCacheAccuracyValues" translatable="false">
<integer-array name="textureCacheAccuracyValues" translatable="false">
<item>128</item>
<item>512</item>
<item>0</item>
</string-array>
<!-- Analog Modifier ranges -->
<string-array name="analogRangesEntries" translatable="false">
<item>100</item>
<item>90</item>
<item>80</item>
<item>70</item>
<item>60</item>
<item>50</item>
<item>40</item>
<item>30</item>
<item>20</item>
<item>10</item>
</string-array>
<string-array name="analogRangesValues" translatable="false">
<item>100,000000</item>
<item>90,000000</item>
<item>80,000000</item>
<item>70,000000</item>
<item>60,000000</item>
<item>50,000000</item>
<item>40,000000</item>
<item>30,000000</item>
<item>20,000000</item>
<item>10,000000</item>
</string-array>
</integer-array>
<!-- External Frame Buffer Preference -->
<string-array name="externalFrameBufferEntries" translatable="false">
@ -174,7 +120,7 @@
<item>5x Native (3200x2640)</item>
<item>6x Native (3840x3168) for 4K</item>
</string-array>
<string-array name="internalResolutionValues" translatable="false">
<integer-array name="internalResolutionValues" translatable="false">
<item>2</item>
<item>3</item>
<item>4</item>
@ -183,7 +129,7 @@
<item>7</item>
<item>8</item>
<item>9</item>
</string-array>
</integer-array>
<!-- FSAA Preference -->
<string-array name="FSAAEntries" translatable="false">
@ -191,11 +137,11 @@
<item>2x</item>
<item>4x</item>
</string-array>
<string-array name="FSAAValues" translatable="false">
<integer-array name="FSAAValues" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
</integer-array>
<!-- Anisotropic Filtering Preference -->
<string-array name="anisotropicFilteringEntries" translatable="false">
@ -205,13 +151,13 @@
<item>8x</item>
<item>16x</item>
</string-array>
<string-array name="anisotropicFilteringValues" translatable="false">
<integer-array name="anisotropicFilteringValues" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
</string-array>
</integer-array>
<!-- Stereoscopy Preference -->
<string-array name="stereoscopyEntries" translatable="false">
@ -220,12 +166,12 @@
<item>Top-and-Bottom</item>
<item>Anaglyph</item>
</string-array>
<string-array name="stereoscopyValues" translatable="false">
<integer-array name="stereoscopyValues" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
</integer-array>
<!-- Aspect Ratio Preference -->
<string-array name="aspectRatioEntries" translatable="false">
@ -234,12 +180,12 @@
<item>Force 4:3</item>
<item>Stretch To Window</item>
</string-array>
<string-array name="aspectRatioValues" translatable="false">
<integer-array name="aspectRatioValues" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
</integer-array>
<string-array name="country_names">
<item>Europe</item>

View File

@ -320,7 +320,8 @@
<!-- Game Grid Screen-->
<string name="grid_menu_settings">Settings</string>
<string name="grid_menu_core_settings">Settings</string>
<string name="grid_menu_video_settings">Video Settings</string>
<string name="grid_menu_refresh">Refresh Library</string>
<!-- Add Directory Screen-->

File diff suppressed because it is too large Load Diff