mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Merge pull request #8739 from Ebola16/GCOVERLAY
Android: Separate GameCube overlay refresh logic
This commit is contained in:
commit
08c93adde2
@ -814,7 +814,7 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
|
||||
|
||||
int currentController =
|
||||
mPreferences.getInt("wiiController", InputOverlay.OVERLAY_WIIMOTE_NUNCHUCK);
|
||||
mPreferences.getInt("wiiController", InputOverlay.OVERLAY_WIIMOTE_NUNCHUK);
|
||||
|
||||
int currentValue = mPreferences.getInt("doubleTapButton",
|
||||
InputOverlayPointer.DOUBLE_TAP_OPTIONS.get(InputOverlayPointer.DOUBLE_TAP_A));
|
||||
|
@ -119,6 +119,7 @@ public final class SettingsFile
|
||||
public static final String KEY_DEBUG_JITREGISTERCACHEOFF = "JitRegisterCacheOff";
|
||||
|
||||
public static final String KEY_GCPAD_TYPE = "SIDevice";
|
||||
public static final String KEY_GCPAD_PLAYER_1 = "SIDevice0";
|
||||
public static final String KEY_GCPAD_G_TYPE = "PadType";
|
||||
|
||||
public static final String KEY_GCBIND_A = "InputA_";
|
||||
|
@ -24,12 +24,15 @@ import android.view.MotionEvent;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.View.OnTouchListener;
|
||||
import android.widget.Toast;
|
||||
|
||||
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 org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@ -44,14 +47,20 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
public static final int OVERLAY_GAMECUBE = 0;
|
||||
public static final int OVERLAY_WIIMOTE = 1;
|
||||
public static final int OVERLAY_WIIMOTE_SIDEWAYS = 2;
|
||||
public static final int OVERLAY_WIIMOTE_NUNCHUCK = 3;
|
||||
public static final int OVERLAY_WIIMOTE_NUNCHUK = 3;
|
||||
public static final int OVERLAY_WIIMOTE_CLASSIC = 4;
|
||||
public static final int OVERLAY_NONE = 5;
|
||||
|
||||
private static final String DISABLED_GAMECUBE_CONTROLLER = "0";
|
||||
private static final String EMULATED_GAMECUBE_CONTROLLER = "6";
|
||||
private static final String GAMECUBE_ADAPTER = "12";
|
||||
|
||||
private final Set<InputOverlayDrawableButton> overlayButtons = new HashSet<>();
|
||||
private final Set<InputOverlayDrawableDpad> overlayDpads = new HashSet<>();
|
||||
private final Set<InputOverlayDrawableJoystick> overlayJoysticks = new HashSet<>();
|
||||
private InputOverlayPointer overlayPointer;
|
||||
|
||||
private boolean mIsFirstRun = true;
|
||||
private boolean mIsInEditMode = false;
|
||||
private InputOverlayDrawableButton mButtonBeingConfigured;
|
||||
private InputOverlayDrawableDpad mDpadBeingConfigured;
|
||||
@ -135,7 +144,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
int doubleTapButton = mPreferences.getInt("doubleTapButton",
|
||||
InputOverlayPointer.DOUBLE_TAP_OPTIONS.get(InputOverlayPointer.DOUBLE_TAP_A));
|
||||
|
||||
if (mPreferences.getInt("wiiController", OVERLAY_WIIMOTE_NUNCHUCK) !=
|
||||
if (mPreferences.getInt("wiiController", OVERLAY_WIIMOTE_NUNCHUK) !=
|
||||
InputOverlay.OVERLAY_WIIMOTE_CLASSIC &&
|
||||
doubleTapButton == InputOverlayPointer.DOUBLE_TAP_CLASSIC_A)
|
||||
{
|
||||
@ -692,24 +701,56 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
if (mPreferences.getBoolean("showInputOverlay", true))
|
||||
{
|
||||
// Add all the enabled overlay items back to the HashSet.
|
||||
if (EmulationActivity.isGameCubeGame() || mPreferences.getInt("wiiController", 3) == 0)
|
||||
if (EmulationActivity.isGameCubeGame())
|
||||
{
|
||||
addGameCubeOverlayControls(orientation);
|
||||
}
|
||||
else if (mPreferences.getInt("wiiController", 3) == 4)
|
||||
{
|
||||
addClassicOverlayControls(orientation);
|
||||
switch (NativeLibrary
|
||||
.GetConfig(SettingsFile.FILE_NAME_DOLPHIN + ".ini", Settings.SECTION_INI_CORE,
|
||||
SettingsFile.KEY_GCPAD_PLAYER_1, EMULATED_GAMECUBE_CONTROLLER))
|
||||
{
|
||||
case DISABLED_GAMECUBE_CONTROLLER:
|
||||
if (mIsFirstRun)
|
||||
{
|
||||
Toast.makeText(getContext(), R.string.disabled_gc_overlay_notice, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
break;
|
||||
|
||||
case EMULATED_GAMECUBE_CONTROLLER:
|
||||
addGameCubeOverlayControls(orientation);
|
||||
break;
|
||||
|
||||
case GAMECUBE_ADAPTER:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addWiimoteOverlayControls(orientation);
|
||||
if (mPreferences.getInt("wiiController", 3) == 3)
|
||||
switch (mPreferences.getInt("wiiController", 3))
|
||||
{
|
||||
addNunchukOverlayControls(orientation);
|
||||
case OVERLAY_GAMECUBE:
|
||||
addGameCubeOverlayControls(orientation);
|
||||
break;
|
||||
|
||||
case OVERLAY_WIIMOTE:
|
||||
case OVERLAY_WIIMOTE_SIDEWAYS:
|
||||
addWiimoteOverlayControls(orientation);
|
||||
break;
|
||||
|
||||
case OVERLAY_WIIMOTE_NUNCHUK:
|
||||
addWiimoteOverlayControls(orientation);
|
||||
addNunchukOverlayControls(orientation);
|
||||
break;
|
||||
|
||||
case OVERLAY_WIIMOTE_CLASSIC:
|
||||
addClassicOverlayControls(orientation);
|
||||
break;
|
||||
|
||||
case OVERLAY_NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mIsFirstRun = false;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
@ -82,9 +82,9 @@
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_emulation_configure_controls"
|
||||
android:id="@+id/menu_emulation_overlay_controls"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/emulation_configure_controls">
|
||||
android:title="@string/emulation_overlay_controls">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_emulation_edit_layout"
|
||||
|
@ -82,9 +82,9 @@
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_emulation_configure_controls"
|
||||
android:id="@+id/menu_emulation_overlay_controls"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/emulation_configure_controls">
|
||||
android:title="@string/emulation_overlay_controls">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_emulation_edit_layout"
|
||||
|
@ -277,6 +277,7 @@
|
||||
<item>Horizontal Wii Remote</item>
|
||||
<item>Wii Remote + Nunchuk</item>
|
||||
<item>Classic Controller</item>
|
||||
<item>None</item>
|
||||
</string-array>
|
||||
<string-array name="controllersValues">
|
||||
<item>None</item>
|
||||
@ -284,6 +285,7 @@
|
||||
<item>None</item>
|
||||
<item>Nunchuk</item>
|
||||
<item>Classic</item>
|
||||
<item>None</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="gcpadButtons">
|
||||
|
@ -332,7 +332,7 @@
|
||||
<string name="emulation_quicksave">Quick Save</string>
|
||||
<string name="emulation_quickload">Quick Load</string>
|
||||
<string name="emulation_refresh_wiimotes">Refresh Wii Remotes</string>
|
||||
<string name="emulation_configure_controls">Configure Controls</string>
|
||||
<string name="emulation_overlay_controls">Overlay Controls</string>
|
||||
<string name="emulation_edit_layout">Edit Layout</string>
|
||||
<string name="emulation_done">Done</string>
|
||||
<string name="emulation_toggle_controls">Toggle Controls</string>
|
||||
@ -378,5 +378,6 @@
|
||||
<string name="yaw">Total Yaw</string>
|
||||
<string name="vertical_offset">Vertical Offset</string>
|
||||
<string name="disc_number">Disc %1$d</string>
|
||||
<string name="disabled_gc_overlay_notice">GameCube Controller 1 is set to \"None\"</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user