Skip to content
Permalink
Browse files

Merge pull request #7921 from zackhow/fixir

Android: Fix touch IR
  • Loading branch information...
JMC47 committed Apr 1, 2019
2 parents 32e330e + fd323e7 commit 42964e8531340bbf89345d9f2b23f72e9b497764
@@ -1,10 +1,4 @@
# RMCE01, RMCJ01, RMCK01, RMCP01 - Mario Kart Wii

[Controls]
IRHeight = 50
IRWidth = 30
IRCenter = 50

[Core]
# Values set here will override the main Dolphin settings.

@@ -1,10 +1,4 @@
# RMGE01, RMGJ01, RMGK01, RMGP01 - SUPER MARIO GALAXY

[Controls]
IRHeight = 50
IRWidth = 30
IRCenter = 50

[Core]
# Values set here will override the main Dolphin settings.

@@ -1,9 +1,4 @@
# RODE01, RODJ01, RODK01, RODP01 - WarioWare: Smooth Moves
[Controls]
IRHeight = 71
IRWidth = 64
IRCenter = 99

[Core]
# Values set here will override the main Dolphin settings.

@@ -1,9 +1,4 @@
# RUUE01, RUUJ01, RUUK01, RUUP01 - Animal Crossing Wii
[Controls]
IRHeight = 50
IRWidth = 30
IRCenter = 50

[Core]
# Values set here will override the main Dolphin settings.

@@ -1,9 +1,4 @@
# RZDE01, RZDJ01, RZDK01, RZDP01 - The Legend of Zelda: Twilight Princess [Wii]
[Controls]
IRHeight = 39
IRWidth = 37
IRCenter = 91

[Core]
# Values set here will override the main Dolphin settings.

@@ -1,9 +1,4 @@
# SB4E01, SB4J01, SB4P01 - Super Mario Galaxy 2
[Controls]
IRHeight = 50
IRWidth = 30
IRCenter = 50

[Core]
# Values set here will override the main Dolphin settings.

@@ -19,7 +19,7 @@ IR/Forward = `Axis 116`
IR/Backward = `Axis 117`
IR/Hide = `Button 118`
IR/Height = 50
IR/Width = 30
IR/Width = 50
IR/Center = 50
Swing/Up = `Axis 120`
Swing/Down = `Axis 121`
@@ -158,7 +158,7 @@ IR/Forward = `Axis 116`
IR/Backward = `Axis 117`
IR/Hide = `Button 118`
IR/Height = 50
IR/Width = 30
IR/Width = 50
IR/Center = 50
Swing/Up = `Axis 120`
Swing/Down = `Axis 121`
@@ -297,7 +297,7 @@ IR/Forward = `Axis 116`
IR/Backward = `Axis 117`
IR/Hide = `Button 118`
IR/Height = 50
IR/Width = 30
IR/Width = 50
IR/Center = 50
Swing/Up = `Axis 120`
Swing/Down = `Axis 121`
@@ -436,7 +436,7 @@ IR/Forward = `Axis 116`
IR/Backward = `Axis 117`
IR/Hide = `Button 118`
IR/Height = 50
IR/Width = 30
IR/Width = 50
IR/Center = 50
Swing/Up = `Axis 120`
Swing/Down = `Axis 121`
@@ -19,7 +19,7 @@ IR/Forward = `Axis 116`
IR/Backward = `Axis 117`
IR/Hide = `Button 118`
IR/Height = 50
IR/Width = 30
IR/Width = 50
IR/Center = 50
Swing/Up = `Axis 120`
Swing/Down = `Axis 121`
@@ -298,12 +298,14 @@ public boolean onTouch(View v, MotionEvent event)
if (!pressed && overlayPointer != null)
{
overlayPointer.onTouch(event);
float[] axises = overlayPointer.getAxisValues();
float[] axes = overlayPointer.getAxisValues();

NativeLibrary.onGamePadMoveEvent(NativeLibrary.TouchScreenDevice, ButtonType.WIIMOTE_IR + 2,
axises[0]);
NativeLibrary.onGamePadMoveEvent(NativeLibrary.TouchScreenDevice, ButtonType.WIIMOTE_IR + 4,
axises[1]);
for (int i = 0; i < 4; i++)
{
NativeLibrary
.onGamePadMoveEvent(NativeLibrary.TouchScreenDevice, ButtonType.WIIMOTE_IR_UP + i,
axes[i]);
}
}

invalidate();
@@ -127,9 +127,11 @@ private void touchPress()

public float[] getAxisValues()
{
float[] ir = {0f, 0f};
ir[0] = axes[0];
ir[1] = axes[1];
return axes;
float[] iraxes = {0f, 0f, 0f, 0f};
iraxes[1] = axes[0];
iraxes[0] = axes[0];
iraxes[3] = axes[1];
iraxes[2] = axes[1];
return iraxes;
}
}
@@ -34,6 +34,7 @@
"org.dolphinemu.dolphinemu.DIRECTORY_INITIALIZATION";

public static final String EXTRA_STATE = "directoryState";
private static final Integer WiimoteNewVersion = 2;
private static volatile DirectoryInitializationState directoryState = null;
private static String userPath;
private static String internalPath;
@@ -145,7 +146,20 @@ private static void initializeExternalStorage(Context context)
createWiimoteProfileDirectory(profileDirectory);

copyAsset("GCPadNew.ini", new File(configDirectory, "GCPadNew.ini"), true, context);
copyAsset("WiimoteNew.ini", new File(configDirectory, "WiimoteNew.ini"), false, context);

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getInt("WiimoteNewVersion", 0) != WiimoteNewVersion)
{
copyAsset("WiimoteNew.ini", new File(configDirectory, "WiimoteNew.ini"), true, context);
SharedPreferences.Editor sPrefsEditor = prefs.edit();
sPrefsEditor.putInt("WiimoteNewVersion", WiimoteNewVersion);
sPrefsEditor.apply();
}
else
{
copyAsset("WiimoteNew.ini", new File(configDirectory, "WiimoteNew.ini"), false, context);
}

copyAsset("WiimoteProfile.ini", new File(profileDirectory, "WiimoteProfile.ini"), true,
context);
}

0 comments on commit 42964e8

Please sign in to comment.
You can’t perform that action at this time.