Skip to content

Commit

Permalink
Merge pull request dolphin-emu#7921 from zackhow/fixir
Browse files Browse the repository at this point in the history
Android: Fix touch IR
  • Loading branch information
JMC47 authored Apr 1, 2019
2 parents 32e330e + fd323e7 commit 42964e8
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 47 deletions.
6 changes: 0 additions & 6 deletions Data/Sys/GameSettings/RMC.ini
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
6 changes: 0 additions & 6 deletions Data/Sys/GameSettings/RMG.ini
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
5 changes: 0 additions & 5 deletions Data/Sys/GameSettings/ROD.ini
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
5 changes: 0 additions & 5 deletions Data/Sys/GameSettings/RUU.ini
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
5 changes: 0 additions & 5 deletions Data/Sys/GameSettings/RZD.ini
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
5 changes: 0 additions & 5 deletions Data/Sys/GameSettings/SB4.ini
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
8 changes: 4 additions & 4 deletions Source/Android/app/src/main/assets/WiimoteNew.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion Source/Android/app/src/main/assets/WiimoteProfile.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public final class DirectoryInitialization
"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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 42964e8

Please sign in to comment.