Permalink
Browse files

Android: Add game specific gc/wii controller settings

  • Loading branch information...
zackhow committed Aug 26, 2018
1 parent f1413db commit 5d93a10c60f25acd4f9045234156fd68720b1a87
Showing with 704 additions and 282 deletions.
  1. +135 −0 Source/Android/app/src/main/assets/WiimoteProfile.ini
  2. +3 −0 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java
  3. +6 −43 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java
  4. +15 −57 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.java
  5. +98 −0 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameSettingsDialog.java
  6. +7 −1 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java
  7. +10 −1 ...app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InputBindingSetting.java
  8. +2 −1 ...ndroid/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.java
  9. +24 −6 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java
  10. +227 −164 ...d/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
  11. +3 −2 ...java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java
  12. +72 −3 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java
  13. +30 −0 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryInitialization.java
  14. +9 −1 Source/Android/app/src/main/res/values/arrays.xml
  15. +35 −1 Source/Android/jni/ButtonManager.cpp
  16. +1 −1 Source/Android/jni/ButtonManager.h
  17. +27 −1 Source/Android/jni/MainAndroid.cpp
@@ -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`
@@ -248,6 +248,9 @@ public static void rumble(int padID, double state)
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);
/**
@@ -12,10 +12,12 @@
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 boolean onLongClick(View view)
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;
}
@@ -14,6 +14,7 @@
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 void onBindViewHolder(ViewHolder viewHolder, Object item)
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())
{
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;
}
FragmentActivity activity = (FragmentActivity) view.getContext();
String gameId = gameFile.getGameId();
if (gameId.isEmpty())
{
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)
{
Oops, something went wrong.

0 comments on commit 5d93a10

Please sign in to comment.