Update #44 - WebAssembly GC support, fix more WebRTC bugs

This commit is contained in:
lax1dude
2024-12-03 23:38:28 -08:00
parent 919014b4df
commit 70b52bbf7a
216 changed files with 34358 additions and 91 deletions

View File

@ -1569,7 +1569,7 @@ public class PlatformInput {
isOnMobilePressAnyKey = true;
setupAnyKeyScreenMobile(allowBootMenu);
if(pressAnyKeyScreenMobile() && allowBootMenu) {
PlatformRuntime.enterBootMenu();
PlatformRuntime.enterBootMenu(true);
}
}finally {
isOnMobilePressAnyKey = false;

View File

@ -185,8 +185,7 @@ public class PlatformRuntime {
}
CSSStyleDeclaration style = root.getStyle();
style.setProperty("overflowX", "hidden");
style.setProperty("overflowY", "hidden");
style.setProperty("overflow", "hidden");
TeaVMClientConfigAdapter teavmCfg = (TeaVMClientConfigAdapter) getClientConfigAdapter();
boolean allowBootMenu = teavmCfg.isAllowBootMenu();
@ -241,8 +240,7 @@ public class PlatformRuntime {
style.setProperty("position", "relative");
style.setProperty("width", "100%");
style.setProperty("height", "100%");
style.setProperty("overflowX", "hidden");
style.setProperty("overflowY", "hidden");
style.setProperty("overflow", "hidden");
root.appendChild(parent);
ClientMain.configRootElement = parent; // hack
@ -421,7 +419,7 @@ public class PlatformRuntime {
Collections.sort(exts);
logger.info("Unlocked the following OpenGL ES extensions:");
for(int i = 0, l = exts.size(); i < l; ++i) {
logger.info(" - " + exts.get(i));
logger.info(" - {}", exts.get(i));
}
}
@ -443,7 +441,7 @@ public class PlatformRuntime {
if(allowBootMenu && BootMenuEntryPoint.checkShouldLaunchFlag(win)) {
logger.info("Boot menu enable flag is set, entering boot menu...");
enterBootMenu();
enterBootMenu(BootMenuEntryPoint.wasManuallyInvoked);
}
byte[] finalLoadScreen = PlatformAssets.getResourceBytes("/assets/eagler/eagtek.png");
@ -1134,7 +1132,7 @@ public class PlatformRuntime {
if(PlatformInput.keyboardGetEventKeyState()) {
int key = PlatformInput.keyboardGetEventKey();
if(key == KeyboardConstants.KEY_DELETE || key == KeyboardConstants.KEY_BACK) {
enterBootMenu();
enterBootMenu(true);
}
}
}
@ -1143,7 +1141,7 @@ public class PlatformRuntime {
@JSBody(params = {}, script = "delete __isEaglerX188Running;")
private static native void clearRunningFlag();
static void enterBootMenu() {
static void enterBootMenu(boolean manual) {
if(!getClientConfigAdapter().isAllowBootMenu()) {
throw new IllegalStateException("Boot menu is disabled");
}
@ -1170,7 +1168,7 @@ public class PlatformRuntime {
immediateContinueChannel = null;
clearRunningFlag();
logger.info("Firing boot menu escape signal...");
throw new TeaVMEnterBootMenuException();
throw new TeaVMEnterBootMenuException(manual);
}
public static void postCreate() {

View File

@ -188,7 +188,7 @@ public class PlatformScreenRecord {
TeaVMUtils.addEventListener(mediaRec, "dataavailable", new EventListener<DataAvailableEvent>() {
@Override
public void handleEvent(DataAvailableEvent evt) {
final String fileName = EaglercraftVersion.mainMenuStringB + " - " + EaglerProfile.getName() + " - " + fmt.format(new Date()) + "." + params.codec.fileExt;
final String fileName = EaglercraftVersion.screenRecordingFilePrefix + " - " + EaglerProfile.getName() + " - " + fmt.format(new Date()) + "." + params.codec.fileExt;
if("video/webm".equals(params.codec.container)) {
FixWebMDurationJS.getRecUrl(evt, (int) (PlatformRuntime.steadyTimeMillis() - startTime), url -> {
PlatformApplication.downloadURLWithNameTeaVM(fileName, url, () -> TeaVMUtils.freeDataURL(url));

View File

@ -421,7 +421,7 @@ public class PlatformWebRTC {
final Object[] evtHandler = new Object[1];
evtHandler[0] = (EventListener<Event>) evt -> {
if (!iceCandidates.isEmpty()) {
Window.setTimeout(() -> ((EventListener<Event>)evtHandler[0]).handleEvent(evt), 1);
Window.setTimeout(() -> ((EventListener<Event>)evtHandler[0]).handleEvent(evt), 10);
return;
}
clientDataChannelClosed = false;
@ -541,7 +541,7 @@ public class PlatformWebRTC {
final Object[] evtHandler = new Object[1];
evtHandler[0] = (EventListener<Event>) evt -> {
if (!iceCandidates.isEmpty()) {
Window.setTimeout(() -> ((EventListener<Event>)evtHandler[0]).handleEvent(evt), 1);
Window.setTimeout(() -> ((EventListener<Event>)evtHandler[0]).handleEvent(evt), 10);
return;
}
if (getChannel(evt) == null) return;

View File

@ -200,7 +200,6 @@ public class PlatformWebView {
try {
List<String> sandboxArgs = new ArrayList<>();
sandboxArgs.add("allow-downloads");
sandboxArgs.add("allow-same-origin");
if(options.scriptEnabled) {
sandboxArgs.add("allow-scripts");
sandboxArgs.add("allow-pointer-lock");

View File

@ -202,6 +202,7 @@ public class ClientMain {
}catch(TeaVMEnterBootMenuException ee) {
try {
systemOut.println("ClientMain: [INFO] launching eaglercraftx boot menu");
BootMenuEntryPoint.wasManuallyInvoked = ee.isManual;
BootMenuEntryPoint.launchMenu(Window.current(), configRootElement);
}catch(Throwable t) {
showCrashScreen("Failed to enter boot menu!", t);
@ -550,6 +551,7 @@ public class ClientMain {
}
if(el == null) {
Window.alert("Compatibility error: " + t);
System.err.println("Compatibility error: " + t);
return;
}
@ -573,11 +575,9 @@ public class ClientMain {
+ "<p><br /><span style=\"font-size:1.1em;border-bottom:1px dashed #AAAAAA;padding-bottom:5px;\">Things you can try:</span></p>"
+ "<ol>"
+ "<li><span style=\"font-weight:bold;\">Just try using Eaglercraft on a different device</span>, it isn't a bug it's common sense</li>"
+ "<li style=\"margin-top:7px;\">If you are on a mobile device, please try a proper desktop or a laptop computer</li>"
+ "<li style=\"margin-top:7px;\">If you are using a device with no mouse cursor, please use a device with a mouse cursor</li>"
+ "<li style=\"margin-top:7px;\">If this screen just appeared randomly, try restarting your browser or device</li>"
+ "<li style=\"margin-top:7px;\">If you are not using Chrome/Edge, try installing the latest Google Chrome</li>"
+ "<li style=\"margin-top:7px;\">If your browser is out of date, please update it to the latest version</li>"
+ "<li style=\"margin-top:7px;\">If you are using an old OS such as Windows 7, please try Windows 10 or 11</li>"
+ "</ol>"
+ "</div>");

View File

@ -69,7 +69,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter, IBootMenu
private boolean openDebugConsoleOnLaunch = false;
private boolean fixDebugConsoleUnloadListener = false;
private boolean forceWebViewSupport = false;
private boolean enableWebViewCSP = false;
private boolean enableWebViewCSP = true;
private boolean autoFixLegacyStyleAttr = false;
private boolean showBootMenuOnLaunch = false;
private boolean bootMenuBlocksUnsignedClients = false;
@ -77,7 +77,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter, IBootMenu
private boolean forceProfanityFilter = false;
private boolean forceWebGL1 = false;
private boolean forceWebGL2 = false;
private boolean allowExperimentalWebGL1 = false;
private boolean allowExperimentalWebGL1 = true;
private boolean useWebGLExt = true;
private boolean useDelayOnSwap = false;
private boolean useJOrbisAudioDecoder = false;
@ -550,6 +550,11 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter, IBootMenu
return ramdiskMode;
}
@Override
public boolean isEnforceVSync() {
return false;
}
@Override
public IClientConfigAdapterHooks getHooks() {
return hooks;

View File

@ -17,4 +17,10 @@ package net.lax1dude.eaglercraft.v1_8.internal.teavm;
*/
public class TeaVMEnterBootMenuException extends RuntimeException {
public final boolean isManual;
public TeaVMEnterBootMenuException(boolean manual) {
this.isManual = manual;
}
}