Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #9272 from Ebola16/AWP
Android: Expand WiimoteProfileSetting to more setting types
- Loading branch information
Showing
5 changed files
with
187 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| package org.dolphinemu.dolphinemu.features.settings.model; | ||
|
|
||
| import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile; | ||
|
|
||
| // This stuff is pretty ugly. It's a kind of workaround for certain controller settings | ||
| // not actually being available as game-specific settings. | ||
| public class WiimoteProfileBooleanSetting implements AbstractBooleanSetting | ||
| { | ||
| private final int mPadID; | ||
|
|
||
| private final String mSection; | ||
| private final String mKey; | ||
| private final boolean mDefaultValue; | ||
|
|
||
| private final String mProfileKey; | ||
|
|
||
| private final String mProfile; | ||
|
|
||
| public WiimoteProfileBooleanSetting(String gameID, int padID, String section, String key, | ||
| boolean defaultValue) | ||
| { | ||
| mPadID = padID; | ||
| mSection = section; | ||
| mKey = key; | ||
| mDefaultValue = defaultValue; | ||
|
|
||
| mProfileKey = SettingsFile.KEY_WIIMOTE_PROFILE + (padID + 1); | ||
|
|
||
| mProfile = gameID + "_Wii" + padID; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isOverridden(Settings settings) | ||
| { | ||
| return settings.isWiimoteProfileEnabled(settings, mProfile, mProfileKey); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isRuntimeEditable() | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean delete(Settings settings) | ||
| { | ||
| return settings.disableWiimoteProfile(settings, mProfileKey); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean getBoolean(Settings settings) | ||
| { | ||
| if (settings.isWiimoteProfileEnabled(settings, mProfile, mProfileKey)) | ||
| return settings.getWiimoteProfile(mProfile, mPadID).getBoolean(mSection, mKey, mDefaultValue); | ||
| else | ||
| return mDefaultValue; | ||
| } | ||
|
|
||
| @Override | ||
| public void setBoolean(Settings settings, boolean newValue) | ||
| { | ||
| settings.getWiimoteProfile(mProfile, mPadID).setBoolean(mSection, mKey, newValue); | ||
|
|
||
| settings.enableWiimoteProfile(settings, mProfile, mProfileKey); | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| package org.dolphinemu.dolphinemu.features.settings.model; | ||
|
|
||
| import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile; | ||
|
|
||
| // This stuff is pretty ugly. It's a kind of workaround for certain controller settings | ||
| // not actually being available as game-specific settings. | ||
| public class WiimoteProfileStringSetting implements AbstractStringSetting | ||
| { | ||
| private final int mPadID; | ||
|
|
||
| private final String mSection; | ||
| private final String mKey; | ||
| private final String mDefaultValue; | ||
|
|
||
| private final String mProfileKey; | ||
|
|
||
| private final String mProfile; | ||
|
|
||
| public WiimoteProfileStringSetting(String gameID, int padID, String section, String key, | ||
| String defaultValue) | ||
| { | ||
| mPadID = padID; | ||
| mSection = section; | ||
| mKey = key; | ||
| mDefaultValue = defaultValue; | ||
|
|
||
| mProfileKey = SettingsFile.KEY_WIIMOTE_PROFILE + (padID + 1); | ||
|
|
||
| mProfile = gameID + "_Wii" + padID; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isOverridden(Settings settings) | ||
| { | ||
| return settings.isWiimoteProfileEnabled(settings, mProfile, mProfileKey); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isRuntimeEditable() | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean delete(Settings settings) | ||
| { | ||
| return settings.disableWiimoteProfile(settings, mProfileKey); | ||
| } | ||
|
|
||
| @Override | ||
| public String getString(Settings settings) | ||
| { | ||
| if (settings.isWiimoteProfileEnabled(settings, mProfile, mProfileKey)) | ||
| return settings.getWiimoteProfile(mProfile, mPadID).getString(mSection, mKey, mDefaultValue); | ||
| else | ||
| return mDefaultValue; | ||
| } | ||
|
|
||
| @Override | ||
| public void setString(Settings settings, String newValue) | ||
| { | ||
| settings.getWiimoteProfile(mProfile, mPadID).setString(mSection, mKey, newValue); | ||
|
|
||
| settings.enableWiimoteProfile(settings, mProfile, mProfileKey); | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters