Android: Add game specific gc/wii controller settings

This commit is contained in:
zackhow 2018-08-26 18:27:27 -04:00
parent f1413dbbf6
commit 5d93a10c60
17 changed files with 704 additions and 282 deletions

View File

@ -0,0 +1,135 @@
[Profile]
Device = Android/4/Touchscreen
Buttons/A = `Button 100`
Buttons/B = `Button 101`
Buttons/- = `Button 102`
Buttons/+ = `Button 103`
Buttons/Home = `Button 104`
Buttons/1 = `Button 105`
Buttons/2 = `Button 106`
D-Pad/Up = `Button 107`
D-Pad/Down = `Button 108`
D-Pad/Left = `Button 109`
D-Pad/Right = `Button 110`
IR/Up = `Axis 112`
IR/Down = `Axis 113`
IR/Left = `Axis 114`
IR/Right = `Axis 115`
IR/Forward = `Axis 116`
IR/Backward = `Axis 117`
IR/Hide = `Button 118`
Swing/Up = `Axis 120`
Swing/Down = `Axis 121`
Swing/Left = `Axis 122`
Swing/Right = `Axis 123`
Swing/Forward = `Axis 124`
Swing/Backward = `Axis 125`
Tilt/Forward = `Axis 127`
Tilt/Backward = `Axis 128`
Tilt/Left = `Axis 129`
Tilt/Right = `Axis 130`
Tilt/Modifier = `Button 131`
Tilt/Modifier/Range = 50,000000
Shake/X = `Button 132`
Shake/Y = `Button 133`
Shake/Z = `Button 134`
Extension = Nunchuk
Nunchuk/Buttons/C = `Button 200`
Nunchuk/Buttons/Z = `Button 201`
Nunchuk/Stick/Up = `Axis 203`
Nunchuk/Stick/Down = `Axis 204`
Nunchuk/Stick/Left = `Axis 205`
Nunchuk/Stick/Right = `Axis 206`
Nunchuk/Stick/Radius = 100,000000
Nunchuk/Swing/Up = `Axis 208`
Nunchuk/Swing/Down = `Axis 209`
Nunchuk/Swing/Left = `Axis 210`
Nunchuk/Swing/Right = `Axis 211`
Nunchuk/Swing/Forward = `Axis 212`
Nunchuk/Swing/Backward = `Axis 213`
Nunchuk/Tilt/Forward = `Axis 215`
Nunchuk/Tilt/Backward = `Axis 216`
Nunchuk/Tilt/Left = `Axis 217`
Nunchuk/Tilt/Right = `Axis 218`
Nunchuk/Tilt/Modifier = `Button 219`
Nunchuk/Tilt/Modifier/Range = 50,000000
Nunchuk/Shake/X = `Button 220`
Nunchuk/Shake/Y = `Button 221`
Nunchuk/Shake/Z = `Button 222`
Classic/Buttons/A = `Button 300`
Classic/Buttons/B = `Button 301`
Classic/Buttons/X = `Button 302`
Classic/Buttons/Y = `Button 303`
Classic/Buttons/- = `Button 304`
Classic/Buttons/+ = `Button 305`
Classic/Buttons/Home = `Button 306`
Classic/Buttons/ZL = `Button 307`
Classic/Buttons/ZR = `Button 308`
Classic/D-Pad/Up = `Button 309`
Classic/D-Pad/Down = `Button 310`
Classic/D-Pad/Left = `Button 311`
Classic/D-Pad/Right = `Button 312`
Classic/Left Stick/Up = `Axis 314`
Classic/Left Stick/Down = `Axis 315`
Classic/Left Stick/Left = `Axis 316`
Classic/Left Stick/Right = `Axis 317`
Classic/Left Stick/Radius = 100,000000
Classic/Right Stick/Up = `Axis 319`
Classic/Right Stick/Down = `Axis 320`
Classic/Right Stick/Left = `Axis 321`
Classic/Right Stick/Right = `Axis 322`
Classic/Right Stick/Radius = 100,000000
Classic/Triggers/L = `Axis 323`
Classic/Triggers/R = `Axis 324`
Classic/Triggers/Threshold = 90,000000
Guitar/Buttons/- = `Button 400`
Guitar/Buttons/+ = `Button 401`
Guitar/Frets/Green = `Button 402`
Guitar/Frets/Red = `Button 403`
Guitar/Frets/Yellow = `Button 404`
Guitar/Frets/Blue = `Button 405`
Guitar/Frets/Orange = `Button 406`
Guitar/Strum/Up = `Button 407`
Guitar/Strum/Down = `Button 408`
Guitar/Stick/Up = `Axis 410`
Guitar/Stick/Down = `Axis 411`
Guitar/Stick/Left = `Axis 412`
Guitar/Stick/Right = `Axis 413`
Guitar/Stick/Radius = 100,000000
Guitar/Whammy/Bar = `Axis = 414`
Drums/Buttons/- = `Button 500`
Drums/Buttons/+ = `Button 501`
Drums/Pads/Red = `Button 502`
Drums/Pads/Yellow = `Button 503`
Drums/Pads/Blue = `Button 504`
Drums/Pads/Green = `Button 505`
Drums/Pads/Orange = `Button 506`
Drums/Pads/Bass = `Button 507`
Drums/Stick/Up = `Axis 509`
Drums/Stick/Down = `Axis 510`
Drums/Stick/Left = `Axis 511`
Drums/Stick/Right = `Axis 512`
Drums/Stick/Radius = 100,000000
Turntable/Buttons/Green Left = `Button 600`
Turntable/Buttons/Red Left = `Button 601`
Turntable/Buttons/Blue Left = `Button 602`
Turntable/Buttons/Green Right = `Button 603`
Turntable/Buttons/Red Right = `Button 604`
Turntable/Buttons/Blue Right = `Button 605`
Turntable/Buttons/- = `Button 606`
Turntable/Buttons/+ = `Button 607`
Turntable/Buttons/Home = `Button 608`
Turntable/Buttons/Euphoria = `Button 609`
Turntable/Table Left/Left = `Axis 611`
Turntable/Table Left/Right = `Axis 612`
Turntable/Table Right/Left = `Axis 614`
Turntable/Table Right/Right = `Axis 615`
Turntable/Stick/Up = `Axis 617`
Turntable/Stick/Down = `Axis 618`
Turntable/Stick/Left = `Axis 619`
Turntable/Stick/Right = `Axis 620`
Turntable/Stick/Radius = 100,000000
Turntable/Effect/Dial = `Axis 621`
Turntable/Crossfade/Left = `Axis 623`
Turntable/Crossfade/Right = `Axis 624`
Rumble/Motor = `Rumble 700`

View File

@ -248,6 +248,9 @@ public final class NativeLibrary
public static native void SetUserSetting(String gameID, String Section, String Key, String Value);
public static native void SetProfileSetting(String profile, String Section, String Key,
String Value);
public static native void InitGameIni(String gameID);
/**

View File

@ -12,10 +12,12 @@ import android.widget.Toast;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
import org.dolphinemu.dolphinemu.dialogs.GameSettingsDialog;
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
import org.dolphinemu.dolphinemu.model.GameFile;
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
import org.dolphinemu.dolphinemu.ui.platform.Platform;
import org.dolphinemu.dolphinemu.utils.PicassoUtils;
import org.dolphinemu.dolphinemu.viewholders.GameViewHolder;
@ -147,49 +149,10 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
return true;
}
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("Game Settings")
.setItems(R.array.gameSettingsMenus, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
switch (which)
{
case 0:
SettingsActivity.launch(activity, MenuTag.CONFIG, gameId);
break;
case 1:
SettingsActivity.launch(activity, MenuTag.GRAPHICS, gameId);
break;
case 2:
String path =
DirectoryInitialization.getUserDirectory() + "/GameSettings/" +
gameId + ".ini";
File gameSettingsFile = new File(path);
if (gameSettingsFile.exists())
{
if (gameSettingsFile.delete())
{
Toast.makeText(view.getContext(), "Cleared settings for " + gameId,
Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(view.getContext(), "Unable to clear settings for " + gameId,
Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(view.getContext(), "No game settings to delete",
Toast.LENGTH_SHORT).show();
}
break;
}
}
});
builder.show();
GameSettingsDialog fragment =
GameSettingsDialog.newInstance(gameId, holder.gameFile.getPlatform());
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction()
.add(fragment, GameSettingsDialog.TAG).commit();
return true;
}

View File

@ -14,6 +14,7 @@ import android.widget.ImageView;
import android.widget.Toast;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.dialogs.GameSettingsDialog;
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
import org.dolphinemu.dolphinemu.model.GameFile;
@ -80,73 +81,30 @@ public final class GameRowPresenter extends Presenter
Context context = holder.cardParent.getContext();
Drawable background = ContextCompat.getDrawable(context, backgroundId);
holder.cardParent.setInfoAreaBackground(background);
holder.cardParent.setOnLongClickListener(new View.OnLongClickListener()
holder.cardParent.setOnLongClickListener((view) ->
{
@Override
public boolean onLongClick(View view)
FragmentActivity activity = (FragmentActivity) view.getContext();
String gameId = gameFile.getGameId();
if (gameId.isEmpty())
{
FragmentActivity activity = (FragmentActivity) view.getContext();
String gameId = gameFile.getGameId();
if (gameId.isEmpty())
{
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("Game Settings");
builder.setMessage("Files without game IDs don't support game-specific settings.");
builder.show();
return true;
}
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("Game Settings")
.setItems(R.array.gameSettingsMenus, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
switch (which)
{
case 0:
SettingsActivity.launch(activity, MenuTag.CONFIG, gameId);
break;
case 1:
SettingsActivity.launch(activity, MenuTag.GRAPHICS, gameId);
break;
case 2:
String path = DirectoryInitialization.getUserDirectory() +
"/GameSettings/" + gameId + ".ini";
File gameSettingsFile = new File(path);
if (gameSettingsFile.exists())
{
if (gameSettingsFile.delete())
{
Toast.makeText(view.getContext(), "Cleared settings for " + gameId,
Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(view.getContext(),
"Unable to clear settings for " + gameId, Toast.LENGTH_SHORT)
.show();
}
}
else
{
Toast.makeText(view.getContext(), "No game settings to delete",
Toast.LENGTH_SHORT).show();
}
break;
}
}
});
builder.setTitle("Game Settings");
builder.setMessage("Files without game IDs don't support game-specific settings.");
builder.show();
return true;
}
GameSettingsDialog fragment =
GameSettingsDialog.newInstance(gameId, holder.gameFile.getPlatform());
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction()
.add(fragment, GameSettingsDialog.TAG).commit();
return true;
});
}
@Override
public void onUnbindViewHolder(ViewHolder viewHolder)
{

View File

@ -0,0 +1,98 @@
package org.dolphinemu.dolphinemu.dialogs;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.widget.Toast;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
import org.dolphinemu.dolphinemu.ui.platform.Platform;
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
import java.io.File;
public class GameSettingsDialog extends DialogFragment
{
public static final String TAG = "GameSettingsDialog";
public static final String ARG_GAMEID = "game_id";
public static final String ARG_PLATFORM = "platform";
public static GameSettingsDialog newInstance(String gameId, int platform)
{
GameSettingsDialog fragment = new GameSettingsDialog();
Bundle arguments = new Bundle();
arguments.putString(ARG_GAMEID, gameId);
arguments.putInt(ARG_PLATFORM, platform);
fragment.setArguments(arguments);
return fragment;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
String gameId = getArguments().getString(ARG_GAMEID);
int platform = getArguments().getInt(ARG_PLATFORM);
builder.setTitle(getActivity().getString(R.string.preferences_game_settings))
.setItems(platform == Platform.GAMECUBE.toInt() ?
R.array.gameSettingsMenusGC :
R.array.gameSettingsMenusWii, (dialog, which) ->
{
switch (which)
{
case 0:
SettingsActivity.launch(getContext(), MenuTag.CONFIG, gameId);
break;
case 1:
SettingsActivity.launch(getContext(), MenuTag.GRAPHICS, gameId);
break;
case 2:
SettingsActivity.launch(getContext(), MenuTag.GCPAD_TYPE, gameId);
break;
case 3:
// Clear option for GC, Wii controls for else
if (platform == Platform.GAMECUBE.toInt())
clearGameSettings(gameId);
else
SettingsActivity.launch(getActivity(), MenuTag.WIIMOTE, gameId);
break;
case 4:
clearGameSettings(gameId);
break;
}
});
return builder.create();
}
private void clearGameSettings(String gameId)
{
String path =
DirectoryInitialization.getUserDirectory() + "/GameSettings/" + gameId + ".ini";
File gameSettingsFile = new File(path);
if (gameSettingsFile.exists())
{
if (gameSettingsFile.delete())
{
Toast.makeText(getContext(), "Cleared settings for " + gameId, Toast.LENGTH_SHORT)
.show();
}
else
{
Toast.makeText(getContext(), "Unable to clear settings for " + gameId,
Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(getContext(), "No game settings to delete", Toast.LENGTH_SHORT).show();
}
}
}

View File

@ -26,6 +26,8 @@ public class Settings
public static final String SECTION_WIIMOTE = "Wiimote";
public static final String SECTION_BINDINGS = "Android";
public static final String SECTION_CONTROLS = "Controls";
public static final String SECTION_PROFILE = "Profile";
public static final String SECTION_ANALYTICS = "Analytics";
@ -134,6 +136,11 @@ public class Settings
mergeSections(SettingsFile.readCustomGameSettings(gameId, view));
}
public void loadWiimoteProfile(String gameId, String padId)
{
mergeSections(SettingsFile.readWiimoteProfile(gameId, padId));
}
private void mergeSections(HashMap<String, SettingSection> updatedSections)
{
for (Map.Entry<String, SettingSection> entry : updatedSections.entrySet())
@ -182,6 +189,5 @@ public class Settings
view.showToastMessage("Saved settings for " + gameId);
SettingsFile.saveCustomGameSettings(gameId, sections);
}
}
}

View File

@ -11,9 +11,13 @@ import org.dolphinemu.dolphinemu.features.settings.model.StringSetting;
public class InputBindingSetting extends SettingsItem
{
public InputBindingSetting(String key, String section, int titleId, Setting setting)
private String gameId;
public InputBindingSetting(String key, String section, int titleId, Setting setting,
String gameId)
{
super(key, section, setting, titleId, 0);
this.gameId = gameId;
}
public String getValue()
@ -98,4 +102,9 @@ public class InputBindingSetting extends SettingsItem
{
return TYPE_INPUT_BINDING;
}
public String getGameId()
{
return gameId;
}
}

View File

@ -1,7 +1,7 @@
package org.dolphinemu.dolphinemu.features.settings.model.view;
import org.dolphinemu.dolphinemu.features.settings.model.Setting;
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter;
import org.dolphinemu.dolphinemu.features.settings.model.Setting;
/**
* ViewModel abstraction for an Item in the RecyclerView powering SettingsFragments.
@ -39,6 +39,7 @@ public abstract class SettingsItem
* @param nameId Resource ID for a text string to be displayed as this setting's name.
* @param descriptionId Resource ID for a text string to be displayed as this setting's description.
*/
public SettingsItem(String key, String section, Setting setting, int nameId, int descriptionId)
{
mKey = key;

View File

@ -292,7 +292,14 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
else if (scSetting.getKey().equals(SettingsFile.KEY_WIIMOTE_EXTENSION))
{
putExtensionSetting(which, Character.getNumericValue(
scSetting.getSection().charAt(scSetting.getSection().length() - 1)));
scSetting.getSection().charAt(scSetting.getSection().length() - 1)), false);
}
else if (scSetting.getKey().contains(SettingsFile.KEY_WIIMOTE_EXTENSION) &&
scSetting.getSection().equals(Settings.SECTION_CONTROLS))
{
putExtensionSetting(which, Character
.getNumericValue(scSetting.getKey().charAt(scSetting.getKey().length() - 1)),
true);
}
}
@ -443,11 +450,22 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
mView.putSetting(gfxBackend);
}
private void putExtensionSetting(int which, int wiimoteNumber)
private void putExtensionSetting(int which, int wiimoteNumber, boolean isGame)
{
StringSetting extension = new StringSetting(SettingsFile.KEY_WIIMOTE_EXTENSION,
Settings.SECTION_WIIMOTE + wiimoteNumber,
mContext.getResources().getStringArray(R.array.wiimoteExtensionsEntries)[which]);
mView.putSetting(extension);
if (!isGame)
{
StringSetting extension = new StringSetting(SettingsFile.KEY_WIIMOTE_EXTENSION,
Settings.SECTION_WIIMOTE + wiimoteNumber,
mContext.getResources().getStringArray(R.array.wiimoteExtensionsEntries)[which]);
mView.putSetting(extension);
}
else
{
StringSetting extension =
new StringSetting(SettingsFile.KEY_WIIMOTE_EXTENSION + wiimoteNumber,
Settings.SECTION_CONTROLS, mContext.getResources()
.getStringArray(R.array.wiimoteExtensionsEntries)[which]);
mView.putSetting(extension);
}
}
}

View File

@ -336,12 +336,23 @@ public final class SettingsFragmentPresenter
{
for (int i = 0; i < 4; i++)
{
// TODO This controller_0 + i business is quite the hack. It should work, but only if the definitions are kept together and in order.
Setting gcPadSetting = mSettings.getSection(Settings.SECTION_INI_CORE)
.getSetting(SettingsFile.KEY_GCPAD_TYPE + i);
sl.add(new SingleChoiceSetting(SettingsFile.KEY_GCPAD_TYPE + i, Settings.SECTION_INI_CORE,
R.string.controller_0 + i, 0, R.array.gcpadTypeEntries, R.array.gcpadTypeValues, 0,
gcPadSetting, MenuTag.getGCPadMenuTag(i)));
if (mGameID.equals(""))
{
// TODO This controller_0 + i business is quite the hack. It should work, but only if the definitions are kept together and in order.
Setting gcPadSetting = mSettings.getSection(Settings.SECTION_INI_CORE)
.getSetting(SettingsFile.KEY_GCPAD_TYPE + i);
sl.add(new SingleChoiceSetting(SettingsFile.KEY_GCPAD_TYPE + i, Settings.SECTION_INI_CORE,
R.string.controller_0 + i, 0, R.array.gcpadTypeEntries, R.array.gcpadTypeValues, 0,
gcPadSetting, MenuTag.getGCPadMenuTag(i)));
}
else
{
Setting gcPadSetting = mSettings.getSection(Settings.SECTION_CONTROLS)
.getSetting(SettingsFile.KEY_GCPAD_G_TYPE + i);
sl.add(new SingleChoiceSetting(SettingsFile.KEY_GCPAD_G_TYPE + i, Settings.SECTION_CONTROLS,
R.string.controller_0 + i, 0, R.array.gcpadTypeEntries, R.array.gcpadTypeValues, 0,
gcPadSetting, MenuTag.getGCPadMenuTag(i)));
}
}
}
@ -350,11 +361,23 @@ public final class SettingsFragmentPresenter
for (int i = 0; i < 4; i++)
{
// TODO This wiimote_0 + i business is quite the hack. It should work, but only if the definitions are kept together and in order.
Setting wiimoteSetting = mSettings.getSection(Settings.SECTION_WIIMOTE + (i + 1))
.getSetting(SettingsFile.KEY_WIIMOTE_TYPE);
sl.add(new SingleChoiceSetting(SettingsFile.KEY_WIIMOTE_TYPE, Settings.SECTION_WIIMOTE + i,
R.string.wiimote_4 + i, 0, R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, 0,
wiimoteSetting, MenuTag.getWiimoteMenuTag(i + 4)));
if (mGameID.equals(""))
{
Setting wiimoteSetting = mSettings.getSection(Settings.SECTION_WIIMOTE + (i + 1))
.getSetting(SettingsFile.KEY_WIIMOTE_TYPE);
sl.add(new SingleChoiceSetting(SettingsFile.KEY_WIIMOTE_TYPE,
Settings.SECTION_WIIMOTE + (i + 1), R.string.wiimote_4 + i, 0,
R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, 0, wiimoteSetting,
MenuTag.getWiimoteMenuTag(i + 4)));
}
else
{
Setting wiimoteSetting = mSettings.getSection(Settings.SECTION_CONTROLS)
.getSetting(SettingsFile.KEY_WIIMOTE_G_TYPE + i);
sl.add(new SingleChoiceSetting(SettingsFile.KEY_WIIMOTE_G_TYPE + i,
Settings.SECTION_CONTROLS, R.string.wiimote_4 + i, 0, R.array.wiimoteTypeEntries,
R.array.wiimoteTypeValues, 0, wiimoteSetting, MenuTag.getWiimoteMenuTag(i + 4)));
}
}
}
@ -638,53 +661,53 @@ public final class SettingsFragmentPresenter
sl.add(new HeaderSetting(null, null, R.string.generic_buttons, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_A + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.button_a, bindA));
Settings.SECTION_BINDINGS, R.string.button_a, bindA, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_B + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.button_b, bindB));
Settings.SECTION_BINDINGS, R.string.button_b, bindB, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_X + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.button_x, bindX));
Settings.SECTION_BINDINGS, R.string.button_x, bindX, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_Y + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.button_y, bindY));
Settings.SECTION_BINDINGS, R.string.button_y, bindY, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_Z + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.button_z, bindZ));
Settings.SECTION_BINDINGS, R.string.button_z, bindZ, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_START + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.button_start, bindStart));
Settings.SECTION_BINDINGS, R.string.button_start, bindStart, mGameID));
sl.add(new HeaderSetting(null, null, R.string.controller_control, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_CONTROL_UP + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindControlUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindControlUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_CONTROL_DOWN + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindControlDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindControlDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_CONTROL_LEFT + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindControlLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindControlLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_CONTROL_RIGHT + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindControlRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindControlRight, mGameID));
sl.add(new HeaderSetting(null, null, R.string.controller_c, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_C_UP + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindCUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindCUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_C_DOWN + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindCDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindCDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_C_LEFT + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindCLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindCLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_C_RIGHT + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindCRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindCRight, mGameID));
sl.add(new HeaderSetting(null, null, R.string.controller_trig, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_TRIGGER_L + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.trigger_left, bindTriggerL));
Settings.SECTION_BINDINGS, R.string.trigger_left, bindTriggerL, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_TRIGGER_R + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.trigger_right, bindTriggerR));
Settings.SECTION_BINDINGS, R.string.trigger_right, bindTriggerR, mGameID));
sl.add(new HeaderSetting(null, null, R.string.controller_dpad, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_DPAD_UP + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindDPadUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindDPadUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_DPAD_DOWN + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindDPadDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindDPadDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_DPAD_LEFT + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindDPadLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindDPadLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_GCBIND_DPAD_RIGHT + gcPadNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindDPadRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindDPadRight, mGameID));
sl.add(new HeaderSetting(null, null, R.string.emulation_control_rumble, 0));
@ -709,10 +732,7 @@ public final class SettingsFragmentPresenter
{
SettingSection bindingsSection = mSettings.getSection(Settings.SECTION_BINDINGS);
// Bindings use controller numbers 4-7 (0-3 are GameCube), but the extension setting uses 1-4.
IntSetting extension = new IntSetting(SettingsFile.KEY_WIIMOTE_EXTENSION,
Settings.SECTION_WIIMOTE + wiimoteNumber, getExtensionValue(wiimoteNumber - 3),
MenuTag.getWiimoteExtensionMenuTag(wiimoteNumber));
Setting bindA = bindingsSection.getSetting(SettingsFile.KEY_WIIBIND_A + wiimoteNumber);
Setting bindB = bindingsSection.getSetting(SettingsFile.KEY_WIIBIND_B + wiimoteNumber);
Setting bind1 = bindingsSection.getSetting(SettingsFile.KEY_WIIBIND_1 + wiimoteNumber);
@ -772,87 +792,110 @@ public final class SettingsFragmentPresenter
Setting wiiEmuRumble =
bindingsSection.getSetting(SettingsFile.KEY_EMU_RUMBLE + wiimoteNumber);
sl.add(new SingleChoiceSetting(SettingsFile.KEY_WIIMOTE_EXTENSION,
Settings.SECTION_WIIMOTE + (wiimoteNumber - 3), R.string.wiimote_extensions,
R.string.wiimote_extensions_description, R.array.wiimoteExtensionsEntries,
R.array.wiimoteExtensionsValues, 0, extension,
MenuTag.getWiimoteExtensionMenuTag(wiimoteNumber)));
// Bindings use controller numbers 4-7 (0-3 are GameCube), but the extension setting uses 1-4.
// But game game specific extension settings are saved in their own profile. These profiles
// do not have any way to specify the controller that is loaded outside of knowing the filename
// of the profile that was loaded.
IntSetting extension;
if (mGameID.equals(""))
{
extension = new IntSetting(SettingsFile.KEY_WIIMOTE_EXTENSION,
Settings.SECTION_WIIMOTE + wiimoteNumber, getExtensionValue(wiimoteNumber - 3),
MenuTag.getWiimoteExtensionMenuTag(wiimoteNumber));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_WIIMOTE_EXTENSION,
Settings.SECTION_WIIMOTE + (wiimoteNumber - 3), R.string.wiimote_extensions,
R.string.wiimote_extensions_description, R.array.wiimoteExtensionsEntries,
R.array.wiimoteExtensionsValues, 0, extension,
MenuTag.getWiimoteExtensionMenuTag(wiimoteNumber)));
}
else
{
mSettings.loadWiimoteProfile(mGameID, String.valueOf(wiimoteNumber - 4));
extension = new IntSetting(SettingsFile.KEY_WIIMOTE_EXTENSION + (wiimoteNumber - 4),
Settings.SECTION_CONTROLS, getExtensionValue(wiimoteNumber - 4),
MenuTag.getWiimoteExtensionMenuTag(wiimoteNumber));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_WIIMOTE_EXTENSION + (wiimoteNumber - 4),
Settings.SECTION_CONTROLS, R.string.wiimote_extensions,
R.string.wiimote_extensions_description, R.array.wiimoteExtensionsEntries,
R.array.wiimoteExtensionsValues, 0, extension,
MenuTag.getWiimoteExtensionMenuTag(wiimoteNumber)));
}
sl.add(new HeaderSetting(null, null, R.string.generic_buttons, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_A + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_a, bindA));
Settings.SECTION_BINDINGS, R.string.button_a, bindA, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_B + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_b, bindB));
Settings.SECTION_BINDINGS, R.string.button_b, bindB, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_1 + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_one, bind1));
Settings.SECTION_BINDINGS, R.string.button_one, bind1, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_2 + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_two, bind2));
Settings.SECTION_BINDINGS, R.string.button_two, bind2, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_MINUS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_minus, bindMinus));
Settings.SECTION_BINDINGS, R.string.button_minus, bindMinus, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_PLUS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_plus, bindPlus));
Settings.SECTION_BINDINGS, R.string.button_plus, bindPlus, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_HOME + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_home, bindHome));
Settings.SECTION_BINDINGS, R.string.button_home, bindHome, mGameID));
sl.add(new HeaderSetting(null, null, R.string.wiimote_ir, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_IR_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindIRUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindIRUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_IR_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindIRDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindIRDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_IR_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindIRLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindIRLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_IR_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindIRRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindIRRight, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_IR_FORWARD + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_forward, bindIRForward));
Settings.SECTION_BINDINGS, R.string.generic_forward, bindIRForward, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_IR_BACKWARD + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_backward, bindIRBackward));
Settings.SECTION_BINDINGS, R.string.generic_backward, bindIRBackward, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_IR_HIDE + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.ir_hide, bindIRHide));
Settings.SECTION_BINDINGS, R.string.ir_hide, bindIRHide, mGameID));
sl.add(new HeaderSetting(null, null, R.string.wiimote_swing, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_SWING_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindSwingUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindSwingUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_SWING_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindSwingDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindSwingDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_SWING_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindSwingLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindSwingLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_SWING_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindSwingRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindSwingRight, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_SWING_FORWARD + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_forward, bindSwingForward));
Settings.SECTION_BINDINGS, R.string.generic_forward, bindSwingForward, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_SWING_BACKWARD + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_backward, bindSwingBackward));
Settings.SECTION_BINDINGS, R.string.generic_backward, bindSwingBackward, mGameID));
sl.add(new HeaderSetting(null, null, R.string.wiimote_tilt, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TILT_FORWARD + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_forward, bindTiltForward));
Settings.SECTION_BINDINGS, R.string.generic_forward, bindTiltForward, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TILT_BACKWARD + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_backward, bindTiltBackward));
Settings.SECTION_BINDINGS, R.string.generic_backward, bindTiltBackward, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TILT_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindTiltLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindTiltLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TILT_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindTiltRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindTiltRight, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TILT_MODIFIER + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.tilt_modifier, bindTiltModifier));
Settings.SECTION_BINDINGS, R.string.tilt_modifier, bindTiltModifier, mGameID));
sl.add(new HeaderSetting(null, null, R.string.wiimote_shake, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_SHAKE_X + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.shake_x, bindShakeX));
Settings.SECTION_BINDINGS, R.string.shake_x, bindShakeX, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_SHAKE_Y + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.shake_y, bindShakeY));
Settings.SECTION_BINDINGS, R.string.shake_y, bindShakeY, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_SHAKE_Z + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.shake_z, bindShakeZ));
Settings.SECTION_BINDINGS, R.string.shake_z, bindShakeZ, mGameID));
sl.add(new HeaderSetting(null, null, R.string.controller_dpad, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DPAD_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindDPadUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindDPadUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DPAD_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindDPadDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindDPadDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DPAD_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindDPadLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindDPadLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DPAD_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindDPadRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindDPadRight, mGameID));
sl.add(new HeaderSetting(null, null, R.string.emulation_control_rumble, 0));
@ -911,58 +954,58 @@ public final class SettingsFragmentPresenter
sl.add(new HeaderSetting(null, null, R.string.generic_buttons, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_C + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.nunchuk_button_c, bindC));
Settings.SECTION_BINDINGS, R.string.nunchuk_button_c, bindC, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_Z + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_z, bindZ));
Settings.SECTION_BINDINGS, R.string.button_z, bindZ, mGameID));
sl.add(new HeaderSetting(null, null, R.string.generic_stick, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindRight, mGameID));
sl.add(new HeaderSetting(null, null, R.string.wiimote_swing, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_SWING_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindSwingUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindSwingUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_SWING_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindSwingDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindSwingDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_SWING_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindSwingLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindSwingLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_SWING_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindSwingRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindSwingRight, mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_NUNCHUK_SWING_FORWARD + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_forward, bindSwingForward));
Settings.SECTION_BINDINGS, R.string.generic_forward, bindSwingForward, mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_NUNCHUK_SWING_BACKWARD + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_backward, bindSwingBackward));
Settings.SECTION_BINDINGS, R.string.generic_backward, bindSwingBackward, mGameID));
sl.add(new HeaderSetting(null, null, R.string.wiimote_tilt, 0));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_NUNCHUK_TILT_FORWARD + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_forward, bindTiltForward));
Settings.SECTION_BINDINGS, R.string.generic_forward, bindTiltForward, mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_NUNCHUK_TILT_BACKWARD + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_backward, bindTiltBackward));
Settings.SECTION_BINDINGS, R.string.generic_backward, bindTiltBackward, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_TILT_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindTiltLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindTiltLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_TILT_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindTiltRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindTiltRight, mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_NUNCHUK_TILT_MODIFIER + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.tilt_modifier, bindTiltModifier));
Settings.SECTION_BINDINGS, R.string.tilt_modifier, bindTiltModifier, mGameID));
sl.add(new HeaderSetting(null, null, R.string.wiimote_shake, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_SHAKE_X + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.shake_x, bindShakeX));
Settings.SECTION_BINDINGS, R.string.shake_x, bindShakeX, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_SHAKE_Y + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.shake_y, bindShakeY));
Settings.SECTION_BINDINGS, R.string.shake_y, bindShakeY, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_NUNCHUK_SHAKE_Z + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.shake_z, bindShakeZ));
Settings.SECTION_BINDINGS, R.string.shake_z, bindShakeZ, mGameID));
break;
case 2: // Classic
Setting bindA =
@ -1014,59 +1057,59 @@ public final class SettingsFragmentPresenter
sl.add(new HeaderSetting(null, null, R.string.generic_buttons, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_A + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_a, bindA));
Settings.SECTION_BINDINGS, R.string.button_a, bindA, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_B + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_b, bindB));
Settings.SECTION_BINDINGS, R.string.button_b, bindB, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_X + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_x, bindX));
Settings.SECTION_BINDINGS, R.string.button_x, bindX, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_Y + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_y, bindY));
Settings.SECTION_BINDINGS, R.string.button_y, bindY, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_ZL + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.classic_button_zl, bindZL));
Settings.SECTION_BINDINGS, R.string.classic_button_zl, bindZL, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_ZR + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.classic_button_zr, bindZR));
Settings.SECTION_BINDINGS, R.string.classic_button_zr, bindZR, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_MINUS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_minus, bindMinus));
Settings.SECTION_BINDINGS, R.string.button_minus, bindMinus, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_PLUS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_plus, bindPlus));
Settings.SECTION_BINDINGS, R.string.button_plus, bindPlus, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_HOME + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_home, bindHome));
Settings.SECTION_BINDINGS, R.string.button_home, bindHome, mGameID));
sl.add(new HeaderSetting(null, null, R.string.classic_leftstick, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_LEFT_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindLeftUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindLeftUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_LEFT_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindLeftDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindLeftDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_LEFT_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindLeftLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindLeftLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_LEFT_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindLeftRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindLeftRight, mGameID));
sl.add(new HeaderSetting(null, null, R.string.classic_rightstick, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_RIGHT_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindRightUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindRightUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_RIGHT_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindRightDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindRightDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_RIGHT_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindRightLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindRightLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_RIGHT_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindRightRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindRightRight, mGameID));
sl.add(new HeaderSetting(null, null, R.string.controller_trig, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_TRIGGER_L + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.trigger_left, bindR));
Settings.SECTION_BINDINGS, R.string.trigger_left, bindR, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_TRIGGER_R + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.trigger_right, bindL));
Settings.SECTION_BINDINGS, R.string.trigger_right, bindL, mGameID));
sl.add(new HeaderSetting(null, null, R.string.controller_dpad, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_DPAD_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindDpadUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindDpadUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_DPAD_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindDpadDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindDpadDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_DPAD_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindDpadLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindDpadLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_CLASSIC_DPAD_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindDpadRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindDpadRight, mGameID));
break;
case 3: // Guitar
Setting bindFretGreen = bindingsSection
@ -1100,41 +1143,41 @@ public final class SettingsFragmentPresenter
sl.add(new HeaderSetting(null, null, R.string.guitar_frets, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_FRET_GREEN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_green, bindFretGreen));
Settings.SECTION_BINDINGS, R.string.generic_green, bindFretGreen, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_FRET_RED + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_red, bindFretRed));
Settings.SECTION_BINDINGS, R.string.generic_red, bindFretRed, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_FRET_YELLOW + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_yellow, bindFretYellow));
Settings.SECTION_BINDINGS, R.string.generic_yellow, bindFretYellow, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_FRET_BLUE + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_blue, bindFretBlue));
Settings.SECTION_BINDINGS, R.string.generic_blue, bindFretBlue, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_FRET_ORANGE + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_orange, bindFretOrange));
Settings.SECTION_BINDINGS, R.string.generic_orange, bindFretOrange, mGameID));
sl.add(new HeaderSetting(null, null, R.string.guitar_strum, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_STRUM_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindStrumUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindStrumUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_STRUM_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindStrumDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindStrumDown, mGameID));
sl.add(new HeaderSetting(null, null, R.string.generic_buttons, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_MINUS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_minus, bindGuitarMinus));
Settings.SECTION_BINDINGS, R.string.button_minus, bindGuitarMinus, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_PLUS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_plus, bindGuitarPlus));
Settings.SECTION_BINDINGS, R.string.button_plus, bindGuitarPlus, mGameID));
sl.add(new HeaderSetting(null, null, R.string.generic_stick, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_STICK_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindGuitarUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindGuitarUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_STICK_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindGuitarDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindGuitarDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_STICK_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindGuitarLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindGuitarLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_STICK_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindGuitarRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindGuitarRight, mGameID));
sl.add(new HeaderSetting(null, null, R.string.guitar_whammy, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_GUITAR_WHAMMY_BAR + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindWhammyBar));
Settings.SECTION_BINDINGS, R.string.generic_right, bindWhammyBar, mGameID));
break;
case 4: // Drums
Setting bindPadRed =
@ -1164,33 +1207,33 @@ public final class SettingsFragmentPresenter
sl.add(new HeaderSetting(null, null, R.string.drums_pads, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_PAD_RED + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_red, bindPadRed));
Settings.SECTION_BINDINGS, R.string.generic_red, bindPadRed, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_PAD_YELLOW + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_yellow, bindPadYellow));
Settings.SECTION_BINDINGS, R.string.generic_yellow, bindPadYellow, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_PAD_BLUE + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_blue, bindPadBlue));
Settings.SECTION_BINDINGS, R.string.generic_blue, bindPadBlue, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_PAD_GREEN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_green, bindPadGreen));
Settings.SECTION_BINDINGS, R.string.generic_green, bindPadGreen, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_PAD_ORANGE + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_orange, bindPadOrange));
Settings.SECTION_BINDINGS, R.string.generic_orange, bindPadOrange, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_PAD_BASS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.drums_pad_bass, bindPadBass));
Settings.SECTION_BINDINGS, R.string.drums_pad_bass, bindPadBass, mGameID));
sl.add(new HeaderSetting(null, null, R.string.generic_stick, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_STICK_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindDrumsUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindDrumsUp, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_STICK_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindDrumsDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindDrumsDown, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_STICK_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindDrumsLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindDrumsLeft, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_STICK_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindDrumsRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindDrumsRight, mGameID));
sl.add(new HeaderSetting(null, null, R.string.generic_buttons, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_MINUS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_minus, bindDrumsMinus));
Settings.SECTION_BINDINGS, R.string.button_minus, bindDrumsMinus, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_DRUMS_PLUS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_plus, bindDrumsPlus));
Settings.SECTION_BINDINGS, R.string.button_plus, bindDrumsPlus, mGameID));
break;
case 5: // Turntable
Setting bindGreenLeft = bindingsSection
@ -1237,66 +1280,76 @@ public final class SettingsFragmentPresenter
sl.add(new HeaderSetting(null, null, R.string.generic_buttons, 0));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_GREEN_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.turntable_button_green_left, bindGreenLeft));
Settings.SECTION_BINDINGS, R.string.turntable_button_green_left, bindGreenLeft,
mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TURNTABLE_RED_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.turntable_button_red_left, bindRedLeft));
Settings.SECTION_BINDINGS, R.string.turntable_button_red_left, bindRedLeft,
mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TURNTABLE_BLUE_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.turntable_button_blue_left, bindBlueLeft));
Settings.SECTION_BINDINGS, R.string.turntable_button_blue_left, bindBlueLeft,
mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_GREEN_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.turntable_button_green_right, bindGreenRight));
Settings.SECTION_BINDINGS, R.string.turntable_button_green_right, bindGreenRight,
mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TURNTABLE_RED_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.turntable_button_red_right, bindRedRight));
Settings.SECTION_BINDINGS, R.string.turntable_button_red_right, bindRedRight,
mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_BLUE_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.turntable_button_blue_right, bindBlueRight));
Settings.SECTION_BINDINGS, R.string.turntable_button_blue_right, bindBlueRight,
mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TURNTABLE_MINUS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_minus, bindTurntableMinus));
Settings.SECTION_BINDINGS, R.string.button_minus, bindTurntableMinus, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TURNTABLE_PLUS + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.button_plus, bindTurntablePlus));
Settings.SECTION_BINDINGS, R.string.button_plus, bindTurntablePlus, mGameID));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TURNTABLE_EUPHORIA + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.turntable_button_euphoria, bindEuphoria));
Settings.SECTION_BINDINGS, R.string.turntable_button_euphoria, bindEuphoria,
mGameID));
sl.add(new HeaderSetting(null, null, R.string.turntable_table_left, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TURNTABLE_LEFT_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindTurntableLeftLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindTurntableLeftLeft, mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_LEFT_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindTurntableLeftRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindTurntableLeftRight,
mGameID));
sl.add(new HeaderSetting(null, null, R.string.turntable_table_right, 0));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_RIGHT_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindTurntableRightLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindTurntableRightLeft, mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_RIGHT_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindTurntableRightRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindTurntableRightRight,
mGameID));
sl.add(new HeaderSetting(null, null, R.string.generic_stick, 0));
sl.add(new InputBindingSetting(SettingsFile.KEY_WIIBIND_TURNTABLE_STICK_UP + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_up, bindTurntableUp));
Settings.SECTION_BINDINGS, R.string.generic_up, bindTurntableUp, mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_STICK_DOWN + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_down, bindTurntableDown));
Settings.SECTION_BINDINGS, R.string.generic_down, bindTurntableDown, mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_STICK_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindTurntableLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindTurntableLeft, mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_STICK_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindTurntableRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindTurntableRight, mGameID));
sl.add(new HeaderSetting(null, null, R.string.turntable_effect, 0));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_EFFECT_DIAL + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.turntable_effect_dial, bindEffectDial));
Settings.SECTION_BINDINGS, R.string.turntable_effect_dial, bindEffectDial,
mGameID));
sl.add(new HeaderSetting(null, null, R.string.turntable_crossfade, 0));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_CROSSFADE_LEFT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_left, bindCrossfadeLeft));
Settings.SECTION_BINDINGS, R.string.generic_left, bindCrossfadeLeft, mGameID));
sl.add(new InputBindingSetting(
SettingsFile.KEY_WIIBIND_TURNTABLE_CROSSFADE_RIGHT + wiimoteNumber,
Settings.SECTION_BINDINGS, R.string.generic_right, bindCrossfadeRight));
Settings.SECTION_BINDINGS, R.string.generic_right, bindCrossfadeRight, mGameID));
break;
}
}
@ -1358,9 +1411,19 @@ public final class SettingsFragmentPresenter
try
{
String extension =
((StringSetting) mSettings.getSection(Settings.SECTION_WIIMOTE + wiimoteNumber)
.getSetting(SettingsFile.KEY_WIIMOTE_EXTENSION)).getValue();
String extension;
if (mGameID.equals("")) // Main settings
{
extension =
((StringSetting) mSettings.getSection(Settings.SECTION_WIIMOTE + wiimoteNumber)
.getSetting(SettingsFile.KEY_WIIMOTE_EXTENSION)).getValue();
}
else // Game settings
{
extension = ((StringSetting) mSettings.getSection(Settings.SECTION_PROFILE)
.getSetting(SettingsFile.KEY_WIIMOTE_EXTENSION)).getValue();
}
if (extension.equals("None"))
{
extensionValue = 0;

View File

@ -41,8 +41,9 @@ public final class InputBindingSettingViewHolder extends SettingViewHolder
mItem = (InputBindingSetting) item;
mTextSettingName.setText(item.getNameId());
mTextSettingDescription.setText(sharedPreferences.getString(mItem.getKey(), ""));
mTextSettingName.setText(mItem.getNameId());
mTextSettingDescription
.setText(sharedPreferences.getString(mItem.getKey() + mItem.getGameId(), ""));
}
@Override

View File

@ -90,6 +90,7 @@ public final class SettingsFile
public static final String KEY_WAIT_FOR_SHADERS = "WaitForShadersBeforeStarting";
public static final String KEY_GCPAD_TYPE = "SIDevice";
public static final String KEY_GCPAD_G_TYPE = "PadType";
public static final String KEY_GCBIND_A = "InputA_";
public static final String KEY_GCBIND_B = "InputB_";
@ -120,6 +121,10 @@ public final class SettingsFile
public static final String KEY_WIIMOTE_TYPE = "Source";
public static final String KEY_WIIMOTE_EXTENSION = "Extension";
// Controller keys for game specific settings
public static final String KEY_WIIMOTE_G_TYPE = "WiimoteSource";
public static final String KEY_WIIMOTE_PROFILE = "WiimoteProfile";
public static final String KEY_WIIBIND_A = "WiimoteA_";
public static final String KEY_WIIBIND_B = "WiimoteB_";
public static final String KEY_WIIBIND_1 = "Wiimote1_";
@ -370,6 +375,12 @@ public final class SettingsFile
return readFile(getGenericGameSettingsForAllRegions(gameId), true, view);
}
public static HashMap<String, SettingSection> readWiimoteProfile(final String gameId,
final String padId)
{
String profile = gameId + "_Wii" + padId;
return readFile(getWiiProfile(profile, padId), true, null);
}
/**
* Saves a Settings HashMap to a given .ini file on disk. If unsuccessful, outputs an error
@ -435,13 +446,43 @@ public final class SettingsFile
for (String settingKey : sortedKeySet)
{
Setting setting = settings.get(settingKey);
NativeLibrary
.SetUserSetting(gameId, mapSectionNameFromIni(section.getName()), setting.getKey(),
setting.getValueAsString());
// Special case. Extension gets saved into a controller profile
if (settingKey.contains(SettingsFile.KEY_WIIMOTE_EXTENSION))
{
saveCustomWiimoteSetting(gameId, setting);
}
else
{
NativeLibrary.SetUserSetting(gameId, mapSectionNameFromIni(section.getName()),
setting.getKey(), setting.getValueAsString());
}
}
}
}
/**
* Saves the extension value in a profile and enables that profile. Extension is the only
* controller setting that is not saved in the main config.
*
* @param gameId
* @param setting
*/
public static void saveCustomWiimoteSetting(final String gameId, final Setting setting)
{
if (setting.getSection().equals(Settings.SECTION_PROFILE))
return;
String padId =
setting.getKey().substring(setting.getKey().length() - 1, setting.getKey().length());
String profile = gameId + "_Wii" + padId;
NativeLibrary.SetProfileSetting(profile, Settings.SECTION_PROFILE, KEY_WIIMOTE_EXTENSION,
setting.getValueAsString());
// Enable the profile
NativeLibrary.SetUserSetting(gameId, Settings.SECTION_CONTROLS,
KEY_WIIMOTE_PROFILE + (Integer.valueOf(padId) + 1), profile);
}
private static String mapSectionNameFromIni(String generalSectionName)
{
if (sectionsMap.getForward(generalSectionName) != null)
@ -487,10 +528,32 @@ public final class SettingsFile
private static File getCustomGameSettingsFile(String gameId)
{
return new File(
DirectoryInitialization.getUserDirectory() + "/GameSettings/" + gameId + ".ini");
}
private static File getWiiProfile(String profile, String padId)
{
String wiiConfigPath =
DirectoryInitialization.getUserDirectory() + "/Config/Profiles/Wiimote/" +
profile + ".ini";
File wiiProfile = new File(wiiConfigPath);
// If it doesn't exist, create it
if (!wiiProfile.exists())
{
String defautlWiiProfilePath =
DirectoryInitialization.getUserDirectory() +
"/Config/Profiles/Wiimote/WiimoteProfile.ini";
DirectoryInitialization.copyFile(defautlWiiProfilePath, wiiConfigPath);
NativeLibrary.SetProfileSetting(profile, Settings.SECTION_PROFILE, "Device",
"Android/" + (Integer.valueOf(padId) + 4) + "/Touchscreen");
}
return wiiProfile;
}
private static SettingSection sectionFromLine(String line, boolean isCustomGame)
{
String sectionName = line.substring(1, line.length() - 1);
@ -626,4 +689,10 @@ public final class SettingsFile
{
return setting.getKey() + " = " + setting.getValueAsString();
}
private static String customWiimoteExtSettingAsString(Setting setting)
{
return setting.getKey().substring(0, setting.getKey().length() - 1) + " = " +
setting.getValueAsString();
}
}

View File

@ -16,6 +16,7 @@ import android.support.v4.content.LocalBroadcastManager;
import org.dolphinemu.dolphinemu.NativeLibrary;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@ -139,8 +140,14 @@ public final class DirectoryInitialization
//
// TODO: Redo the Android controller system so that we don't have to extract these INIs.
String configDirectory = NativeLibrary.GetUserDirectory() + File.separator + "Config";
String profileDirectory =
NativeLibrary.GetUserDirectory() + File.separator + "Config/Profiles/Wiimote/";
createWiimoteProfileDirectory(profileDirectory);
copyAsset("GCPadNew.ini", new File(configDirectory, "GCPadNew.ini"), true, context);
copyAsset("WiimoteNew.ini", new File(configDirectory, "WiimoteNew.ini"), false, context);
copyAsset("WiimoteProfile.ini", new File(profileDirectory, "WiimoteProfile.ini"), true,
context);
}
private static void deleteDirectoryRecursively(File file)
@ -247,6 +254,20 @@ public final class DirectoryInitialization
}
}
public static void copyFile(String from, String to)
{
try
{
InputStream in = new FileInputStream(from);
OutputStream out = new FileOutputStream(to);
copyFile(in, out);
}
catch (IOException e)
{
}
}
private static void copyFile(InputStream in, OutputStream out) throws IOException
{
byte[] buffer = new byte[1024];
@ -258,6 +279,15 @@ public final class DirectoryInitialization
}
}
private static void createWiimoteProfileDirectory(String directory)
{
File wiiPath = new File(directory);
if (!wiiPath.isDirectory())
{
wiiPath.mkdirs();
}
}
private static native void CreateUserDirectories();
private static native void SetSysDirectory(String path);

View File

@ -306,9 +306,17 @@
<item>Right Stick</item>
</string-array>
<string-array name="gameSettingsMenus">
<string-array name="gameSettingsMenusGC">
<item>Core Settings</item>
<item>GFX Settings</item>
<item>GameCube Controller Settings</item>
<item>Clear Game Settings</item>
</string-array>
<string-array name="gameSettingsMenusWii">
<item>Core Settings</item>
<item>GFX Settings</item>
<item>GameCube Controller Settings</item>
<item>Wii Controller Settings</item>
<item>Clear Game Settings</item>
</string-array>
</resources>

View File

@ -335,7 +335,7 @@ static void AddBind(const std::string& dev, sBind* bind)
m_controllers[dev]->AddBind(bind);
}
void Init()
void Init(const std::string& gameId)
{
// Initialize our touchScreenKey buttons
for (int a = 0; a < 8; ++a)
@ -592,6 +592,40 @@ void Init()
new sBind(padID, configTypes[a], type, bindnum, modifier == '-' ? -1.0f : 1.0f));
}
}
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + std::string(gameId + ".ini"));
for (u32 a = 0; a < configStrings.size(); ++a)
{
for (int padID = 0; padID < 8; ++padID)
{
std::ostringstream config;
config << configStrings[a] << "_" << padID;
BindType type;
int bindnum;
char dev[128];
bool hasbind = false;
char modifier = '+';
std::string value;
ini.GetOrCreateSection("Android")->Get(config.str(), &value, "None");
if (value == "None")
continue;
if (std::string::npos != value.find("Axis"))
{
hasbind = true;
type = BIND_AXIS;
sscanf(value.c_str(), "Device '%127[^\']'-Axis %d%c", dev, &bindnum, &modifier);
}
else if (std::string::npos != value.find("Button"))
{
hasbind = true;
type = BIND_BUTTON;
sscanf(value.c_str(), "Device '%127[^\']'-Button %d", dev, &bindnum);
}
if (hasbind)
AddBind(std::string(dev),
new sBind(padID, configTypes[a], type, bindnum, modifier == '-' ? -1.0f : 1.0f));
}
}
}
bool GetButtonPressed(int padID, ButtonType button)

View File

@ -250,7 +250,7 @@ public:
float AxisValue(int padID, ButtonType axis);
};
void Init();
void Init(const std::string&);
bool GetButtonPressed(int padID, ButtonType button);
float GetAxisValue(int padID, ButtonType axis);
bool GamepadEvent(const std::string& dev, int button, int action);

View File

@ -15,6 +15,7 @@
#include <string>
#include <thread>
#include <utility>
#include <UICommon/GameFile.h>
#include "Common/AndroidAnalytics.h"
#include "Common/CPUDetect.h"
@ -250,8 +251,10 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling
jboolean enable);
JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv* env, jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run__Ljava_lang_String_2Z(
JNIEnv* env, jobject obj, jstring jFile, jboolean jfirstOpen);
JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_Run__Ljava_lang_String_2Ljava_lang_String_2Z(
JNIEnv* env, jobject obj, jstring jFile, jstring jSavestate, jboolean jDeleteSavestate);
@ -381,6 +384,29 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserSetti
ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + gameid + ".ini");
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfileSetting(
JNIEnv* env, jobject obj, jstring jProfile, jstring jSection, jstring jKey, jstring jValue)
{
IniFile ini;
std::string profile = GetJString(env, jProfile);
std::string section = GetJString(env, jSection);
std::string key = GetJString(env, jKey);
std::string val = GetJString(env, jValue);
ini.Load(File::GetUserPath(D_CONFIG_IDX) + "Profiles/Wiimote/" + profile + ".ini");
if (val != "-1")
{
ini.GetOrCreateSection(section)->Set(key, val);
}
else
{
ini.GetOrCreateSection(section)->Delete(key);
}
ini.Save(File::GetUserPath(D_CONFIG_IDX) + "Profiles/Wiimote/" + profile + ".ini");
}
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(
JNIEnv* env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jDefault)
{
@ -539,7 +565,6 @@ static void Run(const std::string& path, bool first_open,
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", path.c_str());
// Install our callbacks
OSD::AddCallback(OSD::CallbackType::Initialization, ButtonManager::Init);
OSD::AddCallback(OSD::CallbackType::Shutdown, ButtonManager::Shutdown);
RegisterMsgAlertHandler(&MsgAlert);
@ -563,6 +588,7 @@ static void Run(const std::string& path, bool first_open,
WindowSystemInfo wsi(WindowSystemType::Android, nullptr, s_surf);
if (BootManager::BootCore(std::move(boot), wsi))
{
ButtonManager::Init(SConfig::GetInstance().GetGameID());
static constexpr int TIMEOUT = 10000;
static constexpr int WAIT_STEP = 25;
int time_waited = 0;