Update #51 - Protocol and FPS improvements, better workspace

This commit is contained in:
lax1dude
2025-05-18 15:01:06 -07:00
parent 71c61e33fd
commit 325a6826bf
1191 changed files with 9266 additions and 187695 deletions

View File

@ -0,0 +1,3 @@
*.bat text eol=crlf
*.sh text eol=lf
gradlew text eol=lf

View File

@ -2,16 +2,15 @@
.settings
.classpath
.project
build
bin
proxyServer/bin
proxyServer/rundir
desktopRuntime/_eagstorage*
desktopRuntime/eclipseProject/bin*
desktopRuntime/hs_err_*
desktopRuntime/crash-reports/*
desktopRuntime/options.txt
desktopRuntime/_eagstorage*
desktopRuntime/filesystem/*
desktopRuntime/downloads/*
desktopRuntime/screenshots/*
/build
/target_*/build
/desktopRuntime/_eagstorage*
/desktopRuntime/eclipseProject/bin*
/desktopRuntime/hs_err_*
/desktopRuntime/crash-reports/*
/desktopRuntime/options.txt
/desktopRuntime/_eagstorage*
/desktopRuntime/filesystem/*
/desktopRuntime/downloads/*
/desktopRuntime/screenshots/*

View File

@ -1,6 +0,0 @@
@echo off
title epkcompiler
echo compiling, please wait...
java -jar "desktopRuntime/CompileEPK.jar" "desktopRuntime/resources" "javascript/assets.epk"
echo finished compiling epk
pause

View File

@ -1,2 +0,0 @@
#!/bin/sh
java -jar "desktopRuntime/CompileEPK.jar" "desktopRuntime/resources" "javascript/assets.epk"

View File

@ -1,4 +0,0 @@
@echo off
title gradlew generateJavascript
call gradlew generateJavascript
pause

View File

@ -1,3 +0,0 @@
#!/bin/sh
chmod +x gradlew
./gradlew generateJavascript

View File

@ -1,4 +0,0 @@
@echo off
title MakeOfflineDownload
java -cp "desktopRuntime/MakeOfflineDownload.jar;desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeOfflineDownload "javascript/OfflineDownloadTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/EaglercraftX_1.8_Offline_en_US.html" "javascript/EaglercraftX_1.8_Offline_International.html" "javascript/lang"
pause

View File

@ -1,2 +0,0 @@
#!/bin/sh
java -cp "desktopRuntime/MakeOfflineDownload.jar:desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeOfflineDownload "javascript/OfflineDownloadTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/EaglercraftX_1.8_Offline_en_US.html" "javascript/EaglercraftX_1.8_Offline_International.html" "javascript/lang"

View File

@ -1,4 +0,0 @@
@echo off
title MakeSignedClient
java -cp "desktopRuntime/MakeOfflineDownload.jar;desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html"
pause

View File

@ -1,2 +0,0 @@
#!/bin/sh
java -cp "desktopRuntime/MakeOfflineDownload.jar:desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html"

View File

@ -0,0 +1,31 @@
# eaglercraft-workspace
### Java 17 or greater is required!
**To get started, import this entire folder into your IDE as a Gradle project, this will automatically create several different projects to build all the common classes and each runtime.**
The Gradle plugin was created by [cire3](https://github.com/cire3wastaken), and the source code is available [here](https://github.com/The-Resent-Team/open-source-projects).
**To compile the JavaScript client:**
Run the `MakeOfflineDownload` script in the "target_teavm_javascript" folder (or the `makeMainOfflineDownload` Gradle task in your IDE) to build the JavaScript client. This will build the "classes.js" and "assets.epk" and the offline downloads, the results will be in the "javascript" folder.
**To compile the WASM-GC client:**
Run the `MakeWASMClientBundle` script in the "target_teavm_wasm_gc" folder (or the `makeMainWasmClientBundle` Gradle task in your IDE) to build the WASM-GC client. This will build the "assets.epw" file which contains all the code and assets if the WASM-GC client, and also create an offline download, the results will be in the "javascript_dist" folder.
The WASM-GC client uses a custom fork of TeaVM, the source is available [here](https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm).
**To run the desktop runtime:**
**Note:** Athough it may be tempting to release "desktop" copies of your client, the current desktop runtime was designed for debug use only and is a poor choice for distribution to end users.
Run the `StartDesktopRuntime` script in the "target_lwjgl_desktop" folder (or the `eaglercraftDebugRuntime` Gradle task in your IDE) to run the desktop runtime. This will run the client using the JVM and an LWJGL3-based runtime, which can be useful for debugging crashes and to speed up testing if you don't want to wait for the JavaScript or WASM-GC client to be built.
Do not use the desktop runtime as substitute for testing you client in a browser, client developers who only test their client on the desktop runtime usually end up with lots of unexpected bugs and crashes in their browser builds.
**To debug the desktop runtime:**
If you want to debug the desktop runtime from your IDE, one way you can do it is by enabling the debugger in the LWJGL target's `eaglercraftDebugRuntime` task, but something that will launch even faster is just creating a run configuration in your IDE directly in the LWJGL target project.
You can do this by creating a run configuration specifying `net.lax1dude.eaglercraft.v1_8.internal.lwjgl.MainClass` as the main class, the `desktopRuntime` folder as the working directory, `-Xmx1G -Xms1G -Djava.library.path=.` in the JVM arguments, and if you're on Linux you'll also want to add an environment variable to append the `desktopRuntime` folder to `LD_LIBRARY_PATH` and set `__GL_THREADED_OPTIMIZATIONS` to `0` if using Nvidia drivers.

View File

@ -1,73 +0,0 @@
import org.teavm.gradle.api.OptimizationLevel
buildscript {
dependencies {
classpath files("src/teavmc-classpath/resources")
}
}
plugins {
id "java"
id "eclipse"
id "org.teavm" version "0.9.2"
}
sourceSets {
main {
java {
srcDirs(
"src/main/java",
"src/game/java",
"src/protocol-game/java",
"src/protocol-relay/java",
"src/teavm/java",
"src/teavm-boot-menu/java"
)
}
}
}
repositories {
mavenCentral()
}
dependencies {
teavm(teavm.libs.jso)
teavm(teavm.libs.jsoApis)
compileOnly "org.teavm:teavm-core:0.9.2" // workaround for a few hacks
}
def folder = "javascript"
def name = "classes.js"
teavm.js {
compileJava.options.encoding = "UTF-8"
obfuscated = true
sourceMap = true
targetFileName = "../" + name
optimization = OptimizationLevel.BALANCED // Change to "AGGRESSIVE" for release
outOfProcess = false
fastGlobalAnalysis = false
processMemory = 512
entryPointName = "main"
mainClass = "net.lax1dude.eaglercraft.v1_8.internal.teavm.MainClass"
outputDir = file(folder)
properties = [ "java.util.TimeZone.autodetect": "true" ]
debugInformation = false
}
tasks.named("generateJavaScript") {
doLast {
// NOTE: This step may break at any time, and is not required for 99% of browsers
def phile = file(folder + "/" + name)
def dest = phile.getText("UTF-8")
def i = dest.substring(0, dest.indexOf("=\$rt_globals.Symbol('jsoClass');")).lastIndexOf("let ")
dest = dest.substring(0, i) + "var" + dest.substring(i + 3)
def j = dest.indexOf("function(\$rt_globals,\$rt_exports){")
dest = dest.substring(0, j + 34) + "\n" + file(folder + "/ES6ShimScript.txt").getText("UTF-8") + "\n" + dest.substring(j + 34)
phile.write(dest, "UTF-8")
}
}

View File

@ -0,0 +1,51 @@
plugins {
id("java")
}
allprojects {
apply(plugin = "eclipse")
repositories {
mavenCentral()
}
plugins.withId("java") {
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
sourceSets {
named("main") {
java.srcDirs(
"src/main/java",
"src/game/java",
"src/protocol-game/java",
"src/protocol-relay/java",
"src/platform-api/java"
)
}
}
dependencies {
implementation(libs.bundles.common)
}
tasks.withType<Jar> {
// TeaVM will fail if anything from platform-api is in the JAR
fileTree("src/platform-api/java").visit {
if (!isDirectory) {
if (path.endsWith(".java")) {
exclude(path.substring(0, path.length - 5) + ".class")
}
}
}
}

View File

@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx2G -Xms2G
org.gradle.jvmargs=-Xmx4G -Xms4G
org.gradle.problems.report=false

View File

@ -0,0 +1,12 @@
[libraries]
hppc = "com.carrotsearch:hppc:0.10.0"
jsr305 = "com.google.code.findbugs:jsr305:3.0.2"
lang3 = "org.apache.commons:commons-lang3:3.6"
jorbis = "org.jcraft:jorbis:0.0.17"
[bundles]
common = [
"hppc",
"jsr305",
"lang3"
]

View File

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1,10 +0,0 @@
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/6.0/userguide/multi_project_builds.html
*/
rootProject.name = 'eaglercraft-workspace'

View File

@ -0,0 +1,22 @@
import java.io.File
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = "eagler-teavm"
url = uri("https://eaglercraft-teavm-fork.github.io/maven/")
}
maven {
name = "eagler-local"
url = uri(File(rootDir, "gradle/local-libs"))
}
mavenCentral()
}
}
rootProject.name = "eaglercraft-workspace"
include("target_lwjgl_desktop")
include("target_teavm_javascript")
include("target_teavm_wasm_gc")

View File

@ -0,0 +1,5 @@
@echo off
title gradlew target_lwjgl_desktop:eaglercraftDebugRuntime
cd ../
call gradlew target_lwjgl_desktop:eaglercraftDebugRuntime
pause

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd ../
chmod +x gradlew
./gradlew target_lwjgl_desktop:eaglercraftDebugRuntime

View File

@ -0,0 +1,67 @@
import java.util.*
plugins {
id("java")
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
sourceSets {
named("main") {
java.srcDirs(
"../src/lwjgl/java"
)
}
}
dependencies {
implementation(rootProject)
implementation(libs.bundles.common)
implementation(platform("org.lwjgl:lwjgl-bom:3.3.6"))
implementation("org.lwjgl:lwjgl")
implementation("org.lwjgl:lwjgl-egl")
implementation("org.lwjgl:lwjgl-glfw")
implementation("org.lwjgl:lwjgl-jemalloc")
implementation("org.lwjgl:lwjgl-openal")
implementation("org.lwjgl:lwjgl-opengles")
implementation("org.java-websocket:Java-WebSocket:1.6.0")
implementation("dev.onvoid.webrtc:webrtc-java:0.10.0")
implementation(
files(
"../desktopRuntime/codecjorbis-20101023.jar",
"../desktopRuntime/codecwav-20101023.jar",
"../desktopRuntime/soundsystem-20120107.jar",
"../desktopRuntime/UnsafeMemcpy.jar"
)
)
}
tasks.register<JavaExec>("eaglercraftDebugRuntime") {
group = "desktopruntime"
description = "Runs the desktop runtime"
classpath += sourceSets["main"].runtimeClasspath
val daArgs: MutableList<String> = mutableListOf(
"-Xmx1G",
"-Xms1G"
)
if (System.getProperty("os.name").lowercase(Locale.getDefault()).contains("mac")) {
daArgs += "-XstartOnFirstThread"
}
jvmArgs = daArgs
workingDir = file("../desktopRuntime")
systemProperties = mapOf(
"java.library.path" to workingDir.absolutePath
)
environment("LD_LIBRARY_PATH", workingDir.absolutePath)
environment("__GL_THREADED_OPTIMIZATIONS", "0") // Hurts performance, fixes Nvidia crash on Linux
mainClass = "net.lax1dude.eaglercraft.v1_8.internal.lwjgl.MainClass"
}

View File

@ -0,0 +1,5 @@
javascript/classes.js
javascript/classes.js.map
javascript/assets.epk
javascript/lang.tmp.epk
javascript/EaglercraftX_1.8_Offline_*

View File

@ -0,0 +1,5 @@
@echo off
title gradlew target_teavm_javascript:assembleMainComponents
cd ../
call gradlew target_teavm_javascript:assembleMainComponents
pause

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd ../
chmod +x gradlew
./gradlew target_teavm_javascript:assembleMainComponents

View File

@ -0,0 +1,4 @@
@echo off
cd ../
call gradlew target_teavm_javascript:makeMainOfflineDownload
pause

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd ../
chmod +x gradlew
./gradlew target_teavm_javascript:makeMainOfflineDownload

View File

@ -0,0 +1,4 @@
@echo off
title MakeOfflineDownload
java -cp "buildtools/MakeOfflineDownload.jar;buildtools/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html"
pause

View File

@ -0,0 +1,2 @@
#!/bin/sh
java -cp "buildtools/MakeOfflineDownload.jar:buildtools/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html"

View File

@ -0,0 +1,112 @@
import com.resentclient.oss.eaglercraft.build.impl.js
import org.teavm.gradle.api.OptimizationLevel
import org.teavm.gradle.tasks.GenerateJavaScriptTask
buildscript {
dependencies {
classpath(files("../src/teavmc-classpath/resources"))
}
}
plugins {
id("java")
id("org.teavm") version "0.9.2"
id("com.resentclient.oss.eaglercraft.build") version "0.0.0"
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
sourceSets {
named("main") {
java.srcDirs(
"../src/teavm/java",
"../src/teavm-boot-menu/java"
)
resources.srcDirs(
"../src/teavm/resources"
)
}
}
dependencies {
teavm(teavm.libs.jso)
teavm(teavm.libs.jsoApis)
compileOnly("org.teavm:teavm-core:0.9.2") // workaround for a few hacks
implementation(rootProject)
implementation(libs.jorbis)
implementation(libs.bundles.common)
}
val jsFolder = "javascript"
val jsFileName = "classes.js"
teavm.js {
obfuscated = true
sourceMap = true
targetFileName = "../$jsFileName"
optimization = OptimizationLevel.BALANCED // Change to "AGGRESSIVE" for release
outOfProcess = false
fastGlobalAnalysis = false
processMemory = 512
entryPointName.set("main")
mainClass = "net.lax1dude.eaglercraft.v1_8.internal.teavm.MainClass"
outputDir = file(jsFolder)
properties = mapOf("java.util.TimeZone.autodetect" to "true")
debugInformation = false
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.named<GenerateJavaScriptTask>("generateJavaScript") {
doLast {
try {
// NOTE: This step may break at any time, and is not required for 99% of browsers
var phile = file("$jsFolder/$jsFileName")
var dest = phile.readText()
var i = dest.substring(0, dest.indexOf("=\$rt_globals.Symbol('jsoClass');")).lastIndexOf("let ")
dest = dest.substring(0, i) + "var" + dest.substring(i + 3)
var j = dest.indexOf("function(\$rt_globals,\$rt_exports){")
dest = dest.substring(
0,
j + 34
) + "\n" + file("$jsFolder/ES6ShimScript.txt").readText() + "\n" + dest.substring(j + 34)
phile.writeText(dest)
} catch (ex: Exception) {
if (teavm.js.obfuscated.get()) {
logger.info("Error occured while adding support for old browsers failed!", ex)
logger.info("This was probably caused by building with non-obfuscated javascript, " +
"you can probably safely ignore this!")
logger.info("If this error persists with obfuscated javascript, report to ayunami2000!")
} else {
logger.info("Adding support for old browsers failed!", ex)
logger.info("Please contact ayunami2000 and report this!")
}
}
}
}
eaglercraftBuild {
suites {
js("main") {
sourceGeneratorOutput = file("$jsFolder/$jsFileName")
offlineDownloadTemplate = file("javascript/OfflineDownloadTemplate.txt")
mainOutput = file("$jsFolder/EaglercraftX_1.8_Offline_en_US.html")
internationalOutput = file("$jsFolder/EaglercraftX_1.8_Offline_International.html")
}.apply {
epkSources = file("../desktopRuntime/resources")
epkOutput = file("$jsFolder/assets.epk")
languageMetadataInput = file("$jsFolder/lang")
languageEpkOutput = file("$jsFolder/lang.tmp.epk")
sourceGeneratorTaskName = "generateJavaScript"
}
}
}

View File

@ -255,7 +255,6 @@ window.eaglercraftXOptsHints = {
<div style="margin:0px;width:100%;height:100%;font-family:sans-serif;display:flex;align-items:center;user-select:none;" id="launch_countdown_screen">
<div style="margin:auto;text-align:center;">
<h1>This file is from <span style="color:#AA0000;">${date}</span></h1>
<h3>Get the latest version at <a href="https://eaglercraft.com"><span style="color:#AA0000;">eaglercraft.com</span></a></h1>
<h2 id="gameWillLaunchIn">Game will launch in <span id="launchCountdownNumber">5</span>...</h2>
<div style="border:2px solid black;width:100%;height:15px;padding:1px;margin-bottom:20vh;"><div id="launchCountdownProgress" style="background-color:#555555;width:0%;height:100%;"></div>
<p style="margin-top:30px;"><button id="skipCountdown" autofocus>Skip Countdown</button>&emsp;<button id="bootMenu">Enter Boot Menu</button></p></div>

View File

@ -7,10 +7,10 @@
# ipfs: cid here
# list: url to another list
list: https://eaglercraft.com/dl/cors/u35_backup.list
url: https://eaglercraft.com/dl/cors/u35_backup.dat
list: https://eaglercraft.com/dl/cors/u50_backup.list
#url: https://eaglercraft.com/dl/cors/u50_backup.dat
ipfs: bafybeibolco2rlnyiiweipoarwf6kw235xdv7jbbpcwpmm5wksnh4agx5e
ipfs: bafybeiakzrybcx52rxkjjtamqpdwhuqmsgi5bwmktjsvnnqpm67iajecnm
use-gateway: https://gateway.ipfs.io/ipfs/$cid$/$path$
use-gateway: https://4everland.io/ipfs/$cid$/$path$
@ -18,7 +18,6 @@ use-gateway: https://dweb.link/ipfs/$cid$/$path$
use-gateway: https://cloudflare-ipfs.com/ipfs/$cid$/$path$
use-gateway: https://cf-ipfs.com/ipfs/$cid$/$path$
use-gateway: https://w3s.link/ipfs/$cid$/$path$
use-gateway: https://ipfs.eth.aragon.network/ipfs/$cid$/$path$
use-gateway: https://nftstorage.link/ipfs/$cid$/$path$
use-gateway: https://$cid$.ipfs.gateway.ipfs.io/$path$

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,12 +1,7 @@
.gradle
.settings
.classpath
.project
build
bin
javascript/eagruntime.js
javascript/classes.wasm
javascript/classes.wasm.teadbg
javascript/assets.epk
javascript/lang.tmp.epk
javascript_dist/assets.epw
javascript_dist/EaglercraftX_1.8_*

View File

@ -0,0 +1,5 @@
@echo off
title gradlew target_teavm_wasm_gc:assembleMainComponents
cd ../
call gradlew target_teavm_wasm_gc:assembleMainComponents
pause

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd ../
chmod +x gradlew
./gradlew target_teavm_wasm_gc:assembleMainComponents

View File

@ -0,0 +1,4 @@
@echo off
cd ../
call gradlew target_teavm_wasm_gc:makeMainWasmClientBundle
pause

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd ../
chmod +x gradlew
./gradlew target_teavm_wasm_gc:makeMainWasmClientBundle

View File

@ -0,0 +1,115 @@
import com.resentclient.oss.eaglercraft.build.impl.wasm
import org.teavm.gradle.api.OptimizationLevel
import org.teavm.gradle.api.WasmDebugInfoLocation
import org.teavm.gradle.api.WasmDebugInfoLevel
plugins {
id("java")
id("org.teavm") version "0.12.0-EAGLER-R2"
id("com.resentclient.oss.eaglercraft.build") version "0.0.0"
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
sourceSets {
named("main") {
java.srcDirs(
"../src/wasm-gc-teavm/java"
)
resources.srcDirs(
"../src/teavm/resources"
)
}
}
repositories {
maven {
name = "eagler-teavm"
url = uri("https://eaglercraft-teavm-fork.github.io/maven/")
}
}
dependencies {
teavm(teavm.libs.jso)
teavm(teavm.libs.jsoApis)
compileOnly("org.teavm:teavm-core:0.12.0-EAGLER-R2") // workaround for a few hacks
implementation(rootProject)
implementation(libs.jorbis)
implementation(libs.bundles.common)
}
val wasmFolder = "javascript"
val wasmOutputFileName = "classes.wasm"
teavm.wasmGC {
targetFileName = "../" + wasmOutputFileName
optimization = OptimizationLevel.AGGRESSIVE
outOfProcess = false
fastGlobalAnalysis = false
processMemory = 512
mainClass = "net.lax1dude.eaglercraft.v1_8.internal.wasm_gc_teavm.MainClass"
outputDir = file(wasmFolder)
properties = mapOf("java.util.TimeZone.autodetect" to "true")
debugInformation = true
debugInfoLocation = WasmDebugInfoLocation.EXTERNAL;
debugInfoLevel = WasmDebugInfoLevel.DEOBFUSCATION;
minDirectBuffersSize = 32
maxDirectBuffersSize = 512
disassembly = true
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
eaglercraftBuild {
suites {
wasm("main") {
val srcFolder = "../src/wasm-gc-teavm/js"
closureCompiler = file("buildtools/closure-compiler.jar")
closureMainClass = "com.google.javascript.jscomp.CommandLineRunner"
closureInputFiles = files(
"$srcFolder/externs.js",
"$srcFolder/eagruntime_util.js",
"$srcFolder/eagruntime_main.js",
"$srcFolder/platformApplication.js",
"$srcFolder/platformAssets.js",
"$srcFolder/platformAudio.js",
"$srcFolder/platformFilesystem.js",
"$srcFolder/platformInput.js",
"$srcFolder/platformNetworking.js",
"$srcFolder/platformOpenGL.js",
"$srcFolder/platformRuntime.js",
"$srcFolder/platformScreenRecord.js",
"$srcFolder/platformVoiceClient.js",
"$srcFolder/platformWebRTC.js",
"$srcFolder/platformWebView.js",
"$srcFolder/clientPlatformSingleplayer.js",
"$srcFolder/serverPlatformSingleplayer.js",
"$srcFolder/WASMGCBufferAllocator.js",
"$srcFolder/fix-webm-duration.js",
"$srcFolder/teavm_runtime.js",
"$srcFolder/eagruntime_entrypoint.js"
)
runtimeOutput = file("javascript/eagruntime.js")
epwSource = file("$wasmFolder/epw_src.txt")
epwMeta = file("$wasmFolder/epw_meta.txt")
epwSearchDirectory = file(wasmFolder)
clientBundleOutputDir = file("javascript_dist")
}.apply {
epkSources = file("../desktopRuntime/resources")
epkOutput = file("javascript/assets.epk")
languageMetadataInput = file("../target_teavm_javascript/javascript/lang")
languageEpkOutput = file("javascript/lang.tmp.epk")
sourceGeneratorTaskName = "generateWasmGC"
}
}
}

View File

@ -1,8 +1,8 @@
client-version-integer=50
client-version-integer=51
client-package-name=net.lax1dude.eaglercraft.v1_8.client
client-origin-name=EaglercraftX
client-origin-version=u50
client-origin-version=u51
client-origin-vendor=lax1dude
client-fork-name=EaglercraftX
client-fork-version=u50
client-fork-version=u51
client-fork-vendor=lax1dude

View File

@ -6,7 +6,7 @@ classes-deobf-teadbg-file=classes.wasm.teadbg
classes-deobf-wasm-file=classes.wasm-deobfuscator.wasm
assets-epk-0-file=assets.epk
assets-epk-0-path=/
assets-epk-1-file=../../javascript/lang
assets-epk-1-file=lang.tmp.epk
assets-epk-1-path=/assets/minecraft/lang/
splash-logo-image-file=splash.png
splash-logo-image-mime=image/png

View File

@ -1,6 +0,0 @@
@echo off
title epkcompiler
echo compiling, please wait...
java -jar "../desktopRuntime/CompileEPK.jar" "../desktopRuntime/resources" "javascript/assets.epk" none
echo finished compiling epk
pause

View File

@ -1,2 +0,0 @@
#!/bin/sh
java -jar "../desktopRuntime/CompileEPK.jar" "../desktopRuntime/resources" "javascript/assets.epk" none

View File

@ -1,6 +0,0 @@
@echo off
title CompileEagRuntimeJS
set srcFolder=../src/wasm-gc-teavm/js
echo Compiling %srcFolder%
java -jar buildtools/closure-compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --assume_function_wrapper --emit_use_strict --isolation_mode IIFE --js "%srcFolder%/externs.js" "%srcFolder%/eagruntime_util.js" "%srcFolder%/eagruntime_main.js" "%srcFolder%/platformApplication.js" "%srcFolder%/platformAssets.js" "%srcFolder%/platformAudio.js" "%srcFolder%/platformFilesystem.js" "%srcFolder%/platformInput.js" "%srcFolder%/platformNetworking.js" "%srcFolder%/platformOpenGL.js" "%srcFolder%/platformRuntime.js" "%srcFolder%/platformScreenRecord.js" "%srcFolder%/platformVoiceClient.js" "%srcFolder%/platformWebRTC.js" "%srcFolder%/platformWebView.js" "%srcFolder%/clientPlatformSingleplayer.js" "%srcFolder%/serverPlatformSingleplayer.js" "%srcFolder%/WASMGCBufferAllocator.js" "%srcFolder%/fix-webm-duration.js" "%srcFolder%/teavm_runtime.js" "%srcFolder%/eagruntime_entrypoint.js" --js_output_file javascript/eagruntime.js
pause

View File

@ -1,4 +0,0 @@
#!/bin/sh
srcFolder=../src/wasm-gc-teavm/js
echo Compiling $srcFolder
java -jar buildtools/closure-compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --assume_function_wrapper --emit_use_strict --isolation_mode IIFE --js $srcFolder/externs.js $srcFolder/eagruntime_util.js $srcFolder/eagruntime_main.js $srcFolder/platformApplication.js $srcFolder/platformAssets.js $srcFolder/platformAudio.js $srcFolder/platformFilesystem.js $srcFolder/platformInput.js $srcFolder/platformNetworking.js $srcFolder/platformOpenGL.js $srcFolder/platformRuntime.js $srcFolder/platformScreenRecord.js $srcFolder/platformVoiceClient.js $srcFolder/platformWebRTC.js $srcFolder/platformWebView.js $srcFolder/clientPlatformSingleplayer.js $srcFolder/serverPlatformSingleplayer.js $srcFolder/WASMGCBufferAllocator.js $srcFolder/fix-webm-duration.js $srcFolder/teavm_runtime.js $srcFolder/eagruntime_entrypoint.js --js_output_file javascript/eagruntime.js

View File

@ -1,4 +0,0 @@
@echo off
title gradlew generateWasmGC
call gradlew generateWasmGC
pause

View File

@ -1,3 +0,0 @@
#!/bin/sh
chmod +x gradlew
./gradlew generateWasmGC

View File

@ -1,5 +0,0 @@
@echo off
title MakeWASMClientBundle
cd javascript
java -cp "../buildtools/org.tukanni.xz.jar;../buildtools/MakeWASMClientBundle.jar;../../desktopRuntime/CompileEPK.jar;../../desktopRuntime/MakeOfflineDownload.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeWASMClientBundle epw_src.txt epw_meta.txt "../javascript_dist"
pause

View File

@ -1,3 +0,0 @@
#!/bin/sh
cd javascript
java -cp "../buildtools/org.tukanni.xz.jar:../buildtools/MakeWASMClientBundle.jar:../../desktopRuntime/CompileEPK.jar:../../desktopRuntime/MakeOfflineDownload.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeWASMClientBundle epw_src.txt epw_meta.txt "../javascript_dist"

View File

@ -1,25 +0,0 @@
# EaglercraftX WASM-GC Runtime
This folder contains the Gradle project for compiling the EaglercraftX 1.8 client to WASM. This requires a special fork of TeaVM that has been modified for Eaglercraft. The `settings.gradle` and `build.gradle` are set up to download the binaries automatically but if you would like to build the TeaVM fork yourself you can use the TeaVM fork's `publishToMavenLocal` gradle task and replace the URL maven repository declarations in the gradle build scripts with `mavenLocal()` instead.
**TeaVM Fork: [https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm/tree/eagler-r1](https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm/tree/eagler-r1)**
### To compile the client:
1. Run `CompileEPK` to compile the assets.epk file
2. Run `CompileWASM` to compile the classes.wasm file
3. Run `CompileEagRuntimeJS` to compile the eagruntime.js file
4. Run `MakeWASMClientBundle` to bundle the client into an EPW file
The final assets.epw and offline download will be in the "javascript_dist" folder
### Optional Steps:
- Run `CompileBootstrapJS` to recompile bootstrap.js in the javascript_dist folder
- Run `CompileLoaderWASM`to recompile loader.js and loader.wasm (requires emscripten)
### Potential issues when porting:
- Disabling VSync causes bad input lag, the solution to this problem is to remove the vsync option and force people to play with vsync enabled, like all other browser games
- TeaVM's WASM GC backend is still under development and will sometimes generate broken code with nested try/finally statements in a try/catch block, or other strange runtime glitches
- Fewer reflection features are supported in WASM GC than the JavaScript backend (so far)
- Do not use `@Async` or any sort of callback (like addEventListener) in your Java, you must implement async functions in JavaScript in `../src/wasm-gc-teavm/js`, using JSPI to suspend/resume the thread for promises, or by pushing events into a queue that you can poll from your Java for event handlers.
- Functions imported via the `@Import` will not catch exceptions, if you want proper exception handling you must call the imported function through the JSO

Some files were not shown because too many files have changed in this diff Show More