From eced02835b5527b31a71925f99ff51c45ba1854d Mon Sep 17 00:00:00 2001 From: kone <70107937+konekowo@users.noreply.github.com> Date: Wed, 19 Apr 2023 08:31:03 -0400 Subject: [PATCH] mobile support part 2 --- javascript/index.html | 291 ++++++++++++++++++ .../v1_8/internal/PlatformRuntime.java | 6 + 2 files changed, 297 insertions(+) diff --git a/javascript/index.html b/javascript/index.html index 50cdeb2d..115502e3 100644 --- a/javascript/index.html +++ b/javascript/index.html @@ -109,6 +109,10 @@ let tooLate = false; let patchNumber; + if (localStorage.getItem("isTabSettingsModEnabled") == null){ + localStorage.setItem("isTabSettingsModEnabled", false); + } + if (localStorage.getItem("isTabSettingsModEnabled")){ document.title = localStorage.getItem("tabTitle"); document.getElementById("favicon").href = localStorage.getItem("imageBase64"); @@ -315,6 +319,21 @@ } }); + + +
@@ -328,7 +347,279 @@
+ +
+ \ No newline at end of file diff --git a/src/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java b/src/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java index 64fd5ea1..156e413e 100644 --- a/src/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java +++ b/src/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/PlatformRuntime.java @@ -117,9 +117,12 @@ public class PlatformRuntime { throw new RuntimeInitializationFailureException("Exception while registering window event handlers", t); } + + try { doc.exitPointerLock(); } catch (Throwable t) { + doMobileStuff(); isMobile = true; //throw new PlatformIncompatibleException("Mouse cursor lock is not available on this device!"); } @@ -189,6 +192,9 @@ public class PlatformRuntime { logger.info("Platform initialization complete"); } + @JSBody(params = { }, script = "doMobileStuff()") + public static native void doMobileStuff(); + @JSBody(params = { "event", "epkSize" }, script = "setBarProg(event, epkSize)") public static native void setBarProgress(Event event, int epkSize);