Merge pull request #16 from eaglerforge/main

port to u27 for the other branch
This commit is contained in:
Oliver Anderson 2024-04-03 12:44:36 -06:00 committed by GitHub
commit cb3168eb0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 566 additions and 79 deletions

View File

@ -13,18 +13,17 @@
> DELETE 2 @ 2 : 3 > DELETE 2 @ 2 : 3
> CHANGE 1 : 14 @ 1 : 11 > CHANGE 1 : 13 @ 1 : 11
~ import java.util.Set; ~ import java.util.Set;
~ ~
~ import net.lax1dude.eaglercraft.v1_8.internal.PlatformAudio; ~ import net.lax1dude.eaglercraft.v1_8.internal.PlatformAudio;
~ ~
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftSoundManager;
~
~ import com.google.common.collect.Lists; ~ import com.google.common.collect.Lists;
~ ~
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftSoundManager;
~ import net.lax1dude.eaglercraft.v1_8.IOUtils; ~ import net.lax1dude.eaglercraft.v1_8.IOUtils;
~ import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
~ import net.lax1dude.eaglercraft.v1_8.json.JSONTypeProvider; ~ import net.lax1dude.eaglercraft.v1_8.json.JSONTypeProvider;
~ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; ~ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
~ import net.lax1dude.eaglercraft.v1_8.log4j.Logger; ~ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
@ -87,6 +86,6 @@
> CHANGE 6 : 7 @ 6 : 7 > CHANGE 6 : 7 @ 6 : 7
~ return (SoundEventAccessorComposite) arraylist.get((new EaglercraftRandom()).nextInt(arraylist.size())); ~ return (SoundEventAccessorComposite) arraylist.get(ThreadLocalRandom.current().nextInt(arraylist.size()));
> EOF > EOF

View File

@ -154,8 +154,9 @@
> DELETE 3 @ 3 : 6 > DELETE 3 @ 3 : 6
> CHANGE 6 : 8 @ 6 : 7 > CHANGE 5 : 8 @ 5 : 7
~ } catch (Throwable var2) {
~ logger.error("Failed to load resource pack icon for \"{}\"!", reResourcePack.resourcePackFile); ~ logger.error("Failed to load resource pack icon for \"{}\"!", reResourcePack.resourcePackFile);
~ logger.error(var2); ~ logger.error(var2);

View File

@ -5,10 +5,11 @@
# Version: 1.0 # Version: 1.0
# Author: lax1dude # Author: lax1dude
> CHANGE 9 : 11 @ 9 : 10 > CHANGE 9 : 12 @ 9 : 10
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; ~ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
~ import net.lax1dude.eaglercraft.v1_8.HString; ~ import net.lax1dude.eaglercraft.v1_8.HString;
~ import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
> DELETE 1 @ 1 : 9 > DELETE 1 @ 1 : 9
@ -18,7 +19,7 @@
> CHANGE 61 : 62 @ 61 : 62 > CHANGE 61 : 62 @ 61 : 62
~ EaglercraftRandom random = new EaglercraftRandom(); ~ EaglercraftRandom random = ThreadLocalRandom.current();
> CHANGE 15 : 16 @ 15 : 16 > CHANGE 15 : 16 @ 15 : 16

View File

@ -5,9 +5,10 @@
# Version: 1.0 # Version: 1.0
# Author: lax1dude # Author: lax1dude
> CHANGE 3 : 4 @ 3 : 8 > CHANGE 3 : 5 @ 3 : 8
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; ~
~ import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
> INSERT 6 : 7 @ 6 > INSERT 6 : 7 @ 6
@ -15,6 +16,6 @@
> CHANGE 14 : 15 @ 14 : 15 > CHANGE 14 : 15 @ 14 : 15
~ int i = (300 + (new EaglercraftRandom()).nextInt(600)) * 20 * 2; ~ int i = (300 + ThreadLocalRandom.current().nextInt(600)) * 20 * 2;
> EOF > EOF

View File

@ -7,7 +7,7 @@
> DELETE 2 @ 2 : 4 > DELETE 2 @ 2 : 4
> CHANGE 4 : 10 @ 4 : 8 > CHANGE 4 : 11 @ 4 : 8
~ ~
~ import com.google.common.collect.Lists; ~ import com.google.common.collect.Lists;
@ -15,6 +15,7 @@
~ ~
~ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; ~ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
~ import net.lax1dude.eaglercraft.v1_8.log4j.Logger; ~ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
~ import net.lax1dude.eaglercraft.v1_8.minecraft.EntityConstructor;
> DELETE 66 @ 66 : 68 > DELETE 66 @ 66 : 68

View File

@ -9,4 +9,22 @@
+ +
> INSERT 52 : 56 @ 52
+ if (d0 == 0.0) {
+ this.accelerationX = this.accelerationY = this.accelerationZ = 0.0D;
+ return;
+ }
> INSERT 16 : 20 @ 16
+ if (d0 == 0.0) {
+ this.accelerationX = this.accelerationY = this.accelerationZ = 0.0D;
+ return;
+ }
> CHANGE 46 : 47 @ 46 : 47
~ for (int i = 0, l = list.size(); i < l; ++i) {
> EOF > EOF

View File

@ -80,7 +80,8 @@ public class PlatformFilesystem {
} }
} }
}else { }else {
throw new EaglerFileSystemException("Not a file: " + f.getAbsolutePath()); logger.warn("Tried to read file that doesn't exist: \"{}\"", f.getAbsolutePath());
return null;
} }
} }

View File

@ -192,6 +192,10 @@ public class PlatformInput {
cursorHand = glfwCreateStandardCursor(GLFW_HAND_CURSOR); cursorHand = glfwCreateStandardCursor(GLFW_HAND_CURSOR);
cursorText = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR); cursorText = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
glfwSetCursor(glfwWindow, cursorDefault); glfwSetCursor(glfwWindow, cursorDefault);
if(!fullscreen && startupFullscreen) {
toggleFullscreen();
}
} }
public static int getWindowWidth() { public static int getWindowWidth() {
@ -386,6 +390,7 @@ public class PlatformInput {
} }
private static boolean fullscreen = false; private static boolean fullscreen = false;
private static boolean startupFullscreen = false;
private static int[] lastPos = new int[4]; private static int[] lastPos = new int[4];
public static void toggleFullscreen() { public static void toggleFullscreen() {
@ -407,6 +412,10 @@ public class PlatformInput {
fullscreen = !fullscreen; fullscreen = !fullscreen;
} }
public static void setStartupFullscreen(boolean bool) {
startupFullscreen = bool;
}
// https://stackoverflow.com/a/31526753 // https://stackoverflow.com/a/31526753
private static long getCurrentMonitor(long window) { private static long getCurrentMonitor(long window) {
int nmonitors, i; int nmonitors, i;

View File

@ -57,7 +57,7 @@ public class DesktopClientConfigAdapter implements IClientConfigAdapter {
} }
@Override @Override
public JSONObject dumpConfig() { public JSONObject getIntegratedServerOpts() {
return new JSONObject("{\"container\":null,\"worldsDB\":\"desktop\"}"); return new JSONObject("{\"container\":null,\"worldsDB\":\"desktop\"}");
} }

View File

@ -6,6 +6,7 @@ import javax.swing.UnsupportedLookAndFeelException;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EagUtils; import net.lax1dude.eaglercraft.v1_8.EagUtils;
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformANGLE; import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformANGLE;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformInput;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime; import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderSource; import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderSource;
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayManager; import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayManager;
@ -40,6 +41,20 @@ public class LWJGLEntryPoint {
System.err.println("Could not set system look and feel: " + e.toString()); System.err.println("Could not set system look and feel: " + e.toString());
} }
boolean hideRenderDocDialog = false;
for(int i = 0; i < args.length; ++i) {
if(args[i].equalsIgnoreCase("highp")) {
ShaderSource.setHighP(true);
}
if(args[i].equalsIgnoreCase("hide-renderdoc")) {
hideRenderDocDialog = true;
}
if(args[i].equalsIgnoreCase("fullscreen")) {
PlatformInput.setStartupFullscreen(true);
}
}
if(!hideRenderDocDialog) {
LaunchRenderDocDialog lr = new LaunchRenderDocDialog(); LaunchRenderDocDialog lr = new LaunchRenderDocDialog();
lr.setLocationRelativeTo(null); lr.setLocationRelativeTo(null);
lr.setVisible(true); lr.setVisible(true);
@ -49,15 +64,10 @@ public class LWJGLEntryPoint {
} }
lr.dispose(); lr.dispose();
}
getANGLEPlatformFromArgs(args); getANGLEPlatformFromArgs(args);
for(int i = 0; i < args.length; ++i) {
if(args[i].equalsIgnoreCase("highp")) {
ShaderSource.setHighP(true);
}
}
RelayManager.relayManager.load(EagRuntime.getStorage("r")); RelayManager.relayManager.load(EagRuntime.getStorage("r"));
if (RelayManager.relayManager.count() <= 0) { if (RelayManager.relayManager.count() <= 0) {

View File

@ -2,7 +2,6 @@ package net.lax1dude.eaglercraft.v1_8.internal.lwjgl;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;

View File

@ -22,7 +22,7 @@ public class EaglercraftVersion {
public static final String projectOriginName = "EaglercraftX"; public static final String projectOriginName = "EaglercraftX";
public static final String projectOriginAuthor = "lax1dude"; public static final String projectOriginAuthor = "lax1dude";
public static final String projectOriginRevision = "1.8"; public static final String projectOriginRevision = "1.8";
public static final String projectOriginVersion = "u26"; public static final String projectOriginVersion = "u27";
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace

View File

@ -44,7 +44,7 @@ public interface IClientConfigAdapter {
String getResourcePacksDB(); String getResourcePacksDB();
JSONObject dumpConfig(); JSONObject getIntegratedServerOpts();
List<RelayEntry> getRelays(); List<RelayEntry> getRelays();

View File

@ -0,0 +1,24 @@
package net.lax1dude.eaglercraft.v1_8.minecraft;
import net.minecraft.world.World;
/**
* Copyright (c) 2022 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public interface EntityConstructor<T> {
T createEntity(World world);
}

View File

@ -10,7 +10,6 @@ import net.lax1dude.eaglercraft.v1_8.minecraft.GuiScreenGenericErrorMessage;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.client.resources.ResourcePackRepository;
/** /**
* Copyright (c) 2024 lax1dude. All Rights Reserved. * Copyright (c) 2024 lax1dude. All Rights Reserved.

View File

@ -1,8 +1,10 @@
package net.lax1dude.eaglercraft.v1_8.update; package net.lax1dude.eaglercraft.v1_8.update;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
@ -36,8 +38,30 @@ public class UpdateService {
private static UpdateCertificate latestUpdateFound = null; private static UpdateCertificate latestUpdateFound = null;
private static final Set<UpdateCertificate> availableUpdates = new HashSet(); private static final Set<UpdateCertificate> availableUpdates = new HashSet();
private static final Set<RawKnownCertHolder> fastUpdateKnownCheckSet = new HashSet();
private static final Set<UpdateCertificate> dismissedUpdates = new HashSet(); private static final Set<UpdateCertificate> dismissedUpdates = new HashSet();
private static class RawKnownCertHolder {
private final byte[] data;
private final int hashcode;
private final long age;
public RawKnownCertHolder(byte[] data) {
this.data = data;
this.hashcode = Arrays.hashCode(data);
this.age = System.currentTimeMillis();
}
public int hashCode() {
return hashcode;
}
public boolean equals(Object o) {
return o != null && (o == this || ((o instanceof RawKnownCertHolder) && Arrays.equals(((RawKnownCertHolder)o).data, data)));
}
}
public static boolean supported() { public static boolean supported() {
return EaglercraftVersion.enableUpdateService && EagRuntime.getConfiguration().allowUpdateSvc() && PlatformUpdateSvc.supported(); return EaglercraftVersion.enableUpdateService && EagRuntime.getConfiguration().allowUpdateSvc() && PlatformUpdateSvc.supported();
} }
@ -102,6 +126,16 @@ public class UpdateService {
if (EagRuntime.getConfiguration().allowUpdateDL()) { if (EagRuntime.getConfiguration().allowUpdateDL()) {
synchronized(availableUpdates) { synchronized(availableUpdates) {
try { try {
if(certificateData.length > 32767) {
throw new CertificateInvalidException("Certificate is too large! (" + certificateData.length + " bytes)");
}
if(!fastUpdateKnownCheckSet.add(new RawKnownCertHolder(certificateData))) {
if (EagRuntime.getConfiguration().isLogInvalidCerts()) {
logger.info("Ignoring {} byte certificate that has already been processed", certificateData.length);
}
freeMemory();
return;
}
UpdateCertificate cert = UpdateCertificate.parseAndVerifyCertificate(certificateData); UpdateCertificate cert = UpdateCertificate.parseAndVerifyCertificate(certificateData);
if (EaglercraftVersion.updateBundlePackageName.equalsIgnoreCase(cert.bundlePackageName)) { if (EaglercraftVersion.updateBundlePackageName.equalsIgnoreCase(cert.bundlePackageName)) {
if (myUpdateCert == null || !Arrays.equals(cert.bundleDataHash, myUpdateCert.bundleDataHash)) { if (myUpdateCert == null || !Arrays.equals(cert.bundleDataHash, myUpdateCert.bundleDataHash)) {
@ -140,6 +174,17 @@ public class UpdateService {
} }
} }
private static void freeMemory() {
if(fastUpdateKnownCheckSet.size() > 127) {
List<RawKnownCertHolder> lst = new ArrayList(fastUpdateKnownCheckSet);
fastUpdateKnownCheckSet.clear();
lst.sort((c1, c2) -> { return (int)(c2.age - c1.age); });
for(int i = 0; i < 64; ++i) {
fastUpdateKnownCheckSet.add(lst.get(i));
}
}
}
public static void startClientUpdateFrom(UpdateCertificate clientUpdate) { public static void startClientUpdateFrom(UpdateCertificate clientUpdate) {
PlatformUpdateSvc.startClientUpdateFrom(clientUpdate); PlatformUpdateSvc.startClientUpdateFrom(clientUpdate);
} }

View File

@ -4,9 +4,7 @@ import java.io.PrintStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject;
import org.teavm.jso.JSBody; import org.teavm.jso.JSBody;
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSFunctor;
import org.teavm.jso.JSObject; import org.teavm.jso.JSObject;
@ -22,6 +20,9 @@ import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion; import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformApplication; import net.lax1dude.eaglercraft.v1_8.internal.PlatformApplication;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime; import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsAssetsURI;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsAssetsURIsArray;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRoot;
import net.lax1dude.eaglercraft.v1_8.log4j.ILogRedirector; import net.lax1dude.eaglercraft.v1_8.log4j.ILogRedirector;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile; import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile;
@ -52,8 +53,6 @@ public class ClientMain {
return crashImage.substring(0); return crashImage.substring(0);
} }
private static String crashScreenOptsDump = null;
@JSBody(params = {}, script = "if((typeof window.__isEaglerX188Running === \"string\") && window.__isEaglerX188Running === \"yes\") return true; window.__isEaglerX188Running = \"yes\"; return false;") @JSBody(params = {}, script = "if((typeof window.__isEaglerX188Running === \"string\") && window.__isEaglerX188Running === \"yes\") return true; window.__isEaglerX188Running = \"yes\"; return false;")
private static native boolean getRunningFlag(); private static native boolean getRunningFlag();
@ -66,7 +65,7 @@ public class ClientMain {
} }
try { try {
systemOut.println("ClientMain: [INFO] eaglercraftx is starting..."); systemOut.println("ClientMain: [INFO] eaglercraftx is starting...");
String opts = getEaglerXOpts(); JSObject opts = getEaglerXOpts();
if(opts == null) { if(opts == null) {
systemErr.println("ClientMain: [ERROR] the \"window.eaglercraftXOpts\" variable is undefined"); systemErr.println("ClientMain: [ERROR] the \"window.eaglercraftXOpts\" variable is undefined");
@ -76,38 +75,40 @@ public class ClientMain {
} }
try { try {
JSONObject eaglercraftOpts = new JSONObject(opts); JSEaglercraftXOptsRoot eaglercraftOpts = (JSEaglercraftXOptsRoot)opts;
configRootElementId = eaglercraftOpts.getString("container"); configRootElementId = eaglercraftOpts.getContainer();
if(configRootElementId == null) {
throw new JSONException("window.eaglercraftXOpts.container is undefined!");
}
configRootElement = Window.current().getDocument().getElementById(configRootElementId); configRootElement = Window.current().getDocument().getElementById(configRootElementId);
Object epkConfig = eaglercraftOpts.get("assetsURI"); String epkSingleURL = eaglercraftOpts.getAssetsURI();
if(epkConfig instanceof JSONArray) { if(epkSingleURL != null) {
JSONArray epkConfigArr = (JSONArray)epkConfig; configEPKFiles = new EPKFileEntry[] { new EPKFileEntry(epkSingleURL, "") };
if(epkConfigArr.length() == 0) { }else {
JSEaglercraftXOptsAssetsURIsArray epkURLs = eaglercraftOpts.getAssetsURIArray();
int len = epkURLs.getLength();
if(len == 0) {
throw new JSONException("assetsURI array cannot be empty!"); throw new JSONException("assetsURI array cannot be empty!");
} }
configEPKFiles = new EPKFileEntry[epkConfigArr.length()]; configEPKFiles = new EPKFileEntry[len];
for(int i = 0, l = configEPKFiles.length; i < l; ++i) { for(int i = 0; i < len; ++i) {
configEPKFiles[i] = parseEntry(epkConfigArr.getJSONObject(i)); JSEaglercraftXOptsAssetsURI etr = epkURLs.get(i);
String url = etr.getURL();
if(url == null) {
throw new JSONException("assetsURI is missing a url!");
} }
}else if(epkConfig instanceof JSONObject) { configEPKFiles[i] = new EPKFileEntry(url, etr.getPath(""));
configEPKFiles = new EPKFileEntry[] { parseEntry((JSONObject)epkConfig) };
}else if(epkConfig instanceof String) {
String epkConfigStr = (String)epkConfig;
configEPKFiles = new EPKFileEntry[] { new EPKFileEntry(epkConfigStr, "") };
if(epkConfigStr.length() > 128) {
eaglercraftOpts.put("assetsURI", epkConfigStr.substring(0, 128) + " ... ");
} }
} }
configLocalesFolder = eaglercraftOpts.optString("localesURI", "lang"); configLocalesFolder = eaglercraftOpts.getLocalesURI("lang");
if(configLocalesFolder.endsWith("/")) { if(configLocalesFolder.endsWith("/")) {
configLocalesFolder = configLocalesFolder.substring(0, configLocalesFolder.length() - 1); configLocalesFolder = configLocalesFolder.substring(0, configLocalesFolder.length() - 1);
} }
((TeaVMClientConfigAdapter)TeaVMClientConfigAdapter.instance).loadJSON(eaglercraftOpts); ((TeaVMClientConfigAdapter)TeaVMClientConfigAdapter.instance).loadNative(eaglercraftOpts);
crashScreenOptsDump = eaglercraftOpts.toString();
systemOut.println("ClientMain: [INFO] configuration was successful"); systemOut.println("ClientMain: [INFO] configuration was successful");
}catch(Throwable t) { }catch(Throwable t) {
@ -192,9 +193,9 @@ public class ClientMain {
} }
@JSBody(params = {}, script = "if(typeof window.eaglercraftXOpts === \"undefined\") {return null;}" @JSBody(params = {}, script = "if(typeof window.eaglercraftXOpts === \"undefined\") {return null;}"
+ "else if(typeof window.eaglercraftXOpts === \"string\") {return window.eaglercraftXOpts;}" + "else if(typeof window.eaglercraftXOpts === \"string\") {return JSON.parse(window.eaglercraftXOpts);}"
+ "else {return JSON.stringify(window.eaglercraftXOpts);}") + "else {return window.eaglercraftXOpts;}")
private static native String getEaglerXOpts(); private static native JSObject getEaglerXOpts();
public static class EPKFileEntry { public static class EPKFileEntry {
@ -207,18 +208,6 @@ public class ClientMain {
} }
} }
private static EPKFileEntry parseEntry(JSONObject obj) {
String url = obj.getString("url");
String path = obj.optString("path", "");
if(url.length() > 128) {
obj.put("url", url.substring(0, 128) + " ... ");
}
if(path == null) {
path = "";
}
return new EPKFileEntry(url, path);
}
public static String configRootElementId = null; public static String configRootElementId = null;
public static HTMLElement configRootElement = null; public static HTMLElement configRootElement = null;
public static EPKFileEntry[] configEPKFiles = null; public static EPKFileEntry[] configEPKFiles = null;
@ -269,7 +258,7 @@ public class ClientMain {
str.append(addWebGLToCrash()); str.append(addWebGLToCrash());
str.append('\n'); str.append('\n');
str.append("window.eaglercraftXOpts = "); str.append("window.eaglercraftXOpts = ");
str.append(crashScreenOptsDump).append('\n'); str.append(TeaVMClientConfigAdapter.instance.toString()).append('\n');
str.append('\n'); str.append('\n');
str.append("currentTime = "); str.append("currentTime = ");
str.append(EagRuntime.fixDateFormat(new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z")).format(new Date())).append('\n'); str.append(EagRuntime.fixDateFormat(new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z")).format(new Date())).append('\n');

View File

@ -4,14 +4,19 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion; import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom; import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayManager; import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayManager;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.teavm.jso.JSObject;
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter; import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRelay;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRelaysArray;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRoot;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsServer;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsServersArray;
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry; import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry;
/** /**
@ -39,7 +44,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
private String serverToJoin = null; private String serverToJoin = null;
private String worldsDB = "worlds"; private String worldsDB = "worlds";
private String resourcePacksDB = "resourcePacks"; private String resourcePacksDB = "resourcePacks";
private JSONObject originalEaglercraftOpts; private JSONObject integratedServerOpts;
private boolean checkShaderGLErrors = false; private boolean checkShaderGLErrors = false;
private boolean demoMode = EaglercraftVersion.forceDemoMode; private boolean demoMode = EaglercraftVersion.forceDemoMode;
private boolean isAllowUpdateSvc = EaglercraftVersion.enableUpdateService; private boolean isAllowUpdateSvc = EaglercraftVersion.enableUpdateService;
@ -51,8 +56,92 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
private boolean checkRelaysForUpdates = false; private boolean checkRelaysForUpdates = false;
private boolean enableSignatureBadge = false; private boolean enableSignatureBadge = false;
public void loadNative(JSObject jsObject) {
integratedServerOpts = new JSONObject();
JSEaglercraftXOptsRoot eaglercraftXOpts = (JSEaglercraftXOptsRoot)jsObject;
defaultLocale = eaglercraftXOpts.getLang("en_US");
serverToJoin = eaglercraftXOpts.getJoinServer(null);
worldsDB = eaglercraftXOpts.getWorldsDB("worlds");
resourcePacksDB = eaglercraftXOpts.getResourcePacksDB("resourcePacks");
checkShaderGLErrors = eaglercraftXOpts.getCheckShaderGLErrors(false);
demoMode = EaglercraftVersion.forceDemoMode || eaglercraftXOpts.getDemoMode(false);
isAllowUpdateSvc = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getAllowUpdateSvc(true);
isAllowUpdateDL = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getAllowUpdateDL(true);
isEnableDownloadOfflineButton = eaglercraftXOpts.getEnableDownloadOfflineButton(true);
downloadOfflineButtonLink = eaglercraftXOpts.getDownloadOfflineButtonLink(null);
useSpecialCursors = eaglercraftXOpts.getHtml5CursorSupport(false);
logInvalidCerts = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getLogInvalidCerts(false);
enableSignatureBadge = eaglercraftXOpts.getEnableSignatureBadge(false);
integratedServerOpts.put("worldsDB", worldsDB);
integratedServerOpts.put("demoMode", demoMode);
integratedServerOpts.put("lang", defaultLocale);
integratedServerOpts.put("allowUpdateSvc", isAllowUpdateSvc);
integratedServerOpts.put("allowUpdateDL", isAllowUpdateDL);
JSEaglercraftXOptsServersArray serversArray = eaglercraftXOpts.getServers();
if(serversArray != null) {
for(int i = 0, l = serversArray.getLength(); i < l; ++i) {
JSEaglercraftXOptsServer serverEntry = serversArray.get(i);
String serverAddr = serverEntry.getAddr();
if(serverAddr != null) {
String serverName = serverEntry.getName("Default Server #" + i);
defaultServers.add(new DefaultServer(serverName, serverAddr));
}
}
}
JSEaglercraftXOptsRelaysArray relaysArray = eaglercraftXOpts.getRelays();
if(relaysArray != null) {
boolean gotAPrimary = false;
for(int i = 0, l = relaysArray.getLength(); i < l; ++i) {
JSEaglercraftXOptsRelay relay = relaysArray.get(i);
String addr = relay.getAddr();
if(addr != null) {
boolean p = relay.getPrimary();
if(p) {
if(gotAPrimary) {
p = false;
}else {
gotAPrimary = true;
}
}
relays.add(new RelayEntry(relay.getAddr(), relay.getComment("Default Relay #" + i), p));
}
}
}
boolean officialUpdates = !demoMode && EaglercraftVersion.updateBundlePackageName.equals("net.lax1dude.eaglercraft.v1_8.client");
if (relays.size() <= 0) {
int choice = ThreadLocalRandom.current().nextInt(3);
relays.add(new RelayEntry("wss://relay.deev.is/", "lax1dude relay #1", choice == 0));
relays.add(new RelayEntry("wss://relay.lax1dude.net/", "lax1dude relay #2", choice == 1));
relays.add(new RelayEntry("wss://relay.shhnowisnottheti.me/", "ayunami relay #1", choice == 2));
checkRelaysForUpdates = !demoMode && eaglercraftXOpts.getCheckRelaysForUpdates(officialUpdates);
}else {
if(officialUpdates) {
for(int i = 0, l = relays.size(); i < l; ++i) {
String addr = relays.get(i).address;
if(!addr.contains("deev.is") && !addr.contains("lax1dude.net") && !addr.contains("shhnowisnottheti.me")) {
officialUpdates = false;
break;
}
}
}
checkRelaysForUpdates = !demoMode && eaglercraftXOpts.getCheckRelaysForUpdates(officialUpdates);
}
RelayManager.relayManager.load(EagRuntime.getStorage("r"));
if (RelayManager.relayManager.count() <= 0) {
RelayManager.relayManager.loadDefaults();
RelayManager.relayManager.save();
}
}
public void loadJSON(JSONObject eaglercraftOpts) { public void loadJSON(JSONObject eaglercraftOpts) {
originalEaglercraftOpts = eaglercraftOpts; integratedServerOpts = eaglercraftOpts;
defaultLocale = eaglercraftOpts.optString("lang", "en_US"); defaultLocale = eaglercraftOpts.optString("lang", "en_US");
serverToJoin = eaglercraftOpts.optString("joinServer", null); serverToJoin = eaglercraftOpts.optString("joinServer", null);
worldsDB = eaglercraftOpts.optString("worldsDB", "worlds"); worldsDB = eaglercraftOpts.optString("worldsDB", "worlds");
@ -67,7 +156,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
isEnableDownloadOfflineButton = eaglercraftOpts.optBoolean("enableDownloadOfflineButton", true); isEnableDownloadOfflineButton = eaglercraftOpts.optBoolean("enableDownloadOfflineButton", true);
downloadOfflineButtonLink = eaglercraftOpts.optString("downloadOfflineButtonLink", null); downloadOfflineButtonLink = eaglercraftOpts.optString("downloadOfflineButtonLink", null);
useSpecialCursors = eaglercraftOpts.optBoolean("html5CursorSupport", false); useSpecialCursors = eaglercraftOpts.optBoolean("html5CursorSupport", false);
logInvalidCerts = !demoMode && eaglercraftOpts.optBoolean("logInvalidCerts", false); logInvalidCerts = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftOpts.optBoolean("logInvalidCerts", false);
enableSignatureBadge = eaglercraftOpts.optBoolean("enableSignatureBadge", false); enableSignatureBadge = eaglercraftOpts.optBoolean("enableSignatureBadge", false);
JSONArray serversArray = eaglercraftOpts.optJSONArray("servers"); JSONArray serversArray = eaglercraftOpts.optJSONArray("servers");
if(serversArray != null) { if(serversArray != null) {
@ -152,8 +241,8 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
} }
@Override @Override
public JSONObject dumpConfig() { public JSONObject getIntegratedServerOpts() {
return originalEaglercraftOpts; return integratedServerOpts;
} }
@Override @Override
@ -211,4 +300,42 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
return enableSignatureBadge; return enableSignatureBadge;
} }
@Override
public String toString() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("lang", defaultLocale);
jsonObject.put("joinServer", serverToJoin);
jsonObject.put("worldsDB", worldsDB);
jsonObject.put("resourcePacksDB", resourcePacksDB);
jsonObject.put("checkShaderGLErrors", checkShaderGLErrors);
jsonObject.put("demoMode", demoMode);
jsonObject.put("allowUpdateSvc", isAllowUpdateSvc);
jsonObject.put("allowUpdateDL", isAllowUpdateDL);
jsonObject.put("enableDownloadOfflineButton", isEnableDownloadOfflineButton);
jsonObject.put("downloadOfflineButtonLink", downloadOfflineButtonLink);
jsonObject.put("html5CursorSupport", useSpecialCursors);
jsonObject.put("logInvalidCerts", logInvalidCerts);
jsonObject.put("checkRelaysForUpdates", checkRelaysForUpdates);
jsonObject.put("enableSignatureBadge", enableSignatureBadge);
JSONArray serversArr = new JSONArray();
for(int i = 0, l = defaultServers.size(); i < l; ++i) {
DefaultServer srv = defaultServers.get(i);
JSONObject obj = new JSONObject();
obj.put("addr", srv.addr);
obj.put("name", srv.name);
serversArr.put(obj);
}
jsonObject.put("servers", serversArr);
JSONArray relaysArr = new JSONArray();
for(int i = 0, l = relays.size(); i < l; ++i) {
RelayEntry rl = relays.get(i);
JSONObject obj = new JSONObject();
obj.put("addr", rl.address);
obj.put("comment", rl.comment);
obj.put("primary", rl.primary);
relaysArr.put(obj);
}
jsonObject.put("relays", relaysArr);
return jsonObject.toString();
}
} }

View File

@ -0,0 +1,29 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public abstract class JSEaglercraftXOptsAssetsURI implements JSObject {
@JSBody(script = "return (typeof this.url === \"string\") ? this.url : null;")
public native String getURL();
@JSBody(params = { "def" }, script = "return (typeof this.path === \"string\") ? this.path : def;")
public native String getPath(String defaultValue);
}

View File

@ -0,0 +1,30 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public interface JSEaglercraftXOptsAssetsURIsArray extends JSObject {
@JSIndexer
JSEaglercraftXOptsAssetsURI get(int idx);
@JSProperty
int getLength();
}

View File

@ -0,0 +1,32 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public abstract class JSEaglercraftXOptsRelay implements JSObject {
@JSBody(script = "return (typeof this.addr === \"string\") ? this.addr : null;")
public native String getAddr();
@JSBody(params = { "def" }, script = "return (typeof this.comment === \"string\") ? this.comment : def;")
public native String getComment(String defaultValue);
@JSBody(script = "return (typeof this.primary === \"boolean\") ? this.primary : false;")
public native boolean getPrimary();
}

View File

@ -0,0 +1,30 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public interface JSEaglercraftXOptsRelaysArray extends JSObject {
@JSIndexer
JSEaglercraftXOptsRelay get(int idx);
@JSProperty
int getLength();
}

View File

@ -0,0 +1,83 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public abstract class JSEaglercraftXOptsRoot implements JSObject {
@JSBody(script = "return (typeof this.container === \"string\") ? this.container : null;")
public native String getContainer();
@JSBody(script = "return (typeof this.assetsURI === \"string\") ? this.assetsURI : null;")
public native String getAssetsURI();
@JSBody(script = "return (typeof this.assetsURI === \"object\") ? this.assetsURI : null;")
public native JSEaglercraftXOptsAssetsURIsArray getAssetsURIArray();
@JSBody(params = { "def" }, script = "return (typeof this.lang === \"string\") ? this.lang : def;")
public native String getLang(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.joinServer === \"string\") ? this.joinServer : def;")
public native String getJoinServer(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.localesURI === \"string\") ? this.localesURI : def;")
public native String getLocalesURI(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.worldsDB === \"string\") ? this.worldsDB : def;")
public native String getWorldsDB(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.resourcePacksDB === \"string\") ? this.resourcePacksDB : def;")
public native String getResourcePacksDB(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.demoMode === \"boolean\") ? this.demoMode : def;")
public native boolean getDemoMode(boolean defaultValue);
@JSBody(script = "return (typeof this.servers === \"object\") ? this.servers : null;")
public native JSEaglercraftXOptsServersArray getServers();
@JSBody(script = "return (typeof this.relays === \"object\") ? this.relays : null;")
public native JSEaglercraftXOptsRelaysArray getRelays();
@JSBody(params = { "def" }, script = "return (typeof this.checkShaderGLErrors === \"boolean\") ? this.checkShaderGLErrors : def;")
public native boolean getCheckShaderGLErrors(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.enableDownloadOfflineButton === \"boolean\") ? this.enableDownloadOfflineButton : def;")
public native boolean getEnableDownloadOfflineButton(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.downloadOfflineButtonLink === \"string\") ? this.downloadOfflineButtonLink : def;")
public native String getDownloadOfflineButtonLink(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.html5CursorSupport === \"boolean\") ? this.html5CursorSupport : def;")
public native boolean getHtml5CursorSupport(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.allowUpdateSvc === \"boolean\") ? this.allowUpdateSvc : def;")
public native boolean getAllowUpdateSvc(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.allowUpdateDL === \"boolean\") ? this.allowUpdateDL : def;")
public native boolean getAllowUpdateDL(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.logInvalidCerts === \"boolean\") ? this.logInvalidCerts : def;")
public native boolean getLogInvalidCerts(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.enableSignatureBadge === \"boolean\") ? this.enableSignatureBadge : def;")
public native boolean getEnableSignatureBadge(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.checkRelaysForUpdates === \"boolean\") ? this.checkRelaysForUpdates : def;")
public native boolean getCheckRelaysForUpdates(boolean defaultValue);
}

View File

@ -0,0 +1,29 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public abstract class JSEaglercraftXOptsServer implements JSObject {
@JSBody(script = "return (typeof this.addr === \"string\") ? this.addr : null;")
public native String getAddr();
@JSBody(params = { "def" }, script = "return (typeof this.name === \"string\") ? this.name : def;")
public native String getName(String defaultValue);
}

View File

@ -0,0 +1,30 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public interface JSEaglercraftXOptsServersArray extends JSObject {
@JSIndexer
JSEaglercraftXOptsServer get(int idx);
@JSProperty
int getLength();
}

View File

@ -191,7 +191,7 @@ public class ClientPlatformSingleplayer {
} }
}); });
registerPacketHandler(workerObj, new WorkerBinaryPacketHandlerImpl()); registerPacketHandler(workerObj, new WorkerBinaryPacketHandlerImpl());
sendWorkerStartPacket(workerObj, PlatformRuntime.getClientConfigAdapter().dumpConfig().toString()); sendWorkerStartPacket(workerObj, PlatformRuntime.getClientConfigAdapter().getIntegratedServerOpts().toString());
} }