From ee73ae1d410b26dce3d652b76eec30f0bfe7841f Mon Sep 17 00:00:00 2001 From: WiredSpast <74211155+WiredSpast@users.noreply.github.com> Date: Tue, 4 Apr 2023 03:37:54 +0200 Subject: [PATCH 1/8] Attempt onClick fix --- G-Earth/src/main/java/gearth/extensions/ExtensionBase.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/G-Earth/src/main/java/gearth/extensions/ExtensionBase.java b/G-Earth/src/main/java/gearth/extensions/ExtensionBase.java index d801aeb..2e65e07 100644 --- a/G-Earth/src/main/java/gearth/extensions/ExtensionBase.java +++ b/G-Earth/src/main/java/gearth/extensions/ExtensionBase.java @@ -169,9 +169,7 @@ public abstract class ExtensionBase extends IExtension { * The application got doubleclicked from the G-Earth interface. Doing something here is optional */ @Override - void onClick() { - - } + public void onClick() {} @Override protected ExtensionInfo getInfoAnnotations() { From 22f648ec6d36e21fc27bee73bfce9b57da1fbd42 Mon Sep 17 00:00:00 2001 From: WiredSpast <74211155+WiredSpast@users.noreply.github.com> Date: Tue, 4 Apr 2023 03:40:02 +0200 Subject: [PATCH 2/8] Attempt onClick fix --- G-Earth/src/main/java/gearth/extensions/ExtensionForm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/G-Earth/src/main/java/gearth/extensions/ExtensionForm.java b/G-Earth/src/main/java/gearth/extensions/ExtensionForm.java index 6922c93..af2e9e8 100644 --- a/G-Earth/src/main/java/gearth/extensions/ExtensionForm.java +++ b/G-Earth/src/main/java/gearth/extensions/ExtensionForm.java @@ -67,7 +67,7 @@ public abstract class ExtensionForm extends ExtensionBase { /** * The application got doubleclicked from the G-Earth interface. Doing something here is optional */ - public void onClick(){ + public final void onClick(){ Platform.runLater(() -> { primaryStage.show(); primaryStage.requestFocus(); From 3ee8f5576674c639f26cdd6e64f589ba222b0d14 Mon Sep 17 00:00:00 2001 From: WiredSpast <74211155+WiredSpast@users.noreply.github.com> Date: Tue, 4 Apr 2023 03:42:06 +0200 Subject: [PATCH 3/8] Attempt onClick fix --- G-Earth/src/main/java/gearth/extensions/ExtensionBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/G-Earth/src/main/java/gearth/extensions/ExtensionBase.java b/G-Earth/src/main/java/gearth/extensions/ExtensionBase.java index 2e65e07..878cf9b 100644 --- a/G-Earth/src/main/java/gearth/extensions/ExtensionBase.java +++ b/G-Earth/src/main/java/gearth/extensions/ExtensionBase.java @@ -169,7 +169,7 @@ public abstract class ExtensionBase extends IExtension { * The application got doubleclicked from the G-Earth interface. Doing something here is optional */ @Override - public void onClick() {} + protected void onClick() {} @Override protected ExtensionInfo getInfoAnnotations() { From a8559cfdb1f24827f1f3785ab6419828219e90d4 Mon Sep 17 00:00:00 2001 From: WiredSpast Date: Mon, 17 Apr 2023 17:36:41 +0200 Subject: [PATCH 4/8] Attempt unity fix --- .../unity_tools/UnityWebModifyer.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java index e0cc5fb..f30ab2f 100644 --- a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java +++ b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java @@ -114,11 +114,11 @@ public class UnityWebModifyer { contents = insertFrameworkCode(contents, 0, "js_code/unity_code.js"); - String exportSearch = "Module.asmLibraryArg,buffer);Module[\"asm\"]=asm;"; + String exportSearch = "Module[\"asm\"]=exports;"; int exportIndex = contents.indexOf(exportSearch) + exportSearch.length(); contents = insertFrameworkCode(contents, exportIndex, "js_code/unity_exports.js"); - String importSearch = "if(!env[\"tableBase\"]){env[\"tableBase\"]=0}"; + String importSearch = "\"LANG\":lang,\"_\":getExecutableName()};"; int importIndex = contents.indexOf(importSearch) + importSearch.length(); contents = insertFrameworkCode(contents, importIndex, "js_code/unity_imports.js"); @@ -141,15 +141,16 @@ public class UnityWebModifyer { byte[] encoded = Files.readAllBytes(Paths.get(loaderFile.getAbsolutePath())); String contents = new String(encoded, StandardCharsets.UTF_8); - contents = contents.replace("o.result.responseHeaders[e]==s.getResponseHeader(e)", "false"); - contents = contents.replace("a.responseHeaders[e]=o.getResponseHeader(e)", - "const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');\n" + - " if (e === \"ETag\") {\n" + - " a.responseHeaders[e] = \"W/\\\"\" + genRanHex(6) + \"-\" + genRanHex(13) + \"\\\"\"\n" + - " }\n" + - " else {\n" + - " a.responseHeaders[e] = o.getResponseHeader(e)\n" + - " }"); + contents = contents.replace("r.headers.get(e)==t.headers.get(e)", "false"); +// contents = contents.replace("a.responseHeaders[e]=o.getResponseHeader(e)", +// "const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');\n" + +// " if (e === \"ETag\") {\n" + +// " a.responseHeaders[e] = \"W/\\\"\" + genRanHex(6) + \"-\" + genRanHex(13) + \"\\\"\"\n" + +// " }\n" + +// " else {\n" + +// " a.responseHeaders[e] = o.getResponseHeader(e)\n" + +// " }"); + contents = contents.replace("!r.headers.get(\"ETag\")", "!r.headers.set(\"Etag\", `W/\"${[...Array(6)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')}-${[...Array(13)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')}\"`)"); BufferedWriter writer = new BufferedWriter(new FileWriter(loaderFile)); writer.write(contents); From bfc1d3a843998836f873e7a955b044c99192cbaf Mon Sep 17 00:00:00 2001 From: WiredSpast Date: Mon, 17 Apr 2023 17:47:15 +0200 Subject: [PATCH 5/8] Attempt unity fix --- .../main/java/gearth/services/unity_tools/UnityWebModifyer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java index f30ab2f..5305b90 100644 --- a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java +++ b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java @@ -114,7 +114,7 @@ public class UnityWebModifyer { contents = insertFrameworkCode(contents, 0, "js_code/unity_code.js"); - String exportSearch = "Module[\"asm\"]=exports;"; + String exportSearch = "Module[\"asm\"][\"Fj\"]).apply(null,arguments)};"; int exportIndex = contents.indexOf(exportSearch) + exportSearch.length(); contents = insertFrameworkCode(contents, exportIndex, "js_code/unity_exports.js"); From 6db7c31bfa1e695843f326051d8080b69b1a1734 Mon Sep 17 00:00:00 2001 From: WiredSpast Date: Mon, 17 Apr 2023 17:49:54 +0200 Subject: [PATCH 6/8] Attempt unity fix --- .../unity_tools/UnityWebModifyer.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java index 5305b90..3b1abe4 100644 --- a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java +++ b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java @@ -114,10 +114,12 @@ public class UnityWebModifyer { contents = insertFrameworkCode(contents, 0, "js_code/unity_code.js"); + // String exportSearch = "Module.asmLibraryArg,buffer);Module[\\\"asm\\\"]=asm;"; String exportSearch = "Module[\"asm\"][\"Fj\"]).apply(null,arguments)};"; int exportIndex = contents.indexOf(exportSearch) + exportSearch.length(); contents = insertFrameworkCode(contents, exportIndex, "js_code/unity_exports.js"); + // String importSearch = "if(!env[\"tableBase\"]){env[\"tableBase\"]=0}"; String importSearch = "\"LANG\":lang,\"_\":getExecutableName()};"; int importIndex = contents.indexOf(importSearch) + importSearch.length(); contents = insertFrameworkCode(contents, importIndex, "js_code/unity_imports.js"); @@ -141,15 +143,16 @@ public class UnityWebModifyer { byte[] encoded = Files.readAllBytes(Paths.get(loaderFile.getAbsolutePath())); String contents = new String(encoded, StandardCharsets.UTF_8); + // contents = contents.replace("o.result.responseHeaders[e]==s.getResponseHeader(e)", "false"); contents = contents.replace("r.headers.get(e)==t.headers.get(e)", "false"); -// contents = contents.replace("a.responseHeaders[e]=o.getResponseHeader(e)", -// "const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');\n" + -// " if (e === \"ETag\") {\n" + -// " a.responseHeaders[e] = \"W/\\\"\" + genRanHex(6) + \"-\" + genRanHex(13) + \"\\\"\"\n" + -// " }\n" + -// " else {\n" + -// " a.responseHeaders[e] = o.getResponseHeader(e)\n" + -// " }"); + // contents = contents.replace("a.responseHeaders[e]=o.getResponseHeader(e)", + // "const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');\n" + + // " if (e === \"ETag\") {\n" + + // " a.responseHeaders[e] = \"W/\\\"\" + genRanHex(6) + \"-\" + genRanHex(13) + \"\\\"\"\n" + + // " }\n" + + // " else {\n" + + // " a.responseHeaders[e] = o.getResponseHeader(e)\n" + + // " }"); contents = contents.replace("!r.headers.get(\"ETag\")", "!r.headers.set(\"Etag\", `W/\"${[...Array(6)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')}-${[...Array(13)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')}\"`)"); BufferedWriter writer = new BufferedWriter(new FileWriter(loaderFile)); From b19d8baab43300f8fecfc9d289493a79e3347cbd Mon Sep 17 00:00:00 2001 From: WiredSpast <74211155+WiredSpast@users.noreply.github.com> Date: Fri, 16 Jun 2023 07:56:08 +0200 Subject: [PATCH 7/8] Remove faulty changes --- .../unity_tools/UnityWebModifyer.java | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java index 3b1abe4..742d84a 100644 --- a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java +++ b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java @@ -114,13 +114,11 @@ public class UnityWebModifyer { contents = insertFrameworkCode(contents, 0, "js_code/unity_code.js"); - // String exportSearch = "Module.asmLibraryArg,buffer);Module[\\\"asm\\\"]=asm;"; - String exportSearch = "Module[\"asm\"][\"Fj\"]).apply(null,arguments)};"; + String exportSearch = "Module.asmLibraryArg,buffer);Module[\\\"asm\\\"]=asm;"; int exportIndex = contents.indexOf(exportSearch) + exportSearch.length(); contents = insertFrameworkCode(contents, exportIndex, "js_code/unity_exports.js"); - // String importSearch = "if(!env[\"tableBase\"]){env[\"tableBase\"]=0}"; - String importSearch = "\"LANG\":lang,\"_\":getExecutableName()};"; + String importSearch = "if(!env[\"tableBase\"]){env[\"tableBase\"]=0}"; int importIndex = contents.indexOf(importSearch) + importSearch.length(); contents = insertFrameworkCode(contents, importIndex, "js_code/unity_imports.js"); @@ -143,18 +141,16 @@ public class UnityWebModifyer { byte[] encoded = Files.readAllBytes(Paths.get(loaderFile.getAbsolutePath())); String contents = new String(encoded, StandardCharsets.UTF_8); - // contents = contents.replace("o.result.responseHeaders[e]==s.getResponseHeader(e)", "false"); - contents = contents.replace("r.headers.get(e)==t.headers.get(e)", "false"); - // contents = contents.replace("a.responseHeaders[e]=o.getResponseHeader(e)", - // "const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');\n" + - // " if (e === \"ETag\") {\n" + - // " a.responseHeaders[e] = \"W/\\\"\" + genRanHex(6) + \"-\" + genRanHex(13) + \"\\\"\"\n" + - // " }\n" + - // " else {\n" + - // " a.responseHeaders[e] = o.getResponseHeader(e)\n" + - // " }"); - contents = contents.replace("!r.headers.get(\"ETag\")", "!r.headers.set(\"Etag\", `W/\"${[...Array(6)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')}-${[...Array(13)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')}\"`)"); - + contents = contents.replace("o.result.responseHeaders[e]==s.getResponseHeader(e)", "false"); + contents = contents.replace("a.responseHeaders[e]=o.getResponseHeader(e)", + "const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');\n" + + " if (e === \"ETag\") {\n" + + " a.responseHeaders[e] = \"W/\\\"\" + genRanHex(6) + \"-\" + genRanHex(13) + \"\\\"\"\n" + + " }\n" + + " else {\n" + + " a.responseHeaders[e] = o.getResponseHeader(e)\n" + + " }"); + BufferedWriter writer = new BufferedWriter(new FileWriter(loaderFile)); writer.write(contents); writer.close(); From 813fda45e5c6d220ac179c82a29d18b1486d18db Mon Sep 17 00:00:00 2001 From: WiredSpast <74211155+WiredSpast@users.noreply.github.com> Date: Fri, 16 Jun 2023 07:57:28 +0200 Subject: [PATCH 8/8] Remove faulty changes --- .../java/gearth/services/unity_tools/UnityWebModifyer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java index 742d84a..e0cc5fb 100644 --- a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java +++ b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java @@ -114,7 +114,7 @@ public class UnityWebModifyer { contents = insertFrameworkCode(contents, 0, "js_code/unity_code.js"); - String exportSearch = "Module.asmLibraryArg,buffer);Module[\\\"asm\\\"]=asm;"; + String exportSearch = "Module.asmLibraryArg,buffer);Module[\"asm\"]=asm;"; int exportIndex = contents.indexOf(exportSearch) + exportSearch.length(); contents = insertFrameworkCode(contents, exportIndex, "js_code/unity_exports.js"); @@ -150,7 +150,7 @@ public class UnityWebModifyer { " else {\n" + " a.responseHeaders[e] = o.getResponseHeader(e)\n" + " }"); - + BufferedWriter writer = new BufferedWriter(new FileWriter(loaderFile)); writer.write(contents); writer.close();