android: fix navbar background. Add shortcuts for Coin/Service/Test

Fix black navigation bar background.
Shortcuts for virtual gamepad:
RT + A -> D (Coint)
RT + B -> C (Service)
RT + X -> Z (Test)
Issue #137

Don't deliver mouse clicks if analog triggers or stick are used
This commit is contained in:
Flyinghead 2021-08-11 12:58:57 +02:00
parent 6f233462c1
commit c27180fb32
4 changed files with 18 additions and 3 deletions

View File

@ -50,7 +50,8 @@
android:name="com.reicast.emulator.NativeGLActivity"
android:configChanges="orientation|navigation|screenSize|screenLayout|uiMode|keyboard|keyboardHidden"
android:screenOrientation="sensorLandscape"
android:exported="true"/>
android:exported="true"
android:theme="@style/Theme.AppCompat.NoActionBar"/>
<activity-alias
android:name="com.reicast.emulator.MainActivity"
android:targetActivity="com.reicast.emulator.NativeGLActivity">

View File

@ -42,6 +42,7 @@ import tv.ouya.console.api.OuyaController;
import static android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
public abstract class BaseGLActivity extends Activity implements ActivityCompat.OnRequestPermissionsResultCallback {
@ -66,7 +67,7 @@ public abstract class BaseGLActivity extends Activity implements ActivityCompat.
// Set the navigation bar color to 0 to avoid left over when it fades out on Android 10
Window window = getWindow();
window.addFlags(FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(FLAG_TRANSLUCENT_STATUS);
window.clearFlags(FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION);
window.setNavigationBarColor(0);
window.getDecorView().setSystemUiVisibility(SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}

View File

@ -358,7 +358,8 @@ public class VirtualJoystickDelegate {
int joyy = get_anal(11, 1);
InputDeviceManager.getInstance().virtualGamepadEvent(rv, joyx, joyy, left_trigger, right_trigger);
// Only register the mouse event if no virtual gamepad button is down
if ((!editVjoyMode && rv == 0xFFFFFFFF) || JNIdc.guiIsOpen())
if ((!editVjoyMode && rv == 0xFFFFFFFF && left_trigger == 0 && right_trigger == 0 && joyx == 0 && joyy == 0)
|| JNIdc.guiIsOpen())
InputDeviceManager.getInstance().mouseEvent(mouse_pos[0], mouse_pos[1], mouse_btns);
return(true);
}

View File

@ -269,6 +269,18 @@ public:
kcode = 0xffffffff;
joyx = joyy = rt = lt = 0;
}
if (rt > 0)
{
if ((kcode & DC_BTN_A) == 0)
// RT + A -> D (coin)
kcode &= ~DC_BTN_D;
if ((kcode & DC_BTN_B) == 0)
// RT + B -> C (service)
kcode &= ~DC_BTN_C;
if ((kcode & DC_BTN_X) == 0)
// RT + X -> Z (test)
kcode &= ~DC_BTN_Z;
}
u32 changes = kcode ^ previous_kcode;
for (int i = 0; i < 32; i++)
if (changes & (1 << i))