u22
This commit is contained in:
parent
e5c68395c7
commit
35a758f56a
4
MakeSignedClient.bat
Normal file
4
MakeSignedClient.bat
Normal file
|
@ -0,0 +1,4 @@
|
|||
@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
|
2
MakeSignedClient.sh
Normal file
2
MakeSignedClient.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/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"
|
87
build.gradle
87
build.gradle
|
@ -1,21 +1,9 @@
|
|||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'io.github.zebalu:teavm-gradle-plugin:1.0.0'
|
||||
}
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'eclipse'
|
||||
id 'org.teavm' version '0.9.2'
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'io.github.zebalu.teavm-gradle-plugin'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
|
@ -30,57 +18,22 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
/** we use 0.6.1 due to performance issues on 7.0.0 */
|
||||
implementation 'org.teavm:teavm-platform:0.6.1'
|
||||
implementation('org.teavm:teavm-classlib:0.6.1') {
|
||||
exclude group: 'com.google.code.gson', module: 'gson'
|
||||
}
|
||||
teavm(teavm.libs.jso)
|
||||
teavm(teavm.libs.jsoApis)
|
||||
}
|
||||
|
||||
teavm {
|
||||
|
||||
compileScopes = null;
|
||||
minifying = true;
|
||||
maxTopLevelNames = 10000;
|
||||
properties = null;
|
||||
debugInformationGenerated = false;
|
||||
sourceMapsGenerated = true;
|
||||
sourceFilesCopied = false;
|
||||
incremental = false;
|
||||
transformers = null;
|
||||
|
||||
/** Where to save the result */
|
||||
targetDirectory = file("javascript");
|
||||
|
||||
/** The directory to monitor to decide if compile is up-to-date or not */
|
||||
sourceDirectory = file("src");
|
||||
|
||||
/** How to name the result file. */
|
||||
targetFileName = "classes.js";
|
||||
|
||||
/** Which class holds your public static void main(Strin[] args) method */
|
||||
mainClass = 'net.lax1dude.eaglercraft.v1_8.internal.teavm.MainClass';
|
||||
|
||||
/** This will be the name of your main method after compilation. */
|
||||
entryPointName = 'main';
|
||||
|
||||
classesToPreserve = null;
|
||||
stopOnErrors = false;
|
||||
optimizationLevel = "ADVANCED"; //org.teavm.vm.TeaVMOptimizationLevel.SIMPLE;
|
||||
fastGlobalAnalysis = false;
|
||||
targetType = "JAVASCRIPT"; //org.teavm.tooling.TeaVMTargetType.JAVASCRIPT;
|
||||
cacheDirectory = null;
|
||||
wasmVersion = "V_0x1"; //org.teavm.backend.wasm.render.WasmBinaryVersion.V_0x1;
|
||||
minHeapSize = 4;
|
||||
maxHeapSize = 128;
|
||||
outOfProcess = false;
|
||||
processMemory = 512;
|
||||
longjmpSupported = true;
|
||||
heapDump = false;
|
||||
|
||||
/** Add name of configurations here where to look for jarfiles. */
|
||||
includeJarsFrom = [];
|
||||
|
||||
/** By default teavmc taskd epends on javaCompile task, unless this varaibale is true. */
|
||||
skipJavaCompile = false;
|
||||
teavm.js {
|
||||
obfuscated = true
|
||||
sourceMap = true
|
||||
targetFileName = "../classes.js"
|
||||
optimization = org.teavm.gradle.api.OptimizationLevel.AGGRESSIVE;
|
||||
outOfProcess = false
|
||||
fastGlobalAnalysis = false
|
||||
processMemory = 4048
|
||||
entryPointName = 'main'
|
||||
mainClass = 'net.lax1dude.eaglercraft.v1_8.internal.teavm.MainClass'
|
||||
outputDir = file("javascript")
|
||||
properties = null
|
||||
sourceMap = true
|
||||
debugInformation = false
|
||||
}
|
||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
|||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
53
gradlew
vendored
53
gradlew
vendored
|
@ -1,21 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
|
@ -44,7 +28,7 @@ APP_NAME="Gradle"
|
|||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
@ -125,8 +109,8 @@ if $darwin; then
|
|||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
@ -154,19 +138,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
@ -175,9 +159,14 @@ save () {
|
|||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
eval set -- $DEFAULT_JVM_OPTS --illegal-access=permit $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
|
18
gradlew.bat
vendored
18
gradlew.bat
vendored
|
@ -1,19 +1,3 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
|
@ -30,7 +14,7 @@ set APP_BASE_NAME=%~n0
|
|||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package net.PeytonPlayz585.shadow.opengl;
|
||||
|
||||
public class GL11 {
|
||||
public static int glGetTexLevelParameteri(int target, int level, int pname) {
|
||||
return org.lwjgl.opengles.GLES31.glGetTexLevelParameteri(target, level, pname);
|
||||
}
|
||||
}
|
|
@ -1,16 +1,18 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.internal;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||
*
|
||||
* (please read the 'LICENSE' file this repo's root directory for more info)
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
class OpenGLObjects {
|
||||
|
|
|
@ -20,17 +20,23 @@ import javax.swing.JFileChooser;
|
|||
import javax.swing.JOptionPane;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||
*
|
||||
* (please read the 'LICENSE' file this repo's root directory for more info)
|
||||
* 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 class PlatformApplication {
|
||||
|
@ -45,7 +51,7 @@ public class PlatformApplication {
|
|||
try {
|
||||
Desktop.getDesktop().browse(new URI(url));
|
||||
} catch (Throwable var5) {
|
||||
var5.printStackTrace();
|
||||
EagRuntime.debugPrintStackTrace(var5);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,10 +65,14 @@ public class PlatformApplication {
|
|||
}
|
||||
|
||||
public static void setLocalStorage(String name, byte[] data) {
|
||||
try(FileOutputStream f = new FileOutputStream(new File("_eagstorage."+name+".dat"))) {
|
||||
f.write(data);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if(data == null) {
|
||||
(new File("_eagstorage."+name+".dat")).delete();
|
||||
}else {
|
||||
try(FileOutputStream f = new FileOutputStream(new File("_eagstorage."+name+".dat"))) {
|
||||
f.write(data);
|
||||
} catch (IOException e) {
|
||||
EagRuntime.debugPrintStackTrace(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,8 +199,58 @@ public class PlatformApplication {
|
|||
return res;
|
||||
}
|
||||
|
||||
public static void clearFileChooserResult() {
|
||||
fileChooserHasResult = false;
|
||||
fileChooserResultObject = null;
|
||||
}
|
||||
|
||||
public static void openCreditsPopup(String text) {
|
||||
|
||||
}
|
||||
|
||||
private static final File downloadsDirectory = new File("downloads");
|
||||
private static final Logger downloadsLogger = LogManager.getLogger("DownloadsFolder");
|
||||
|
||||
public static void downloadFileWithName(String fileName, byte[] fileContents) {
|
||||
if(!downloadsDirectory.isDirectory() && !downloadsDirectory.mkdirs()) {
|
||||
throw new RuntimeException("Could not create directory: " + downloadsDirectory.getAbsolutePath());
|
||||
}
|
||||
|
||||
File f = new File(downloadsDirectory, fileName);
|
||||
if(f.exists()) {
|
||||
String name = fileName;
|
||||
String ext = "";
|
||||
int i = fileName.lastIndexOf('.');
|
||||
if(i != -1) {
|
||||
name = fileName.substring(0, i);
|
||||
ext = fileName.substring(i);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
f = new File(downloadsDirectory, name + " (" + (++i) + ")" + ext);
|
||||
}while(f.exists());
|
||||
}
|
||||
|
||||
try(FileOutputStream fos = new FileOutputStream(f)) {
|
||||
fos.write(fileContents);
|
||||
}catch(IOException ex) {
|
||||
throw new RuntimeException("Could not save file: " + f.getAbsolutePath());
|
||||
}
|
||||
|
||||
downloadsLogger.info("Saved {} byte file to: {}", fileContents.length, f.getAbsolutePath());
|
||||
}
|
||||
|
||||
public static void addLogMessage(String logMessage, boolean isError) {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isShowingDebugConsole() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void showDebugConsole() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,16 +14,18 @@ import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
|||
import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||
*
|
||||
* (please read the 'LICENSE' file this repo's root directory for more info)
|
||||
* 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 class PlatformAssets {
|
||||
|
|
|
@ -14,16 +14,18 @@ import paulscode.sound.codecs.CodecJOrbis;
|
|||
import paulscode.sound.codecs.CodecWav;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||
*
|
||||
* (please read the 'LICENSE' file this repo's root directory for more info)
|
||||
* 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 class PlatformAudio {
|
||||
|
|
|
@ -4,16 +4,18 @@ import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
|||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.IntBuffer;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||
*
|
||||
* (please read the 'LICENSE' file this repo's root directory for more info)
|
||||
* 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 class PlatformBufferFunctions {
|
||||
|
|
|
@ -0,0 +1,228 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.lwjgl.LWJGLEntryPoint;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.vfs2.EaglerFileSystemException;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.vfs2.VFSIterator2.BreakLoop;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.server.internal.lwjgl.DesktopIntegratedServer;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-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 class PlatformFilesystem {
|
||||
|
||||
public static final Logger logger = LogManager.getLogger("PlatformFilesystem");
|
||||
|
||||
public static final File filesystemRoot = (new File("filesystem/sp")).getAbsoluteFile();
|
||||
|
||||
public static void initialize() {
|
||||
assertThread();
|
||||
if(!filesystemRoot.isDirectory() && !filesystemRoot.mkdirs()) {
|
||||
throw new EaglerFileSystemException("Could not create directory for virtual filesystem: " + filesystemRoot.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
private static void assertThread() {
|
||||
if(Thread.currentThread() != DesktopIntegratedServer.serverThread) {
|
||||
throw new UnsupportedOperationException("[DEBUG CHECK] VFS2 is currently only initialized for server contexts!");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean eaglerDelete(String pathName) {
|
||||
assertThread();
|
||||
File f = getJREFile(pathName);
|
||||
if(!f.exists()) {
|
||||
logger.warn("Tried to delete file that doesn't exist: \"{}\"", pathName);
|
||||
return false;
|
||||
}
|
||||
if(f.delete()) {
|
||||
deleteParentIfEmpty(f);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ByteBuffer eaglerRead(String pathName) {
|
||||
assertThread();
|
||||
File f = getJREFile(pathName);
|
||||
if(f.isFile()) {
|
||||
long fileSize = f.length();
|
||||
if(fileSize > 2147483647L) throw new EaglerFileSystemException("Too large: " + fileSize + " @ " + f.getAbsolutePath());
|
||||
ByteBuffer buf = PlatformRuntime.allocateByteBuffer((int)fileSize);
|
||||
try(FileInputStream is = new FileInputStream(f)) {
|
||||
byte[] copyBuffer = new byte[4096];
|
||||
int i;
|
||||
while((i = is.read(copyBuffer, 0, copyBuffer.length)) != -1) {
|
||||
buf.put(copyBuffer, 0, i);
|
||||
}
|
||||
if(buf.remaining() > 0) {
|
||||
throw new EaglerFileSystemException("ERROR: " + buf.remaining() + " bytes are remaining after reading: " + f.getAbsolutePath());
|
||||
}
|
||||
buf.flip();
|
||||
ByteBuffer tmp = buf;
|
||||
buf = null;
|
||||
return tmp;
|
||||
}catch (IOException e) {
|
||||
throw new EaglerFileSystemException("Failed to read: " + f.getAbsolutePath(), e);
|
||||
}catch(ArrayIndexOutOfBoundsException ex) {
|
||||
throw new EaglerFileSystemException("ERROR: Expected " + fileSize + " bytes, buffer overflow reading: " + f.getAbsolutePath(), ex);
|
||||
}finally {
|
||||
if(buf != null) {
|
||||
PlatformRuntime.freeByteBuffer(buf);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new EaglerFileSystemException("Not a file: " + f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
public static void eaglerWrite(String pathName, ByteBuffer data) {
|
||||
assertThread();
|
||||
File f = getJREFile(pathName);
|
||||
File p = f.getParentFile();
|
||||
if(!p.isDirectory()) {
|
||||
if(!p.mkdirs()) {
|
||||
throw new EaglerFileSystemException("Could not create parent directory: " + p.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
try(FileOutputStream fos = new FileOutputStream(f)) {
|
||||
byte[] copyBuffer = new byte[4096];
|
||||
int i;
|
||||
while((i = data.remaining()) > 0) {
|
||||
if(i > copyBuffer.length) {
|
||||
i = copyBuffer.length;
|
||||
}
|
||||
data.get(copyBuffer, 0, i);
|
||||
fos.write(copyBuffer, 0, i);
|
||||
}
|
||||
}catch (IOException e) {
|
||||
throw new EaglerFileSystemException("Failed to write: " + f.getAbsolutePath(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean eaglerExists(String pathName) {
|
||||
assertThread();
|
||||
return getJREFile(pathName).isFile();
|
||||
}
|
||||
|
||||
public static boolean eaglerMove(String pathNameOld, String pathNameNew) {
|
||||
assertThread();
|
||||
File f1 = getJREFile(pathNameOld);
|
||||
File f2 = getJREFile(pathNameNew);
|
||||
if(f2.exists()) {
|
||||
logger.warn("Tried to rename file \"{}\" to \"{}\" which already exists! File will be replaced");
|
||||
if(!f2.delete()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(f1.renameTo(f2)) {
|
||||
deleteParentIfEmpty(f1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int eaglerCopy(String pathNameOld, String pathNameNew) {
|
||||
assertThread();
|
||||
File f1 = getJREFile(pathNameOld);
|
||||
File f2 = getJREFile(pathNameNew);
|
||||
if(!f1.isFile()) {
|
||||
return -1;
|
||||
}
|
||||
if(f2.isDirectory()) {
|
||||
throw new EaglerFileSystemException("Destination file is a directory: " + f2.getAbsolutePath());
|
||||
}
|
||||
File p = f2.getParentFile();
|
||||
if(!p.isDirectory()) {
|
||||
if(!p.mkdirs()) {
|
||||
throw new EaglerFileSystemException("Could not create parent directory: " + p.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
int sz = 0;
|
||||
try(FileInputStream is = new FileInputStream(f1)) {
|
||||
try(FileOutputStream os = new FileOutputStream(f2)) {
|
||||
byte[] copyBuffer = new byte[4096];
|
||||
int i;
|
||||
while((i = is.read(copyBuffer, 0, copyBuffer.length)) != -1) {
|
||||
os.write(copyBuffer, 0, i);
|
||||
sz += i;
|
||||
}
|
||||
}
|
||||
}catch (IOException e) {
|
||||
throw new EaglerFileSystemException("Failed to copy \"" + f1.getAbsolutePath() + "\" to file \"" + f2.getAbsolutePath() + "\"", e);
|
||||
}
|
||||
return sz;
|
||||
}
|
||||
|
||||
public static int eaglerSize(String pathName) {
|
||||
assertThread();
|
||||
File f = getJREFile(pathName);
|
||||
if(f.isFile()) {
|
||||
long fileSize = f.length();
|
||||
if(fileSize > 2147483647L) throw new EaglerFileSystemException("Too large: " + fileSize + " @ " + f.getAbsolutePath());
|
||||
return (int)fileSize;
|
||||
}else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void eaglerIterate(String pathName, VFSFilenameIterator itr, boolean recursive) {
|
||||
assertThread();
|
||||
try {
|
||||
iterateFile(pathName, getJREFile(pathName), itr, recursive);
|
||||
}catch(BreakLoop ex) {
|
||||
}
|
||||
}
|
||||
|
||||
private static void iterateFile(String pathName, File f, VFSFilenameIterator itr, boolean recursive) {
|
||||
if(!f.exists()) {
|
||||
return;
|
||||
}
|
||||
if(!f.isDirectory()) {
|
||||
itr.next(pathName);
|
||||
return;
|
||||
}
|
||||
File[] fa = f.listFiles();
|
||||
for(int i = 0; i < fa.length; ++i) {
|
||||
File ff = fa[i];
|
||||
String fn = pathName + "/" + ff.getName();
|
||||
if(ff.isDirectory()) {
|
||||
if(recursive) {
|
||||
iterateFile(fn, ff, itr, true);
|
||||
}
|
||||
}else {
|
||||
itr.next(fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static File getJREFile(String path) {
|
||||
return new File(filesystemRoot, path);
|
||||
}
|
||||
|
||||
private static void deleteParentIfEmpty(File f) {
|
||||
String[] s;
|
||||
while((f = f.getParentFile()) != null && (s = f.list()) != null && s.length == 0) {
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,25 +8,29 @@ import java.util.List;
|
|||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||
*
|
||||
* (please read the 'LICENSE' file this repo's root directory for more info)
|
||||
* 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 class PlatformInput {
|
||||
|
||||
private static long win = 0l;
|
||||
|
||||
private static long cursorDefault = 0l;
|
||||
private static long cursorHand = 0l;
|
||||
private static long cursorText = 0l;
|
||||
|
||||
private static boolean windowFocused = true;
|
||||
private static boolean windowResized = true;
|
||||
|
||||
|
@ -179,7 +183,11 @@ public class PlatformInput {
|
|||
mouseEventList.remove(0);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cursorDefault = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
cursorHand = glfwCreateStandardCursor(GLFW_HAND_CURSOR);
|
||||
cursorText = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
|
||||
glfwSetCursor(glfwWindow, cursorDefault);
|
||||
}
|
||||
|
||||
public static int getWindowWidth() {
|
||||
|
@ -380,5 +388,19 @@ public class PlatformInput {
|
|||
public static boolean isFullscreen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static void showCursor(EnumCursorType cursor) {
|
||||
switch(cursor) {
|
||||
case DEFAULT:
|
||||
default:
|
||||
glfwSetCursor(win, cursorDefault);
|
||||
break;
|
||||
case HAND:
|
||||
glfwSetCursor(win, cursorHand);
|
||||
break;
|
||||
case TEXT:
|
||||
glfwSetCursor(win, cursorText);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.lax1dude.eaglercraft.v1_8.internal;
|
|||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -11,16 +12,18 @@ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
|||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||
*
|
||||
* (please read the 'LICENSE' file this repo's root directory for more info)
|
||||
* 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 class PlatformNetworking {
|
||||
|
@ -86,7 +89,19 @@ public class PlatformNetworking {
|
|||
return playPackets.size() > 0 ? playPackets.remove(0) : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static List<byte[]> readAllPacket() {
|
||||
synchronized(playPackets) {
|
||||
if(!playPackets.isEmpty()) {
|
||||
List<byte[]> ret = new ArrayList<>(playPackets);
|
||||
playPackets.clear();
|
||||
return ret;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int countAvailableReadData() {
|
||||
int total = 0;
|
||||
synchronized(playPackets) {
|
||||
|
|
|
@ -8,16 +8,18 @@ import net.lax1dude.eaglercraft.v1_8.internal.buffer.IntBuffer;
|
|||
import static org.lwjgl.opengles.GLES30.*;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||
*
|
||||
* (please read the 'LICENSE' file this repo's root directory for more info)
|
||||
* 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 class PlatformOpenGL {
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.io.OutputStream;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
@ -43,16 +44,18 @@ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
|||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||
*
|
||||
* (please read the 'LICENSE' file this repo's root directory for more info)
|
||||
* 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 class PlatformRuntime {
|
||||
|
@ -430,6 +433,10 @@ public class PlatformRuntime {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean isOfflineDownloadURL() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static IClientConfigAdapter getClientConfigAdapter() {
|
||||
return DesktopClientConfigAdapter.instance;
|
||||
}
|
||||
|
@ -446,4 +453,19 @@ public class PlatformRuntime {
|
|||
//
|
||||
}
|
||||
|
||||
private static final Random seedProvider = new Random();
|
||||
|
||||
public static long randomSeed() {
|
||||
synchronized(seedProvider) {
|
||||
return seedProvider.nextLong();
|
||||
}
|
||||
}
|
||||
|
||||
public static void getWindowXY(int[] x, int[] y) {
|
||||
glfwGetWindowPos(windowHandle, x, y);
|
||||
}
|
||||
|
||||
public static String currentThreadName() {
|
||||
return Thread.currentThread().getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.internal;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.update.UpdateCertificate;
|
||||
import net.lax1dude.eaglercraft.v1_8.update.UpdateProgressStruct;
|
||||
|
||||
/**
|
||||
* 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 class PlatformUpdateSvc {
|
||||
|
||||
private static final UpdateProgressStruct dummyStruct = new UpdateProgressStruct();
|
||||
|
||||
public static boolean supported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void initialize() {
|
||||
|
||||
}
|
||||
|
||||
public static byte[] getClientSignatureData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static byte[] getClientBundleData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void startClientUpdateFrom(UpdateCertificate clientUpdate) {
|
||||
|
||||
}
|
||||
|
||||
public static UpdateProgressStruct getUpdatingStatus() {
|
||||
return dummyStruct;
|
||||
}
|
||||
|
||||
public static void quine(String filename, byte[] cert, byte[] data, String date) {
|
||||
|
||||
}
|
||||
|
||||
public static void quine(UpdateCertificate clientUpdate, byte[] data) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.lan.LANPeerEvent;
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayQuery;
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayServerSocket;
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayWorldsQuery;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2024 lax1dude, ayunami2000. 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 class PlatformWebRTC {
|
||||
|
||||
public static boolean supported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static RelayServerSocket openRelayConnection(String addr, int timeout) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static RelayQuery openRelayQuery(String addr) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static RelayWorldsQuery openRelayWorldsQuery(String addr) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void startRTCLANClient() {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static int clientLANReadyState() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void clientLANCloseConnection() {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void clientLANSendPacket(byte[] pkt) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static byte[] clientLANReadPacket() {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static List<byte[]> clientLANReadAllPacket() {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void clientLANSetICEServersAndConnect(String[] servers) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void clearLANClientState() {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static String clientLANAwaitICECandidate() {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static String clientLANAwaitDescription() {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static boolean clientLANAwaitChannel() {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static boolean clientLANClosed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void clientLANSetICECandidate(String candidate) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void clientLANSetDescription(String description) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void startRTCLANServer() {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void serverLANInitializeServer(String[] servers) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void serverLANCloseServer() {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static LANPeerEvent serverLANGetEvent(String clientId) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static List<LANPeerEvent> serverLANGetAllEvent(String clientId) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void serverLANWritePacket(String peer, byte[] data) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void serverLANCreatePeer(String peer) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void serverLANPeerICECandidates(String peer, String iceCandidates) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void serverLANPeerDescription(String peer, String description) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static void serverLANDisconnectPeer(String peer) {
|
||||
throw new UnsupportedOperationException("LAN not supported on desktop runtime!");
|
||||
}
|
||||
|
||||
public static int countPeers() {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -13,16 +13,18 @@ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
|||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||