add virtual on buttons fix boost button

This commit is contained in:
izzy2lost
2026-01-07 21:53:38 -05:00
parent 6a24b2b9e8
commit ef87741c02
6 changed files with 100 additions and 4 deletions
+2 -2
View File
@@ -12,8 +12,8 @@ android {
minSdk = 26
targetSdk = 36
versionCode = 3
versionName = "1.0.2"
versionCode = 4
versionName = "1.0.3"
ndkVersion = "29.0.14206865"
@@ -176,6 +176,12 @@ void AndroidInputSystem::ApplyConfig(const Util::Config::Node& config)
m_touchSpikeCharge.a = keySc(get("InputCharge", "KEY_D"), SDL_SCANCODE_D);
m_touchSpikeJump.a = keySc(get("InputJump", "KEY_F"), SDL_SCANCODE_F);
m_touchTwinJump.a = keySc(get("InputTwinJoyJump", "KEY_E"), SDL_SCANCODE_E);
{
const SDL_Scancode turbo1 = keySc(get("InputTwinJoyTurbo1", "KEY_Z"), SDL_SCANCODE_Z);
m_touchTwinBoost = {turbo1, SDL_SCANCODE_UNKNOWN};
}
m_touchFishingCast.a = keySc(get("InputFishingCast", "KEY_Z"), SDL_SCANCODE_Z);
m_touchFishingSelect.a = keySc(get("InputFishingSelect", "KEY_X"), SDL_SCANCODE_X);
m_touchFishingReel.a = keySc(get("InputFishingReel", "KEY_SPACE"), SDL_SCANCODE_SPACE);
@@ -353,6 +359,8 @@ void AndroidInputSystem::HandleTouch(const SDL_TouchFingerEvent& tf, bool down)
case 1116: SetKeys(m_touchSpikeBeat, down); return;
case 1117: SetKeys(m_touchSpikeCharge, down); return;
case 1118: SetKeys(m_touchSpikeJump, down); return;
case 1150: SetKeys(m_touchTwinJump, down); return;
case 1151: SetKeys(m_touchTwinBoost, down); return;
case 1120: SetKeys(m_touchFishingCast, down); return;
case 1121: SetKeys(m_touchFishingSelect, down); return;
case 1122: SetKeys(m_touchFishingReel, down); return;
@@ -141,6 +141,11 @@ private:
DualScancode m_touchSpikeCharge{SDL_SCANCODE_D, SDL_SCANCODE_UNKNOWN};
DualScancode m_touchSpikeJump{SDL_SCANCODE_F, SDL_SCANCODE_UNKNOWN};
// Virtual-On (twin joystick) macros/buttons.
DualScancode m_touchTwinJump{SDL_SCANCODE_E, SDL_SCANCODE_UNKNOWN};
// Map a single "Boost" button to Turbo1 by default (Virtual-On has separate left/right turbo buttons).
DualScancode m_touchTwinBoost{SDL_SCANCODE_Z, SDL_SCANCODE_UNKNOWN};
DualScancode m_touchFishingCast{SDL_SCANCODE_Z, SDL_SCANCODE_UNKNOWN};
DualScancode m_touchFishingSelect{SDL_SCANCODE_X, SDL_SCANCODE_UNKNOWN};
DualScancode m_touchFishingReel{SDL_SCANCODE_SPACE, SDL_SCANCODE_UNKNOWN};
+15
View File
@@ -276,6 +276,21 @@ struct Super3Host {
ensureKeyboardFallback("InputCharge", "KEY_D");
ensureKeyboardFallback("InputJump", "KEY_F");
// Virtual-On (twin joystick) macros/buttons: keep keyboard fallbacks so touch controls work even
// if the user remaps to joystick-only.
ensureKeyboardFallback("InputTwinJoyTurnLeft", "KEY_Q");
ensureKeyboardFallback("InputTwinJoyTurnRight", "KEY_W");
ensureKeyboardFallback("InputTwinJoyForward", "KEY_UP");
ensureKeyboardFallback("InputTwinJoyReverse", "KEY_DOWN");
ensureKeyboardFallback("InputTwinJoyStrafeLeft", "KEY_LEFT");
ensureKeyboardFallback("InputTwinJoyStrafeRight", "KEY_RIGHT");
ensureKeyboardFallback("InputTwinJoyJump", "KEY_E");
ensureKeyboardFallback("InputTwinJoyCrouch", "KEY_R");
ensureKeyboardFallback("InputTwinJoyShot1", "KEY_A");
ensureKeyboardFallback("InputTwinJoyShot2", "KEY_S");
ensureKeyboardFallback("InputTwinJoyTurbo1", "KEY_Z");
ensureKeyboardFallback("InputTwinJoyTurbo2", "KEY_X");
inputSystem.ApplyConfig(config);
}
@@ -143,7 +143,12 @@ class Super3Activity : SDLActivity() {
val isSoccer =
game.isNotBlank() &&
gamesXml.isNotBlank() &&
GameInputsIndex.hasAnyInputType(gamesXml, game, setOf("soccer", "twin_joysticks"))
GameInputsIndex.hasAnyInputType(gamesXml, game, setOf("soccer"))
val isTwinJoysticks =
game.isNotBlank() &&
gamesXml.isNotBlank() &&
GameInputsIndex.hasAnyInputType(gamesXml, game, setOf("twin_joysticks"))
val isFishing =
game.isNotBlank() &&
@@ -170,7 +175,7 @@ class Super3Activity : SDLActivity() {
gamesXml.isNotBlank() &&
GameInputsIndex.hasAnyInputType(gamesXml, game, setOf("spikeout"))
val showFightButtons = isFighting || isSpikeout || isSoccer || isFishing || isSki
val showFightButtons = isFighting || isSpikeout || isSoccer || isTwinJoysticks || isFishing || isSki
val showFightStick = showFightButtons || isMagTruck
val shifterEnabled = getSharedPreferences("super3_prefs", MODE_PRIVATE)
@@ -195,6 +200,9 @@ class Super3Activity : SDLActivity() {
overlay.findViewById<View>(R.id.overlay_fight_buttons)?.visibility =
if (showFightButtons) View.VISIBLE else View.GONE
overlay.findViewById<View>(R.id.overlay_vo_row)?.visibility =
if (isTwinJoysticks) View.VISIBLE else View.GONE
fun nativeTouch(action: Int, fingerId: Int, x: Float, y: Float, p: Float = 1.0f) {
SDLActivity.onNativeTouch(0, fingerId, action, x, y, p)
}
@@ -274,6 +282,11 @@ class Super3Activity : SDLActivity() {
bindHeld(R.id.overlay_fight_escape, fingerId = baseId + 3, x = 0.82f, y = 0.35f)
}
if (isTwinJoysticks) {
bindHeld(R.id.overlay_vo_jump, fingerId = 1150, x = 0.85f, y = 0.60f)
bindHeld(R.id.overlay_vo_boost, fingerId = 1151, x = 0.92f, y = 0.60f)
}
if (showFightStick) {
val stick = overlay.findViewById<FrameLayout>(R.id.overlay_fight_stick)
val knob = overlay.findViewById<View>(R.id.overlay_fight_stick_knob)
@@ -330,5 +330,60 @@
app:strokeWidth="2dp" />
</LinearLayout>
<Space
android:layout_width="match_parent"
android:layout_height="12dp" />
<LinearLayout
android:id="@+id/overlay_vo_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="end"
android:visibility="gone">
<com.google.android.material.button.MaterialButton
android:id="@+id/overlay_vo_jump"
style="?attr/materialButtonOutlinedStyle"
android:layout_width="62dp"
android:layout_height="62dp"
android:contentDescription="Jump"
android:insetLeft="0dp"
android:insetTop="0dp"
android:insetRight="0dp"
android:insetBottom="0dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:text="JMP"
android:textAllCaps="true"
android:textSize="14sp"
app:cornerRadius="31dp"
app:rippleColor="@color/overlay_ripple"
app:strokeWidth="2dp" />
<Space
android:layout_width="10dp"
android:layout_height="match_parent" />
<com.google.android.material.button.MaterialButton
android:id="@+id/overlay_vo_boost"
style="?attr/materialButtonOutlinedStyle"
android:layout_width="62dp"
android:layout_height="62dp"
android:contentDescription="Boost"
android:insetLeft="0dp"
android:insetTop="0dp"
android:insetRight="0dp"
android:insetBottom="0dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:text="BST"
android:textAllCaps="true"
android:textSize="14sp"
app:cornerRadius="31dp"
app:rippleColor="@color/overlay_ripple"
app:strokeWidth="2dp" />
</LinearLayout>
</LinearLayout>
</FrameLayout>