This commit is contained in:
eaglercraft 2024-05-30 22:20:39 -07:00
parent f6612ce09e
commit cfab2e85bf
23 changed files with 215 additions and 46 deletions

View File

@ -44,6 +44,27 @@ window.eaglercraftXOptsHints = {
<script type="text/javascript">
"use strict";
(function(){
function fetchB64PayloadSafe() {
const dataURL = window.eaglercraftXClientBundle;
if(!dataURL.startsWith("data:application/octet-stream;base64,")) {
return fetch(dataURL, { cache: "force-cache" }).then((response) => response.blob());
}
return new Promise((resolve) => {
fetch(dataURL)
.then((response) => response.blob())
.then((blob) => { resolve(blob); })
.catch((err) => {
console.error("Caught an error decoding base64 via fetch, doing it the slow way instead...");
// MIT License - https://github.com/beatgammit/base64-js
const base64js = (function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({"/":[function(a,b,c){"use strict";function d(a){var b=a.length;if(0<b%4)throw new Error("Invalid string. Length must be a multiple of 4");var c=a.indexOf("=");-1===c&&(c=b);var d=c===b?0:4-c%4;return[c,d]}function e(a,b,c){return 3*(b+c)/4-c}function f(a){var b,c,f=d(a),g=f[0],j=f[1],k=new Uint8Array(e(a,g,j)),l=0,m=0<j?g-4:g;for(c=0;c<m;c+=4)b=h[a.charCodeAt(c)]<<18|h[a.charCodeAt(c+1)]<<12|h[a.charCodeAt(c+2)]<<6|h[a.charCodeAt(c+3)],k[l++]=255&b>>16,k[l++]=255&b>>8,k[l++]=255&b;return 2===j&&(b=h[a.charCodeAt(c)]<<2|h[a.charCodeAt(c+1)]>>4,k[l++]=255&b),1===j&&(b=h[a.charCodeAt(c)]<<10|h[a.charCodeAt(c+1)]<<4|h[a.charCodeAt(c+2)]>>2,k[l++]=255&b>>8,k[l++]=255&b),k}c.byteLength=function b(a){var c=d(a),e=c[0],f=c[1];return 3*(e+f)/4-f},c.toByteArray=f;for(var g=[],h=[],j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=0,l=j.length;k<l;++k)g[k]=j[k],h[j.charCodeAt(k)]=k;h[45]=62,h[95]=63},{}]},{},[])("/")})();
const bytesDec = base64js.toByteArray(dataURL.substring(37)).buffer;
const bytesBlob = new Blob([bytesDec], { type: "application/octet-stream" });
window.eaglercraftXClientBundle = URL.createObjectURL(bytesBlob);
console.error("Created " + bytesDec.byteLength + " byte object URL: " + window.eaglercraftXClientBundle);
resolve(bytesBlob);
});
});
}
var ds = new DecompressionStream("gzip");
var result = [];
function fetchStream(reader) {
@ -58,9 +79,7 @@ window.eaglercraftXOptsHints = {
return reader.read().then(processData);
});
}
fetch(window.eaglercraftXClientBundle, { cache: "force-cache" })
.then((response) => response.blob())
.then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
fetchB64PayloadSafe().then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
})();
</script>
<script type="text/javascript">

View File

@ -11,6 +11,7 @@
- Made the integrated PBR resource pack
- Wrote all desktop emulation code
- Wrote EaglercraftXBungee
- Wrote EaglercraftXVelocity
- Wrote WebRTC relay server
- Wrote voice chat server
- Wrote the patch and build system
@ -20,6 +21,7 @@
- Many bug fixes
- WebRTC LAN worlds
- WebRTC voice chat
- Made velocity plugin work
- Added resource packs
- Added screen recording
- Added seamless fullscreen
@ -584,6 +586,44 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Project Name: BungeeCord
Project Author: md_5
Project URL: https://www.spigotmc.org/go/bungeecord/
Used For: parsing YAML config files in EaglercraftXVelocity
* Copyright (c) 2012, md_5. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* The name of the author may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* You may not use the software for commercial software hosting services without
* written permission from the author.
*
* 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 OWNER 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.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Project Name: 3D Sound System
Project Author: Paul Lamb
Project URL: http://www.paulscode.com/forum/index.php?topic=4.0

View File

@ -1 +1 @@
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.1","pluginButton":"Download \"EaglerXBungee-1.2.1.jar\"","pluginFilename":"EaglerXBungee.zip"}
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.3","pluginButton":"Download \"EaglerXBungee-1.2.3.jar\"","pluginFilename":"EaglerXBungee.zip"}

View File

@ -44,6 +44,27 @@ window.eaglercraftXOptsHints = {
<script type="text/javascript">
"use strict";
(function(){
function fetchB64PayloadSafe() {
const dataURL = window.eaglercraftXClientBundle;
if(!dataURL.startsWith("data:application/octet-stream;base64,")) {
return fetch(dataURL, { cache: "force-cache" }).then((response) => response.blob());
}
return new Promise((resolve) => {
fetch(dataURL)
.then((response) => response.blob())
.then((blob) => { resolve(blob); })
.catch((err) => {
console.error("Caught an error decoding base64 via fetch, doing it the slow way instead...");
// MIT License - https://github.com/beatgammit/base64-js
const base64js = (function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({"/":[function(a,b,c){"use strict";function d(a){var b=a.length;if(0<b%4)throw new Error("Invalid string. Length must be a multiple of 4");var c=a.indexOf("=");-1===c&&(c=b);var d=c===b?0:4-c%4;return[c,d]}function e(a,b,c){return 3*(b+c)/4-c}function f(a){var b,c,f=d(a),g=f[0],j=f[1],k=new Uint8Array(e(a,g,j)),l=0,m=0<j?g-4:g;for(c=0;c<m;c+=4)b=h[a.charCodeAt(c)]<<18|h[a.charCodeAt(c+1)]<<12|h[a.charCodeAt(c+2)]<<6|h[a.charCodeAt(c+3)],k[l++]=255&b>>16,k[l++]=255&b>>8,k[l++]=255&b;return 2===j&&(b=h[a.charCodeAt(c)]<<2|h[a.charCodeAt(c+1)]>>4,k[l++]=255&b),1===j&&(b=h[a.charCodeAt(c)]<<10|h[a.charCodeAt(c+1)]<<4|h[a.charCodeAt(c+2)]>>2,k[l++]=255&b>>8,k[l++]=255&b),k}c.byteLength=function b(a){var c=d(a),e=c[0],f=c[1];return 3*(e+f)/4-f},c.toByteArray=f;for(var g=[],h=[],j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=0,l=j.length;k<l;++k)g[k]=j[k],h[j.charCodeAt(k)]=k;h[45]=62,h[95]=63},{}]},{},[])("/")})();
const bytesDec = base64js.toByteArray(dataURL.substring(37)).buffer;
const bytesBlob = new Blob([bytesDec], { type: "application/octet-stream" });
window.eaglercraftXClientBundle = URL.createObjectURL(bytesBlob);
console.error("Created " + bytesDec.byteLength + " byte object URL: " + window.eaglercraftXClientBundle);
resolve(bytesBlob);
});
});
}
var ds = new DecompressionStream("gzip");
var result = [];
function fetchStream(reader) {
@ -58,9 +79,7 @@ window.eaglercraftXOptsHints = {
return reader.read().then(processData);
});
}
fetch(window.eaglercraftXClientBundle, { cache: "force-cache" })
.then((response) => response.blob())
.then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
fetchB64PayloadSafe().then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
})();
</script>
<script type="text/javascript">

View File

@ -10,7 +10,7 @@ public class EaglercraftVersion {
/// Customize these to fit your fork:
public static final String projectForkName = "EaglercraftX";
public static final String projectForkVersion = "u31";
public static final String projectForkVersion = "u32";
public static final String projectForkVendor = "lax1dude";
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
@ -20,7 +20,7 @@ public class EaglercraftVersion {
public static final String projectOriginName = "EaglercraftX";
public static final String projectOriginAuthor = "lax1dude";
public static final String projectOriginRevision = "1.8";
public static final String projectOriginVersion = "u31";
public static final String projectOriginVersion = "u32";
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
@ -31,7 +31,7 @@ public class EaglercraftVersion {
public static final boolean enableUpdateService = true;
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
public static final int updateBundlePackageVersionInt = 31;
public static final int updateBundlePackageVersionInt = 32;
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;

View File

@ -60,6 +60,10 @@ public class GLObjectMap<T> {
return (T) values[obj];
}
public void set(int obj, T val) {
values[obj] = val;
}
private void resize() {
int oldSize = size;
size += size / 2;

View File

@ -153,11 +153,12 @@ public class EaglerFolderResourcePack extends AbstractResourcePack {
List<String> fileNames = Lists.newArrayList();
logger.info("Counting files...");
ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file));
ZipEntry zipEntry;
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fileNames.add(zipEntry.getName());
try(ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file))) {
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fileNames.add(zipEntry.getName());
}
}
}
@ -195,22 +196,30 @@ public class EaglerFolderResourcePack extends AbstractResourcePack {
int totalSize = 0;
int totalFiles = 0;
int lastProg = 0;
ziss = new ZipInputStream(new EaglerInputStream(file));
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fn = zipEntry.getName();
if(fn.length() > prefixLen) {
byte[] buffer = new byte[(int)zipEntry.getSize()];
int i = 0, j;
while(i < buffer.length && (j = ziss.read(buffer, i, buffer.length - i)) != -1) {
i += j;
}
(new VFile2(prefix, folderName, fn.substring(prefixLen))).setAllBytes(buffer);
totalSize += buffer.length;
++totalFiles;
if(totalSize - lastProg > 25000) {
lastProg = totalSize;
logger.info("Extracted {} files, {} bytes from ZIP file...", totalFiles, totalSize);
try(ZipInputStream ziss = new ZipInputStream(new EaglerInputStream(file))) {
int sz;
while ((zipEntry = ziss.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
fn = zipEntry.getName();
if(fn.length() > prefixLen) {
byte[] buffer;
sz = (int)zipEntry.getSize();
if(sz >= 0) {
buffer = new byte[sz];
int i = 0, j;
while(i < buffer.length && (j = ziss.read(buffer, i, buffer.length - i)) != -1) {
i += j;
}
}else {
buffer = EaglerInputStream.inputStreamToBytes(ziss);
}
(new VFile2(prefix, folderName, fn.substring(prefixLen))).setAllBytes(buffer);
totalSize += buffer.length;
++totalFiles;
if(totalSize - lastProg > 25000) {
lastProg = totalSize;
logger.info("Extracted {} files, {} bytes from ZIP file...", totalFiles, totalSize);
}
}
}
}

View File

@ -488,6 +488,17 @@ public class EaglercraftGPU {
return mapTexturesGL.get(tex);
}
public static final void regenerateTexture(int tex) {
ITextureGL webglTex = mapTexturesGL.get(tex);
if(webglTex != null) {
GlStateManager.unbindTextureIfCached(tex);
_wglDeleteTextures(webglTex);
mapTexturesGL.set(tex, _wglGenTextures());
}else {
logger.error("Tried to regenerate a missing texture!");
}
}
public static final void drawHighPoly(HighPolyMesh mesh) {
if(mesh.vertexCount == 0 || mesh.indexCount == 0 || mesh.vertexArray == null) {
return;

View File

@ -589,18 +589,25 @@ public class GlStateManager {
}
public static final void deleteTexture(int texture) {
unbindTextureIfCached(texture);
_wglDeleteTextures(EaglercraftGPU.mapTexturesGL.free(texture));
boolean f = false;
}
static final void unbindTextureIfCached(int texture) {
boolean f1, f2 = false;
for(int i = 0; i < boundTexture.length; ++i) {
if(boundTexture[i] == texture) {
_wglActiveTexture(GL_TEXTURE0 + i);
f1 = i != activeTexture;
if(f2 || f1) {
_wglActiveTexture(GL_TEXTURE0 + i);
f2 = f1;
}
_wglBindTexture(GL_TEXTURE_2D, null);
_wglBindTexture(GL_TEXTURE_3D, null);
boundTexture[i] = -1;
f = true;
}
}
if(f) {
if(f2) {
_wglActiveTexture(GL_TEXTURE0 + activeTexture);
}
}

View File

@ -2058,7 +2058,7 @@ public class EaglerDeferredPipeline {
GlStateManager.disableBlend();
if(reprojectionEngineEnable || config.realisticWater) {
if(reprojectionEngineEnable || config.is_rendering_realisticWater) {
// =========== SAVE REPROJECTION DATA FOR NEXT FRAME ============= //

View File

@ -74,13 +74,17 @@ public class WorldConverterMCA {
if (f.isDirectory()) continue;
String lowerName = f.getName().toLowerCase();
if (!(lowerName.endsWith(".dat") || lowerName.endsWith(".dat_old") || lowerName.endsWith(".mca") || lowerName.endsWith(".mcr") || lowerName.endsWith(".bmp"))) continue;
EaglerOutputStream baos = new EaglerOutputStream();
int len;
while ((len = zis.read(bb)) != -1) {
baos.write(bb, 0, len);
byte[] b;
int sz = (int)f.getSize();
if(sz >= 0) {
b = new byte[sz];
int j = 0, k;
while(j < b.length && (k = zis.read(b, j, b.length - j)) != -1) {
j += k;
}
}else {
b = EaglerInputStream.inputStreamToBytes(zis);
}
baos.close();
byte[] b = baos.toByteArray();
String fileName = f.getName().substring(folderPrefixOffset);
if (fileName.equals("level.dat") || fileName.equals("level.dat_old")) {
NBTTagCompound worldDatNBT = CompressedStreamTools.readCompressed(new EaglerInputStream(b));

View File

@ -30,6 +30,7 @@ public abstract class AbstractTexture implements ITextureObject {
protected boolean mipmap;
protected boolean blurLast;
protected boolean mipmapLast;
protected boolean hasAllocated;
public void setBlurMipmapDirect(boolean parFlag, boolean parFlag2) {
if (blur != parFlag || mipmap != parFlag2) {
@ -67,6 +68,7 @@ public abstract class AbstractTexture implements ITextureObject {
public int getGlTextureId() {
if (this.glTextureId == -1) {
this.glTextureId = TextureUtil.glGenTextures();
hasAllocated = false;
}
return this.glTextureId;
@ -79,4 +81,18 @@ public abstract class AbstractTexture implements ITextureObject {
}
}
/**
* This function is needed due to EaglercraftX's use of glTexStorage2D to
* allocate memory for textures, some OpenGL implementations don't like it when
* you call glTexStorage2D on the same texture object more than once
*/
protected void regenerateIfNotAllocated() {
if (this.glTextureId != -1) {
if (hasAllocated) {
EaglercraftGPU.regenerateTexture(glTextureId);
}
hasAllocated = true;
}
}
}

View File

@ -40,6 +40,7 @@ public class DynamicTexture extends AbstractTexture {
this.width = textureWidth;
this.height = textureHeight;
this.dynamicTextureData = new int[textureWidth * textureHeight];
this.hasAllocated = true;
TextureUtil.allocateTexture(this.getGlTextureId(), textureWidth, textureHeight);
}

View File

@ -91,6 +91,7 @@ public class LayeredColorMaskTexture extends AbstractTexture {
return;
}
regenerateIfNotAllocated();
TextureUtil.uploadTextureImage(this.getGlTextureId(), bufferedimage);
}
}

View File

@ -63,6 +63,7 @@ public class LayeredTexture extends AbstractTexture {
return;
}
regenerateIfNotAllocated();
TextureUtil.uploadTextureImage(this.getGlTextureId(), bufferedimage);
}
}

View File

@ -62,6 +62,7 @@ public class SimpleTexture extends AbstractTexture {
}
}
regenerateIfNotAllocated();
TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
} finally {
if (inputstream != null) {

View File

@ -74,6 +74,7 @@ public class TextureMap extends AbstractTexture implements ITickableTextureObjec
private int height;
private boolean isEaglerPBRMode = false;
public int eaglerPBRMaterialTexture = -1;
private boolean hasAllocatedEaglerPBRMaterialTexture = false;
public static final int _GL_FRAMEBUFFER = 0x8D40;
public static final int _GL_COLOR_ATTACHMENT0 = 0x8CE0;
@ -173,6 +174,7 @@ public class TextureMap extends AbstractTexture implements ITickableTextureObjec
if (isEaglerPBRMode) {
if (eaglerPBRMaterialTexture == -1) {
eaglerPBRMaterialTexture = GlStateManager.generateTexture();
hasAllocatedEaglerPBRMaterialTexture = false;
}
if (copyMaterialFramebuffer == null) {
GlStateManager.bindTexture(eaglerPBRMaterialTexture);
@ -422,9 +424,14 @@ public class TextureMap extends AbstractTexture implements ITickableTextureObjec
logger.info("Created: {}x{} {}-atlas", new Object[] { Integer.valueOf(stitcher.getCurrentWidth()),
Integer.valueOf(stitcher.getCurrentHeight()), this.basePath });
regenerateIfNotAllocated();
TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(),
stitcher.getCurrentHeight());
if (isEaglerPBRMode) {
if (hasAllocatedEaglerPBRMaterialTexture) {
EaglercraftGPU.regenerateTexture(eaglerPBRMaterialTexture);
}
hasAllocatedEaglerPBRMaterialTexture = true;
TextureUtil.allocateTextureImpl(eaglerPBRMaterialTexture, this.mipmapLevels, stitcher.getCurrentWidth(),
stitcher.getCurrentHeight() * 2);
}

View File

@ -326,7 +326,7 @@ public class TextureUtil {
public static int[] convertComponentOrder(int[] arr) {
for (int i = 0; i < arr.length; ++i) {
int j = arr[i];
arr[i] = (j & 0xFF000000) | ((j >> 16) & 0xFF) | (j & 0xFF00) | ((j << 16) & 0xFF0000);
arr[i] = ((j >> 16) & 0xFF) | (j & 0xFF00FF00) | ((j << 16) & 0xFF0000);
}
return arr;
}

View File

@ -136,6 +136,8 @@ public abstract class ResourcePackListEntry implements GuiListExtended.IGuiListE
protected abstract void func_148313_c();
protected abstract String getEaglerFolderName();
protected boolean func_148310_d() {
return true;
}
@ -183,7 +185,7 @@ public abstract class ResourcePackListEntry implements GuiListExtended.IGuiListE
if (deleteInstead) {
this.mc.loadingScreen.eaglerShow(I18n.format("resourcePack.load.deleting"), this.func_148312_b());
EaglerFolderResourcePack.deleteResourcePack(EaglerFolderResourcePack.RESOURCE_PACKS,
this.func_148312_b());
this.getEaglerFolderName());
} else {
this.resourcePacksGUI.getSelectedResourcePacks().add(0, this);
}

View File

@ -100,4 +100,9 @@ public class ResourcePackListEntryDefault extends ResourcePackListEntry {
protected boolean func_148310_d() {
return false;
}
@Override
protected String getEaglerFolderName() {
return null;
}
}

View File

@ -50,4 +50,9 @@ public class ResourcePackListEntryFound extends ResourcePackListEntry {
public ResourcePackRepository.Entry func_148318_i() {
return this.field_148319_c;
}
@Override
protected String getEaglerFolderName() {
return field_148319_c.getResourcePackName();
}
}

View File

@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.function.Consumer;
import net.lax1dude.eaglercraft.v1_8.Base64;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile;
@ -377,10 +378,26 @@ public class PlatformRuntime {
}
@Async
public static native ArrayBuffer downloadRemoteURI(String assetPackageURI, boolean forceCache);
public static native ArrayBuffer downloadRemoteURI(final String assetPackageURI, final boolean forceCache);
private static void downloadRemoteURI(String assetPackageURI, boolean useCache, final AsyncCallback<ArrayBuffer> cb) {
doFetchDownload(assetPackageURI, useCache ? "force-cache" : "no-store", cb::complete);
private static void downloadRemoteURI(final String assetPackageURI, final boolean useCache, final AsyncCallback<ArrayBuffer> cb) {
doFetchDownload(assetPackageURI, useCache ? "force-cache" : "no-store",
assetPackageURI.startsWith("data:application/octet-stream;base64,") ? (data) -> {
if(data != null) {
cb.complete(data);
}else {
logger.error("Caught an error decoding base64 via fetch, doing it the slow way instead...");
byte[] b = null;
try {
b = Base64.decodeBase64(assetPackageURI.substring(37));
}catch(Throwable t) {
logger.error("Failed to manually decode base64!", t);
cb.complete(null);
return;
}
cb.complete(TeaVMUtils.unwrapArrayBuffer(b));
}
} : cb::complete);
}
public static boolean isDebugRuntime() {