From b19209614a78c683f0f2f9841844be04da46674d Mon Sep 17 00:00:00 2001 From: weihuoya Date: Thu, 4 Aug 2022 20:47:58 +0800 Subject: [PATCH] fx launch from other frontend --- .../java/org/citra/emu/overlay/InputOverlay.java | 6 +++++- .../java/org/citra/emu/ui/EmulationActivity.java | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/android/app/src/main/java/org/citra/emu/overlay/InputOverlay.java b/src/android/app/src/main/java/org/citra/emu/overlay/InputOverlay.java index 20de7f4a5df..614f4b14745 100644 --- a/src/android/app/src/main/java/org/citra/emu/overlay/InputOverlay.java +++ b/src/android/app/src/main/java/org/citra/emu/overlay/InputOverlay.java @@ -84,6 +84,8 @@ public interface InputObject { private boolean mIsLandscape = false; private boolean mInEditMode = false; private boolean mBeingMoved = false; + private int mInEditPosX = 0; + private int mInEditPosY = 0; private InputObject mInputBeingConfigured; private InputOverlayPointer mOverlayPointer; private Paint mPaint; @@ -279,6 +281,8 @@ public boolean onTouchWhileEditing(MotionEvent event) { return false; } mBeingMoved = false; + mInEditPosX = pointerX; + mInEditPosY = pointerY; for (InputObject input : mInputObjects) { if (input.getBounds().contains(pointerX, pointerY)) { mInputBeingConfigured = input; @@ -299,7 +303,7 @@ public boolean onTouchWhileEditing(MotionEvent event) { case MotionEvent.ACTION_POINTER_UP: if (mInputBeingConfigured != null) { int id = mInputBeingConfigured.getButtonId(); - if (mBeingMoved) { + if (mBeingMoved && (mInEditPosX != pointerX || mInEditPosY != pointerY)) { saveControlPosition(id, mInputBeingConfigured.getBounds()); } else { mInputVisibles.put(id, !mInputVisibles.get(id)); diff --git a/src/android/app/src/main/java/org/citra/emu/ui/EmulationActivity.java b/src/android/app/src/main/java/org/citra/emu/ui/EmulationActivity.java index 84639ca02a8..f3544fa7c95 100644 --- a/src/android/app/src/main/java/org/citra/emu/ui/EmulationActivity.java +++ b/src/android/app/src/main/java/org/citra/emu/ui/EmulationActivity.java @@ -52,9 +52,6 @@ public final class EmulationActivity extends AppCompatActivity { private class InitTask extends AsyncTask> { @Override protected Map doInBackground(Context... contexts) { - if (!CitraDirectory.isInitialized()) { - CitraDirectory.start(contexts[0]); - } Settings settings = new Settings(); settings.loadSettings(mGameId); SettingSection section = settings.getSection(Settings.SECTION_INI_CORE); @@ -114,6 +111,15 @@ protected void onCreate(Bundle savedInstanceState) { mGamePath = savedInstanceState.getString(EXTRA_GAME_PATH); } + if (!CitraDirectory.isInitialized()) { + CitraDirectory.start(this); + } + + if (mGameId == null || mGameId.isEmpty()) { + mGameId = NativeLibrary.GetAppId(mGamePath); + mGameName = NativeLibrary.GetAppTitle(mGamePath); + } + // Find or create the EmulationFragment mEmulationFragment = (EmulationFragment)getSupportFragmentManager().findFragmentById( R.id.fragment_emulation);