Android: More on-screen buttons

GameCube now has a c-stick. For Wii games, there is now a Wiimote + Nunchuk setup.
This commit is contained in:
Sean Maas 2016-09-21 23:03:32 -04:00
parent bd99b318e5
commit 50b44fa337
19 changed files with 51 additions and 15 deletions

View File

@ -33,7 +33,7 @@ Tilt/Modifier/Range = 50,000000
Shake/X = `Button 132`
Shake/Y = `Button 133`
Shake/Z = `Button 134`
Extension = None
Extension = Nunchuk
Nunchuk/Buttons/C = `Button 200`
Nunchuk/Buttons/Z = `Button 201`
Nunchuk/Stick/Up = `Axis 203`

View File

@ -55,6 +55,8 @@ public final class EmulationActivity extends AppCompatActivity
private boolean mSystemUiVisible;
private boolean mMenuVisible;
private static boolean mIsGameCubeGame;
/**
* Handlers are a way to pass a message to an Activity telling it to do something
* on the UI thread. This Handler responds to any message, even blank ones, by
@ -209,6 +211,8 @@ public final class EmulationActivity extends AppCompatActivity
menuFragment.setTitleText(mSelectedTitle);
}
}
mIsGameCubeGame = (NativeLibrary.GetPlatform(path) == 0);
}
@Override
@ -667,6 +671,11 @@ public final class EmulationActivity extends AppCompatActivity
return mSelectedTitle;
}
public static boolean isGameCubeGame()
{
return mIsGameCubeGame;
}
public static void launch(Activity activity, String path, String title, String screenshotPath, int position, View sharedView)
{
Intent launcher = new Intent(activity, EmulationActivity.class);

View File

@ -26,6 +26,7 @@ import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.NativeLibrary.ButtonState;
import org.dolphinemu.dolphinemu.NativeLibrary.ButtonType;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
import java.util.HashSet;
import java.util.Set;
@ -78,20 +79,46 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
super(context, attrs);
// Add all the overlay items to the HashSet.
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_a, ButtonType.BUTTON_A));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_b, ButtonType.BUTTON_B));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_x, ButtonType.BUTTON_X));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_y, ButtonType.BUTTON_Y));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_z, ButtonType.BUTTON_Z));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_start, ButtonType.BUTTON_START));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_l, ButtonType.TRIGGER_L));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_r, ButtonType.TRIGGER_R));
overlayDpads.add(initializeOverlayDpad(context, R.drawable.gcpad_dpad,
ButtonType.BUTTON_UP, ButtonType.BUTTON_DOWN,
ButtonType.BUTTON_LEFT, ButtonType.BUTTON_RIGHT));
overlayJoysticks.add(initializeOverlayJoystick(context,
R.drawable.gcpad_joystick_range, R.drawable.gcpad_joystick,
ButtonType.STICK_MAIN));
if (EmulationActivity.isGameCubeGame())
{
// GameCube
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_a, ButtonType.BUTTON_A));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_b, ButtonType.BUTTON_B));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_x, ButtonType.BUTTON_X));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_y, ButtonType.BUTTON_Y));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_z, ButtonType.BUTTON_Z));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_start, ButtonType.BUTTON_START));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_l, ButtonType.TRIGGER_L));
overlayButtons.add(initializeOverlayButton(context, R.drawable.gcpad_r, ButtonType.TRIGGER_R));
overlayDpads.add(initializeOverlayDpad(context, R.drawable.gcwii_dpad,
ButtonType.BUTTON_UP, ButtonType.BUTTON_DOWN,
ButtonType.BUTTON_LEFT, ButtonType.BUTTON_RIGHT));
overlayJoysticks.add(initializeOverlayJoystick(context,
R.drawable.gcwii_joystick_range, R.drawable.gcwii_joystick,
ButtonType.STICK_MAIN));
overlayJoysticks.add(initializeOverlayJoystick(context,
R.drawable.gcwii_joystick_range, R.drawable.gcpad_c,
ButtonType.STICK_C));
}
else
{
// Wiimote + Nunchuk
overlayButtons.add(initializeOverlayButton(context, R.drawable.wiimote_a, ButtonType.WIIMOTE_BUTTON_A));
overlayButtons.add(initializeOverlayButton(context, R.drawable.wiimote_b, ButtonType.WIIMOTE_BUTTON_B));
overlayButtons.add(initializeOverlayButton(context, R.drawable.wiimote_one, ButtonType.WIIMOTE_BUTTON_1));
overlayButtons.add(initializeOverlayButton(context, R.drawable.wiimote_two, ButtonType.WIIMOTE_BUTTON_2));
overlayButtons.add(initializeOverlayButton(context, R.drawable.wiimote_plus, ButtonType.WIIMOTE_BUTTON_PLUS));
overlayButtons.add(initializeOverlayButton(context, R.drawable.wiimote_minus, ButtonType.WIIMOTE_BUTTON_MINUS));
overlayButtons.add(initializeOverlayButton(context, R.drawable.wiimote_home, ButtonType.WIIMOTE_BUTTON_HOME));
overlayButtons.add(initializeOverlayButton(context, R.drawable.nunchuk_c, ButtonType.NUNCHUK_BUTTON_C));
overlayButtons.add(initializeOverlayButton(context, R.drawable.nunchuk_z, ButtonType.NUNCHUK_BUTTON_Z));
overlayDpads.add(initializeOverlayDpad(context, R.drawable.gcwii_dpad,
ButtonType.WIIMOTE_UP, ButtonType.WIIMOTE_DOWN,
ButtonType.WIIMOTE_LEFT, ButtonType.WIIMOTE_RIGHT));
overlayJoysticks.add(initializeOverlayJoystick(context,
R.drawable.gcwii_joystick_range, R.drawable.gcwii_joystick,
ButtonType.NUNCHUK_STICK));
}
// Set the on touch listener.
setOnTouchListener(this);

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB